tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

HTMLTableSectionElement.html (2304B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Custom Elements: CEReactions on HTMLTableSectionElement interface</title>
      5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
      6 <meta name="assert" content="deleteRow of HTMLTableSectionElement interface must have CEReactions">
      7 <meta name="help" content="https://dom.spec.whatwg.org/#node">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="../resources/custom-elements-helpers.js"></script>
     11 <script src="./resources/reactions.js"></script>
     12 </head>
     13 <body>
     14 <div id="log"></div>
     15 <script>
     16 
     17 test_with_window(function (contentWindow, contentDocument) {
     18    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     19    contentDocument.body.innerHTML = `<table><thead><tr><td><custom-element>hello</custom-element></td></tr></thead></table>`;
     20    const thead = contentDocument.querySelector('thead');
     21    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     22    assert_equals(thead.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
     23 
     24    const table = contentDocument.querySelector('table');
     25    assert_equals(table.tHead, thead);
     26    table.tHead.deleteRow(0);
     27    assert_array_equals(element.takeLog().types(), ['disconnected']);
     28 }, 'deleteRow() on HTMLTableSectionElement on thead must enqueue disconnectedCallback when removing a custom element');
     29 
     30 test_with_window(function (contentWindow, contentDocument) {
     31    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     32    contentDocument.body.innerHTML = `<table><tfoot><tr><td><custom-element>hello</custom-element></td></tr></tfoot></table>`;
     33    const tfoot = contentDocument.querySelector('tfoot');
     34    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     35    assert_equals(tfoot.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
     36 
     37    const table = contentDocument.querySelector('table');
     38    assert_equals(table.tFoot, tfoot);
     39    table.tFoot.deleteRow(0);
     40    assert_array_equals(element.takeLog().types(), ['disconnected']);
     41 }, 'deleteRow() on HTMLTableSectionElement on tfoot must enqueue disconnectedCallback when removing a custom element');
     42 
     43 </script>
     44 </body>
     45 </html>