| OLD | NEW |
| 1 | 1 |
| 2 function setupObjectHooks(hooks) | 2 function setupObjectHooks(hooks) |
| 3 { | 3 { |
| 4 // Wrapper for these object should be materialized before setting hooks. | 4 // Wrapper for these object should be materialized before setting hooks. |
| 5 console.log; | 5 console.log; |
| 6 document.register; | 6 document.register; |
| 7 HTMLSpanElement.prototype; | 7 HTMLSpanElement.prototype; |
| 8 | 8 |
| 9 Object.defineProperty(Object.prototype, "prototype", { | 9 Object.defineProperty(Object.prototype, "prototype", { |
| 10 get: function() { return hooks.prototypeGet(); }, | 10 get: function() { return hooks.prototypeGet(); }, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 function exerciseDocumentRegister() | 22 function exerciseDocumentRegister() |
| 23 { | 23 { |
| 24 register('x-a', {}); | 24 register('x-a', {}); |
| 25 register('x-b', {prototype: Object.create(HTMLElement.prototype)}); | 25 register('x-b', {prototype: Object.create(HTMLElement.prototype)}); |
| 26 } | 26 } |
| 27 | 27 |
| 28 function register(name, options) | 28 function register(name, options) |
| 29 { | 29 { |
| 30 var myConstructor = null; | 30 var myConstructor = null; |
| 31 try { | 31 try { |
| 32 myConstructor = document.register(name, options); | 32 myConstructor = document.registerElement(name, options); |
| 33 } catch (e) { } | 33 } catch (e) { } |
| 34 | 34 |
| 35 try { | 35 try { |
| 36 if (!myConstructor) { | 36 if (!myConstructor) { |
| 37 debug("Constructor object isn't created."); | 37 debug("Constructor object isn't created."); |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 | 40 |
| 41 if (myConstructor.prototype != options.prototype) { | 41 if (myConstructor.prototype != options.prototype) { |
| 42 console.log("FAIL: bad prototype"); | 42 console.log("FAIL: bad prototype"); |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 | 45 |
| 46 var element = new myConstructor(); | 46 var element = new myConstructor(); |
| 47 if (!element) | 47 if (!element) |
| 48 return; | 48 return; |
| 49 if (element.constructor != myConstructor) { | 49 if (element.constructor != myConstructor) { |
| 50 console.log("FAIL: bad constructor"); | 50 console.log("FAIL: bad constructor"); |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 } catch (e) { console.log(e); } | 53 } catch (e) { console.log(e); } |
| 54 } | 54 } |
| OLD | NEW |