Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / w3c / web-platform-tests / custom-elements / concepts / custom-elements-type-allowed-chars-first-char.html
1 <!DOCTYPE html>\r
2 <html>\r
3 <head>\r
4 <title>First char allowed for custom element type </title>\r
5 <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">\r
6 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">\r
7 <meta name="assert" content="The custom element type identifies a custom element interface and is a sequence of characters that must match the NCName production">\r
8 <link rel="help" href="https://dvcs.w3.org/hg/webcomponents/raw-file/default/spec/custom/index.html#concepts">\r
9 <link rel="help" href="http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName">\r
10 <script src="../../../../resources/testharness.js"></script>\r
11 <script src="../../../../resources/testharnessreport.js"></script>\r
12 <script src="../testcommon.js"></script>\r
13 <link rel="stylesheet" href="../../../../resources/testharness.css">\r
14 </head>\r
15 <body>\r
16 <div id="log"></div>\r
17 <script type="text/javascript">\r
18 function composeName(charCode) {\r
19     return String.fromCharCode(charCode) + '-x' + charCode.toString(16);\r
20 }\r
21 \r
22 // NCName definition from http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName\r
23 // NCName     ::= (Letter | '_') (NCNameChar)*\r
24 // NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender\r
25 // Letter     ::= BaseChar | Ideographic\r
26 \r
27 test(function() {\r
28     testCharCode(getCharCode('_'), composeName, checkValidName);\r
29 }, 'Registering valid custom element name starting with \'_\' char');\r
30 \r
31 test(function() {\r
32     baseCharsSingle.testEach(composeName, checkValidName);\r
33     baseCharsRanges.testEach(composeName, checkValidName);\r
34 }, 'Registering valid custom element name starting with base char');\r
35 \r
36 test(function() {\r
37     ideographicCharsSingle.testEach(composeName, checkValidName);\r
38     ideographicCharsRanges.testEach(composeName, checkValidName);\r
39 }, 'Registering valid custom element name starting with ideographic char');\r
40 \r
41 test(function() {\r
42     (new CharsArray(['.', '-', ':', '+', '='])).testEach(composeName, checkInvalidName);\r
43 }, 'Registering custom element starting with invalid character (general) should fail');\r
44 \r
45 test(function() {\r
46     combiningChars.testEach(composeName, checkInvalidName);\r
47 }, 'Registering custom element starting with invalid character (combining char) should fail');\r
48 \r
49 test(function() {\r
50     extenderChars.testEach(composeName, checkInvalidName);\r
51 }, 'Registering custom element starting with invalid character (extender char) should fail');\r
52 \r
53 test(function() {\r
54     digitCharsRanges.testEach(composeName, checkInvalidName);\r
55 }, 'Registering custom element starting with invalid character (digit char) should fail');\r
56 </script>\r
57 </body>\r
58 </html>\r