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

Side by Side Diff: LayoutTests/fast/dom/custom/document-register-namespace.html

Issue 117313008: Update Custom Elements API to new names. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update for forgotten tests. Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 description('Using document.register() for extending HTML and non-HTML elements. '); 8 description('Using document.registerElement() for extending HTML and non-HTML el ements.');
9 9
10 function createElementFromHTML(html) 10 function createElementFromHTML(html)
11 { 11 {
12 var container = document.createElement('div'); 12 var container = document.createElement('div');
13 container.innerHTML = html; 13 container.innerHTML = html;
14 return container.firstChild; 14 return container.firstChild;
15 } 15 }
16 16
17 function createElementFromSVG(svg) 17 function createElementFromSVG(svg)
18 { 18 {
19 var container = document.createElement('div'); 19 var container = document.createElement('div');
20 container.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg">' + svg + '</ svg>'; 20 container.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg">' + svg + '</ svg>';
21 return container.firstChild.firstChild; 21 return container.firstChild.firstChild;
22 } 22 }
23 23
24 CustomHTMLElement = document.register('html-foo', { prototype: Object.create(HTM LElement.prototype) }); 24 CustomHTMLElement = document.registerElement('html-foo', { prototype: Object.cre ate(HTMLElement.prototype) });
25 CustomSVGElement = document.register('svg-foo', { prototype: Object.create(SVGGE lement.prototype), extends: 'g' }); 25 CustomSVGElement = document.registerElement('svg-foo', { prototype: Object.creat e(SVGGElement.prototype), extends: 'g' });
26 26
27 var html1 = new CustomHTMLElement(); 27 var html1 = new CustomHTMLElement();
28 shouldBe('html1.namespaceURI', '"http://www.w3.org/1999/xhtml"'); 28 shouldBe('html1.namespaceURI', '"http://www.w3.org/1999/xhtml"');
29 var html2 = document.createElement('html-foo'); 29 var html2 = document.createElement('html-foo');
30 shouldBe('html2.namespaceURI', '"http://www.w3.org/1999/xhtml"'); 30 shouldBe('html2.namespaceURI', '"http://www.w3.org/1999/xhtml"');
31 var html3 = document.createElementNS('http://www.w3.org/1999/xhtml', 'html-foo') ; 31 var html3 = document.createElementNS('http://www.w3.org/1999/xhtml', 'html-foo') ;
32 shouldBe('html3.namespaceURI', '"http://www.w3.org/1999/xhtml"'); 32 shouldBe('html3.namespaceURI', '"http://www.w3.org/1999/xhtml"');
33 var html4 = createElementFromHTML('<html-foo></html-foo>'); 33 var html4 = createElementFromHTML('<html-foo></html-foo>');
34 shouldBe('html4.namespaceURI', '"http://www.w3.org/1999/xhtml"'); 34 shouldBe('html4.namespaceURI', '"http://www.w3.org/1999/xhtml"');
35 35
(...skipping 22 matching lines...) Expand all
58 shouldBe('Object.getPrototypeOf(notSVG1)', 'HTMLElement.prototype'); 58 shouldBe('Object.getPrototypeOf(notSVG1)', 'HTMLElement.prototype');
59 var notSVG2 = createElementFromHTML('<svg-foo></svg-foo>'); 59 var notSVG2 = createElementFromHTML('<svg-foo></svg-foo>');
60 shouldBe('notSVG2.namespaceURI', '"http://www.w3.org/1999/xhtml"'); 60 shouldBe('notSVG2.namespaceURI', '"http://www.w3.org/1999/xhtml"');
61 shouldBeFalse('notSVG2 instanceof CustomSVGElement'); 61 shouldBeFalse('notSVG2 instanceof CustomSVGElement');
62 shouldBeFalse('notSVG2 instanceof HTMLUnknownElement'); 62 shouldBeFalse('notSVG2 instanceof HTMLUnknownElement');
63 shouldBeTrue('notSVG2 instanceof HTMLElement'); 63 shouldBeTrue('notSVG2 instanceof HTMLElement');
64 shouldBe('Object.getPrototypeOf(notSVG2)', 'HTMLElement.prototype'); 64 shouldBe('Object.getPrototypeOf(notSVG2)', 'HTMLElement.prototype');
65 </script> 65 </script>
66 </body> 66 </body>
67 </html> 67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698