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', | 21 'font-face', |
22 'font-face-src', | 22 'font-face-src', |
23 'font-face-uri', | 23 'font-face-uri', |
24 'font-face-format', | 24 'font-face-format', |
25 'font-face-name', | 25 'font-face-name', |
26 'missing-glyph' | 26 'missing-glyph', |
| 27 // names containing colon |
| 28 ':-xfoo', |
| 29 'xfoo:yfoo' |
27 ]; | 30 ]; |
28 | 31 |
29 for (var i = 0; i < invalidNames.length; i++) { | 32 for (var i = 0; i < invalidNames.length; i++) { |
30 var invalidName = invalidNames[i]; | 33 var invalidName = invalidNames[i]; |
31 assert_throws('SYNTAX_ERR', function (){ | 34 assert_throws('SYNTAX_ERR', function (){ |
32 document.registerElement(invalidName, createRegisterParameters()); | 35 document.registerElement(invalidName, createRegisterParameters()); |
33 }, 'register invalid custom element name: ' + invalidName); | 36 }, 'register invalid custom element name: ' + invalidName); |
34 } | 37 } |
35 | 38 |
36 }, 'invalid and reserved names'); | 39 }, 'invalid and reserved names'); |
(...skipping 16 matching lines...) Expand all Loading... |
53 'y--bar' : 'Y--BAR' | 56 'y--bar' : 'Y--BAR' |
54 }; | 57 }; |
55 for(var elementName in validNameTagMap) { | 58 for(var elementName in validNameTagMap) { |
56 var expectedTagName = validNameTagMap[elementName]; | 59 var expectedTagName = validNameTagMap[elementName]; |
57 var tagName = (new (document.registerElement(elementName, createRegister
Parameters()))()).tagName; | 60 var tagName = (new (document.registerElement(elementName, createRegister
Parameters()))()).tagName; |
58 assert_equals(tagName, expectedTagName, tagName + ' must be treated as a
custom element'); | 61 assert_equals(tagName, expectedTagName, tagName + ' must be treated as a
custom element'); |
59 } | 62 } |
60 }, 'strange but valid names'); | 63 }, 'strange but valid names'); |
61 | 64 |
62 </script> | 65 </script> |
OLD | NEW |