OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <body> | 4 <body> |
5 <script> | 5 <script> |
6 function createRegisterParameters() { | 6 function createRegisterParameters() { |
7 return { | 7 return { |
8 prototype: Object.create(HTMLElement.prototype, { thisIsPrototype: { val
ue: true } }) | 8 prototype: Object.create(HTMLElement.prototype, { thisIsPrototype: { val
ue: true } }) |
9 }; | 9 }; |
10 } | 10 } |
11 | 11 |
12 test(function () { | 12 test(function () { |
13 var invalidNames = [ | 13 var invalidNames = [ |
14 // Hyphen missing: | 14 // Hyphen missing: |
15 'foo', | 15 'foo', |
16 'xfoo', | 16 'xfoo', |
17 // Reserved names: | 17 // Reserved names: |
18 // hyphen-containing names from the applicable specifications, | 18 // hyphen-containing names from the applicable specifications, |
19 // namely the SVG and the MathML. | 19 // namely the SVG and the MathML. |
20 'annotation-xml', | 20 'annotation-xml' |
21 'font-face', | |
22 'font-face-src', | |
23 'font-face-uri', | |
24 'font-face-format', | |
25 'font-face-name', | |
26 'missing-glyph' | |
27 ]; | 21 ]; |
28 | 22 |
29 for (var i = 0; i < invalidNames.length; i++) { | 23 for (var i = 0; i < invalidNames.length; i++) { |
30 var invalidName = invalidNames[i]; | 24 var invalidName = invalidNames[i]; |
31 assert_throws('SYNTAX_ERR', function (){ | 25 assert_throws('SYNTAX_ERR', function (){ |
32 document.registerElement(invalidName, createRegisterParameters()); | 26 document.registerElement(invalidName, createRegisterParameters()); |
33 }, 'register invalid custom element name: ' + invalidName); | 27 }, 'register invalid custom element name: ' + invalidName); |
34 } | 28 } |
35 | 29 |
36 }, 'invalid and reserved names'); | 30 }, 'invalid and reserved names'); |
(...skipping 16 matching lines...) Expand all Loading... |
53 'y--bar' : 'Y--BAR' | 47 'y--bar' : 'Y--BAR' |
54 }; | 48 }; |
55 for(var elementName in validNameTagMap) { | 49 for(var elementName in validNameTagMap) { |
56 var expectedTagName = validNameTagMap[elementName]; | 50 var expectedTagName = validNameTagMap[elementName]; |
57 var tagName = (new (document.registerElement(elementName, createRegister
Parameters()))()).tagName; | 51 var tagName = (new (document.registerElement(elementName, createRegister
Parameters()))()).tagName; |
58 assert_equals(tagName, expectedTagName, tagName + ' must be treated as a
custom element'); | 52 assert_equals(tagName, expectedTagName, tagName + ' must be treated as a
custom element'); |
59 } | 53 } |
60 }, 'strange but valid names'); | 54 }, 'strange but valid names'); |
61 | 55 |
62 </script> | 56 </script> |
OLD | NEW |