| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html id="html" lang="en" xmlns="http://www.w3.org/1999/xhtml"> | 2 <html id="html" lang="en" xmlns="http://www.w3.org/1999/xhtml"> |
| 3 <head id="head"> | 3 <head id="head"> |
| 4 <title>Selectors-API Test Suite: XHTML</title> | 4 <title>Selectors-API Test Suite: XHTML</title> |
| 5 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="selectors.js"></script> | 7 <script src="selectors.js"></script> |
| 8 <script src="ParentNode-querySelector-All.js"></script> | 8 <script src="ParentNode-querySelector-All.js"></script> |
| 9 <style>iframe { visibility: hidden; position: absolute; }</style> | 9 <style>iframe { visibility: hidden; position: absolute; }</style> |
| 10 </head> | 10 </head> |
| 11 <body> | 11 <body> |
| 12 <div id="log">This test requires JavaScript.</div> | 12 <div id="log">This test requires JavaScript.</div> |
| 13 | 13 |
| 14 <script><![CDATA[ | 14 <script><![CDATA[ |
| 15 async_test(function() { | 15 async_test(function() { |
| 16 var frame = document.createElement("iframe"); | 16 var frame = document.createElement("iframe"); |
| 17 frame.onload = this.step_func_done(init); | 17 var self = this; |
| 18 frame.onload = function() { |
| 19 // :target doesn't work before a page rendering on some browsers. We run |
| 20 // tests after an animation frame because it may be later than the first |
| 21 // page rendering. |
| 22 requestAnimationFrame(self.step_func_done(init.bind(self, frame))); |
| 23 }; |
| 18 frame.src = "ParentNode-querySelector-All-content.xht#target"; | 24 frame.src = "ParentNode-querySelector-All-content.xht#target"; |
| 19 document.body.appendChild(frame); | 25 document.body.appendChild(frame); |
| 20 }) | 26 }) |
| 21 | 27 |
| 22 function init(e) { | 28 function init(target) { |
| 23 /* | 29 /* |
| 24 * This test suite tests Selectors API methods in 4 different contexts: | 30 * This test suite tests Selectors API methods in 4 different contexts: |
| 25 * 1. Document node | 31 * 1. Document node |
| 26 * 2. In-document Element node | 32 * 2. In-document Element node |
| 27 * 3. Detached Element node (an element with no parent, not in the document) | 33 * 3. Detached Element node (an element with no parent, not in the document) |
| 28 * 4. Document Fragment node | 34 * 4. Document Fragment node |
| 29 * | 35 * |
| 30 * For each context, the following tests are run: | 36 * For each context, the following tests are run: |
| 31 * | 37 * |
| 32 * The interface check tests ensure that each type of node exposes the Selecto
rs API methods | 38 * The interface check tests ensure that each type of node exposes the Selecto
rs API methods |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 * All the selectors tested for both the valid and invalid selector tests are
found in selectors.js. | 57 * All the selectors tested for both the valid and invalid selector tests are
found in selectors.js. |
| 52 * See comments in that file for documentation of the format used. | 58 * See comments in that file for documentation of the format used. |
| 53 * | 59 * |
| 54 * The ParentNode-querySelector-All.js file contains all the common test funct
ions for running each of the aforementioned tests | 60 * The ParentNode-querySelector-All.js file contains all the common test funct
ions for running each of the aforementioned tests |
| 55 */ | 61 */ |
| 56 | 62 |
| 57 var testType = TEST_QSA; | 63 var testType = TEST_QSA; |
| 58 var docType = "xhtml"; // Only run tests suitable for XHTML | 64 var docType = "xhtml"; // Only run tests suitable for XHTML |
| 59 | 65 |
| 60 // Prepare the nodes for testing | 66 // Prepare the nodes for testing |
| 61 var doc = e.target.contentDocument; // Document Node tests | 67 var doc = target.contentDocument; // Document Node tests |
| 62 | 68 |
| 63 var element = doc.getElementById("root"); // In-document Element Node tests | 69 var element = doc.getElementById("root"); // In-document Element Node tests |
| 64 | 70 |
| 65 //Setup the namespace tests | 71 //Setup the namespace tests |
| 66 setupSpecialElements(doc, element); | 72 setupSpecialElements(doc, element); |
| 67 | 73 |
| 68 var outOfScope = element.cloneNode(true); // Append this to the body before
running the in-document | 74 var outOfScope = element.cloneNode(true); // Append this to the body before
running the in-document |
| 69 // Element tests, but after runni
ng the Document tests. This | 75 // Element tests, but after runni
ng the Document tests. This |
| 70 // tests that no elements that ar
e not descendants of element | 76 // tests that no elements that ar
e not descendants of element |
| 71 // are selected. | 77 // are selected. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 runValidSelectorTest("Detached Element", detached, validSelectors, testType, d
ocType); | 111 runValidSelectorTest("Detached Element", detached, validSelectors, testType, d
ocType); |
| 106 runValidSelectorTest("Fragment", fragment, validSelectors, testType, docType); | 112 runValidSelectorTest("Fragment", fragment, validSelectors, testType, docType); |
| 107 | 113 |
| 108 doc.body.appendChild(outOfScope); // Append before in-document Element tests. | 114 doc.body.appendChild(outOfScope); // Append before in-document Element tests. |
| 109 // None of these elements should match | 115 // None of these elements should match |
| 110 runValidSelectorTest("In-document Element", element, validSelectors, testType,
docType); | 116 runValidSelectorTest("In-document Element", element, validSelectors, testType,
docType); |
| 111 } | 117 } |
| 112 ]]></script> | 118 ]]></script> |
| 113 </body> | 119 </body> |
| 114 </html> | 120 </html> |
| OLD | NEW |