| OLD | NEW | 
| (Empty) |  | 
 |   1 <!DOCTYPE html> | 
 |   2 <html> | 
 |   3 <head> | 
 |   4 <title>Invoke CALLBACK with ELEMENT as callback this value</title> | 
 |   5 <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru
    "> | 
 |   6 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> | 
 |   7 <meta name="assert" content="Invoke CALLBACK with ELEMENT as callback this value
    "> | 
 |   8 <link rel="help" href="http://www.w3.org/TR/custom-elements/#enqueuing-and-invok
    ing-callbacks"> | 
 |   9 <script src="../../../../../resources/testharness.js"></script> | 
 |  10 <script src="../../../../../resources/testharnessreport.js"></script> | 
 |  11 <script src="../../testcommon.js"></script> | 
 |  12 <link rel="stylesheet" href="../../../../../resources/testharness.css"> | 
 |  13 </head> | 
 |  14 <body> | 
 |  15 <div id="log"></div> | 
 |  16 <script> | 
 |  17 test(function() { | 
 |  18     var doc = newHTMLDocument(); | 
 |  19     var proto = newHTMLElementPrototype(); | 
 |  20     var GeneratedConstructor = doc.registerElement('x-a', {prototype: proto}); | 
 |  21     var customElement = new GeneratedConstructor(); | 
 |  22  | 
 |  23     doc.body.innerHTML = '<x-a id="x-a"></x-a>'; | 
 |  24     assert_equals(doc.querySelector('#x-a'), proto.createdCallbackThis, | 
 |  25         '\'this\' value of the created callback should be the custom element'); | 
 |  26 }, 'Test \'this\' value inside created callback.'); | 
 |  27  | 
 |  28  | 
 |  29 testInIFrame('../../resources/x-element.html', function(doc) { | 
 |  30     var proto = newHTMLElementPrototype(); | 
 |  31     doc.registerElement('x-element', {prototype: proto}); | 
 |  32  | 
 |  33     assert_equals(doc.querySelector('#x-element'), proto.attachedCallbackThis, | 
 |  34         '\'this\' value of the attached callback should be the custom element'); | 
 |  35 }, 'Test \'this\' value inside attached callback.'); | 
 |  36  | 
 |  37  | 
 |  38 testInIFrame('../../resources/x-element.html', function(doc) { | 
 |  39     var proto = newHTMLElementPrototype(); | 
 |  40     doc.registerElement('x-element', {prototype: proto}); | 
 |  41  | 
 |  42     var customElement = doc.querySelector('#x-element'); | 
 |  43     doc.body.removeChild(customElement); | 
 |  44     assert_equals(customElement, proto.detachedCallbackThis, | 
 |  45         '\'this\' value of the detached callback should be the custom element'); | 
 |  46 }, 'Test \'this\' value inside detached callback.'); | 
 |  47  | 
 |  48  | 
 |  49 test(function() { | 
 |  50     var doc = newHTMLDocument(); | 
 |  51     var proto = newHTMLElementPrototype(); | 
 |  52     var GeneratedConstructor = doc.registerElement('x-b', {prototype: proto}); | 
 |  53     var customElement = new GeneratedConstructor(); | 
 |  54  | 
 |  55     customElement.setAttribute('class', 'someClass'); | 
 |  56     assert_equals(customElement, proto.attributeChangedCallbackThis, | 
 |  57         '\'this\' value of the attributeChanged callback should be the custom el
    ement'); | 
 |  58 }, 'Test \'this\' value inside attributeChanged callback.'); | 
 |  59 </script> | 
 |  60 </body> | 
 |  61 </html> | 
| OLD | NEW |