OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta charset=utf-8> |
| 3 <title>Document.createAttribute</title> |
| 4 <script src=../../../../resources/testharness.js></script> |
| 5 <script src=../../../../resources/testharnessreport.js></script> |
| 6 <script src=attributes.js></script> |
| 7 <script src=productions.js></script> |
| 8 <div id=log> |
| 9 <script> |
| 10 var xml_document; |
| 11 setup(function() { |
| 12 xml_document = document.implementation.createDocument(null, null, null); |
| 13 }); |
| 14 |
| 15 invalid_names.forEach(function(name) { |
| 16 test(function() { |
| 17 assert_throws("INVALID_CHARACTER_ERR", function() { |
| 18 document.createAttribute(name, "test"); |
| 19 }); |
| 20 }, "HTML document.createAttribute(" + format_value(name) + ")"); |
| 21 |
| 22 test(function() { |
| 23 assert_throws("INVALID_CHARACTER_ERR", function() { |
| 24 xml_document.createAttribute(name, "test"); |
| 25 }); |
| 26 }, "XML document.createAttribute(" + format_value(name) + ")"); |
| 27 }); |
| 28 |
| 29 var tests = ["title", "TITLE", null, undefined]; |
| 30 tests.forEach(function(name) { |
| 31 test(function() { |
| 32 var attribute = document.createAttribute(name); |
| 33 attr_is(attribute, "", String(name).toLowerCase(), null, null, String(name).
toLowerCase()); |
| 34 assert_equals(attribute.ownerElement, null); |
| 35 }, "HTML document.createAttribute(" + format_value(name) + ")"); |
| 36 |
| 37 test(function() { |
| 38 var attribute = xml_document.createAttribute(name); |
| 39 attr_is(attribute, "", String(name), null, null, String(name)); |
| 40 assert_equals(attribute.ownerElement, null); |
| 41 }, "XML document.createAttribute(" + format_value(name) + ")"); |
| 42 }); |
| 43 </script> |
OLD | NEW |