| OLD | NEW |
| 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.register() type extension behaviours through creat
eElement().'); | 10 description('Testing document.register() type extension behaviours through creat
eElement().'); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // HTMLElement <- input <- x-bar <- x-qux | 24 // HTMLElement <- input <- x-bar <- x-qux |
| 25 // <- x-foo <- x-baz | 25 // <- x-foo <- x-baz |
| 26 // | 26 // |
| 27 | 27 |
| 28 fooConstructor = document.register('x-foo', { prototype: Object.create(HTMLEleme
nt.prototype) }); | 28 fooConstructor = document.register('x-foo', { prototype: Object.create(HTMLEleme
nt.prototype) }); |
| 29 barConstructor = document.register('x-bar', { extends: 'input', prototype: Objec
t.create(HTMLInputElement.prototype) }); | 29 barConstructor = document.register('x-bar', { extends: 'input', prototype: Objec
t.create(HTMLInputElement.prototype) }); |
| 30 bazConstructor = document.register('x-baz', { prototype: Object.create(fooConstr
uctor.prototype) }); | 30 bazConstructor = document.register('x-baz', { prototype: Object.create(fooConstr
uctor.prototype) }); |
| 31 quxConstructor = document.register('x-qux', { extends: 'input', prototype: Objec
t.create(barConstructor.prototype) }); | 31 quxConstructor = document.register('x-qux', { extends: 'input', prototype: Objec
t.create(barConstructor.prototype) }); |
| 32 | 32 |
| 33 // Same name, different local name | 33 // Same name, different local name |
| 34 shouldThrow('document.register("x-foo", { prototype: Object.create(HTMLDivElemen
t.prototype) })', '"InvalidStateError: Failed to call \'register\' on \'Document
\' for type \'x-foo\': a type with that name is already registered."'); | 34 shouldThrow('document.register("x-foo", { prototype: Object.create(HTMLDivElemen
t.prototype) })', '"InvalidStateError: Failed to execute \'register\' on \'Docum
ent\': Registration failed for type \'x-foo\'. A type with that name is already
registered."'); |
| 35 | 35 |
| 36 // | 36 // |
| 37 // Generated constructors | 37 // Generated constructors |
| 38 // | 38 // |
| 39 | 39 |
| 40 fooNewed = new fooConstructor(); | 40 fooNewed = new fooConstructor(); |
| 41 fooOuterHTML = '<x-foo></x-foo>'; | 41 fooOuterHTML = '<x-foo></x-foo>'; |
| 42 shouldBeEqualToString('fooNewed.outerHTML', fooOuterHTML); | 42 shouldBeEqualToString('fooNewed.outerHTML', fooOuterHTML); |
| 43 shouldBeTrue('fooNewed instanceof fooConstructor && fooNewed instanceof HTMLElem
ent'); | 43 shouldBeTrue('fooNewed instanceof fooConstructor && fooNewed instanceof HTMLElem
ent'); |
| 44 shouldBeFalse('fooNewed instanceof HTMLUnknownElement'); | 44 shouldBeFalse('fooNewed instanceof HTMLUnknownElement'); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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> |
| OLD | NEW |