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

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

Issue 98543011: Improve Document exception messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 <div id="container"></div> 7 <div id="container"></div>
8 <form id="testForm"></form> 8 <form id="testForm"></form>
9 <script> 9 <script>
10 description('Testing document.registerElement() type extension behaviours throug h createElement().'); 10 description('Testing document.registerElement() type extension behaviours throug h createElement().');
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 shouldBeTrue('barFooCreated instanceof HTMLElement'); 116 shouldBeTrue('barFooCreated instanceof HTMLElement');
117 117
118 fooCreatedNull = document.createElement('x-foo', null); 118 fooCreatedNull = document.createElement('x-foo', null);
119 shouldBeEqualToString('fooCreatedNull.outerHTML', fooOuterHTML); 119 shouldBeEqualToString('fooCreatedNull.outerHTML', fooOuterHTML);
120 shouldBeTrue('fooCreatedNull instanceof fooConstructor'); 120 shouldBeTrue('fooCreatedNull instanceof fooConstructor');
121 121
122 fooCreatedEmpty = document.createElement('x-foo', ''); 122 fooCreatedEmpty = document.createElement('x-foo', '');
123 shouldBeEqualToString('fooCreatedEmpty.outerHTML', fooOuterHTML); 123 shouldBeEqualToString('fooCreatedEmpty.outerHTML', fooOuterHTML);
124 shouldBeTrue('fooCreatedEmpty instanceof fooConstructor'); 124 shouldBeTrue('fooCreatedEmpty instanceof fooConstructor');
125 125
126 shouldThrow('document.createElement("@invalid", "x-bar")', '"InvalidCharacterErr or: The string contains invalid characters."'); 126 shouldThrow('document.createElement("@invalid", "x-bar")', '"InvalidCharacterErr or: Failed to execute \'createElement\' on \'Document\': \'@invalid\' is not a v alid element name."');
127 127
128 // 128 //
129 // createElementNS() with type extensions 129 // createElementNS() with type extensions
130 // 130 //
131 131
132 fooCreatedNS = document.createElementNS('http://www.w3.org/1999/xhtml', 'x-foo', null); 132 fooCreatedNS = document.createElementNS('http://www.w3.org/1999/xhtml', 'x-foo', null);
133 shouldBeEqualToString('fooCreatedNS.outerHTML', fooOuterHTML); 133 shouldBeEqualToString('fooCreatedNS.outerHTML', fooOuterHTML);
134 shouldBeTrue('fooCreatedNS instanceof fooConstructor'); 134 shouldBeTrue('fooCreatedNS instanceof fooConstructor');
135 135
136 barCreatedNS = document.createElementNS('http://www.w3.org/1999/xhtml', 'input', 'x-bar'); 136 barCreatedNS = document.createElementNS('http://www.w3.org/1999/xhtml', 'input', 'x-bar');
137 shouldBeEqualToString('barCreatedNS.outerHTML', barOuterHTML); 137 shouldBeEqualToString('barCreatedNS.outerHTML', barOuterHTML);
138 shouldBeTrue('barCreatedNS instanceof barConstructor'); 138 shouldBeTrue('barCreatedNS instanceof barConstructor');
139 shouldBeTrue('isFormControl(barCreatedNS)'); 139 shouldBeTrue('isFormControl(barCreatedNS)');
140 140
141 shouldThrow('document.createElementNS("http://example.com/2013/no-such-namespace ", "xml:lang", "x-bar")', '"NamespaceError: An attempt was made to create or cha nge an object in a way which is incorrect with regard to namespaces."'); 141 shouldThrow('document.createElementNS("http://example.com/2013/no-such-namespace ", "xml:lang", "x-bar")', '"NamespaceError: Failed to execute \'createElementNS\ ' on \'Document\': \'http://example.com/2013/no-such-namespace\' is not a valid namespace for elements."');
142 142
143 // parser 143 // parser
144 function createElementFromHTML(html) { 144 function createElementFromHTML(html) {
145 var container = document.createElement('div'); 145 var container = document.createElement('div');
146 container.innerHTML = html; 146 container.innerHTML = html;
147 return container.firstChild; 147 return container.firstChild;
148 } 148 }
149 149
150 fooParsed = createElementFromHTML('<x-foo>'); 150 fooParsed = createElementFromHTML('<x-foo>');
151 shouldBeTrue('fooParsed instanceof fooConstructor'); 151 shouldBeTrue('fooParsed instanceof fooConstructor');
(...skipping 11 matching lines...) Expand all
163 shouldBeFalse('namedBarParsed instanceof HTMLUnknownElement'); 163 shouldBeFalse('namedBarParsed instanceof HTMLUnknownElement');
164 shouldBeTrue('namedBarParsed instanceof HTMLElement'); 164 shouldBeTrue('namedBarParsed instanceof HTMLElement');
165 165
166 divBarParsed = createElementFromHTML('<div is="x-bar">') 166 divBarParsed = createElementFromHTML('<div is="x-bar">')
167 shouldBeFalse('divBarParsed instanceof barConstructor'); 167 shouldBeFalse('divBarParsed instanceof barConstructor');
168 shouldBeTrue('divBarParsed instanceof HTMLDivElement'); 168 shouldBeTrue('divBarParsed instanceof HTMLDivElement');
169 169
170 </script> 170 </script>
171 </body> 171 </body>
172 </html> 172 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698