Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: LayoutTests/fast/dom/custom/element-names.html

Issue 493713002: Invalid chars should not be allowed as first character in custom element name (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addrressing comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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',
dglazkov 2014/11/06 05:52:43 What about test expectations?
deepak.sa 2014/11/06 06:20:02 Test expectation file for this file has been remov
deepak.sa 2014/11/06 06:38:38 CL in which test expectations were removed : https
21 // names containing colon
22 ':-xfoo',
23 'xfoo-:yfoo'
21 ]; 24 ];
22 25
23 for (var i = 0; i < invalidNames.length; i++) { 26 for (var i = 0; i < invalidNames.length; i++) {
24 var invalidName = invalidNames[i]; 27 var invalidName = invalidNames[i];
25 assert_throws('SYNTAX_ERR', function (){ 28 assert_throws('SYNTAX_ERR', function (){
26 document.registerElement(invalidName, createRegisterParameters()); 29 document.registerElement(invalidName, createRegisterParameters());
27 }, 'register invalid custom element name: ' + invalidName); 30 }, 'register invalid custom element name: ' + invalidName);
28 } 31 }
29 32
30 }, 'invalid and reserved names'); 33 }, 'invalid and reserved names');
(...skipping 16 matching lines...) Expand all
47 'y--bar' : 'Y--BAR' 50 'y--bar' : 'Y--BAR'
48 }; 51 };
49 for(var elementName in validNameTagMap) { 52 for(var elementName in validNameTagMap) {
50 var expectedTagName = validNameTagMap[elementName]; 53 var expectedTagName = validNameTagMap[elementName];
51 var tagName = (new (document.registerElement(elementName, createRegister Parameters()))()).tagName; 54 var tagName = (new (document.registerElement(elementName, createRegister Parameters()))()).tagName;
52 assert_equals(tagName, expectedTagName, tagName + ' must be treated as a custom element'); 55 assert_equals(tagName, expectedTagName, tagName + ' must be treated as a custom element');
53 } 56 }
54 }, 'strange but valid names'); 57 }, 'strange but valid names');
55 58
56 </script> 59 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698