Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / custom / element-names.html
blob56d4db0676debf85e9c2b43e318e32f3c736f036
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <body>
5 <script>
6 function createRegisterParameters() {
7 return {
8 prototype: Object.create(HTMLElement.prototype, { thisIsPrototype: { value: true } })
9 };
12 test(function () {
13 var invalidNames = [
14 // Hyphen missing:
15 'foo',
16 'xfoo',
17 // Reserved names:
18 // hyphen-containing names from the applicable specifications,
19 // namely the SVG and the MathML.
20 'annotation-xml',
21 // names containing colon
22 ':-xfoo',
23 'xfoo-:yfoo'
26 for (var i = 0; i < invalidNames.length; i++) {
27 var invalidName = invalidNames[i];
28 assert_throws('SYNTAX_ERR', function (){
29 document.registerElement(invalidName, createRegisterParameters());
30 }, 'register invalid custom element name: ' + invalidName);
33 }, 'invalid and reserved names');
35 test(function (){
36 document.registerElement('x-foo', createRegisterParameters());
37 assert_throws('NOT_SUPPORTED_ERR', function (){
38 document.registerElement('x-foo', createRegisterParameters());
39 }, 'register already registered "x-foo"');
40 assert_throws('NOT_SUPPORTED_ERR', function (){
41 document.registerElement('X-FOO', createRegisterParameters());
42 }, 'register "X-FOO", same as already registered "x-foo"');
43 }, 'name conflicts');
45 test(function () {
46 var validNameTagMap = {
47 'y-bar': 'Y-BAR',
48 'yz-bar': 'YZ-BAR',
49 'y-z-bar': 'Y-Z-BAR',
50 'y--bar' : 'Y--BAR'
52 for(var elementName in validNameTagMap) {
53 var expectedTagName = validNameTagMap[elementName];
54 var tagName = (new (document.registerElement(elementName, createRegisterParameters()))()).tagName;
55 assert_equals(tagName, expectedTagName, tagName + ' must be treated as a custom element');
57 }, 'strange but valid names');
59 </script>