mirror of
https://github.com/servo/servo.git
synced 2025-06-20 07:08:59 +01:00
Switch from let to var in mozilla wpt tests
let can't be used without specifying a newer JS version at the moment.
This commit is contained in:
parent
a3eb253bdc
commit
8aa026e741
14 changed files with 72 additions and 72 deletions
|
@ -5,7 +5,7 @@
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
test(function() {
|
||||||
assert_equals(String(DOMParser).indexOf("function DOMParser("), 0);
|
assert_equals(String(DOMParser).indexOf("function DOMParser("), 0);
|
||||||
let parser = new DOMParser();
|
var parser = new DOMParser();
|
||||||
assert_true(parser instanceof DOMParser, "Should be DOMParser");
|
assert_true(parser instanceof DOMParser, "Should be DOMParser");
|
||||||
assert_true(parser.parseFromString("", "text/html") instanceof Document, "Should be Document");
|
assert_true(parser.parseFromString("", "text/html") instanceof Document, "Should be Document");
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
test(function() {
|
test(function() {
|
||||||
assert_equals(String(Event).indexOf("function Event("), 0);
|
assert_equals(String(Event).indexOf("function Event("), 0);
|
||||||
|
|
||||||
let ev = new Event("foopy", {cancelable: true});
|
var ev = new Event("foopy", {cancelable: true});
|
||||||
assert_true(ev instanceof Event, "Should be Event");
|
assert_true(ev instanceof Event, "Should be Event");
|
||||||
|
|
||||||
assert_equals(ev.type, 'foopy');
|
assert_equals(ev.type, 'foopy');
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
test(function() {
|
test(function() {
|
||||||
assert_equals(String(MouseEvent).indexOf("function MouseEvent("), 0);
|
assert_equals(String(MouseEvent).indexOf("function MouseEvent("), 0);
|
||||||
|
|
||||||
let ev = new MouseEvent("press", {bubbles: true, screenX: 150, detail: 100});
|
var ev = new MouseEvent("press", {bubbles: true, screenX: 150, detail: 100});
|
||||||
|
|
||||||
assert_true(ev instanceof Event, "Should be Event");
|
assert_true(ev instanceof Event, "Should be Event");
|
||||||
assert_true(ev instanceof UIEvent, "Should be UIEvent");
|
assert_true(ev instanceof UIEvent, "Should be UIEvent");
|
||||||
|
|
|
@ -12,23 +12,23 @@
|
||||||
}, "existing document's body");
|
}, "existing document's body");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let new_body = document.createElement("body");
|
var new_body = document.createElement("body");
|
||||||
assert_not_equals(new_body, null, "test2-0, replace document's body with new body");
|
assert_not_equals(new_body, null, "test2-0, replace document's body with new body");
|
||||||
document.body = new_body;
|
document.body = new_body;
|
||||||
assert_equals(new_body, document.body, "test2-1, replace document's body with new body");
|
assert_equals(new_body, document.body, "test2-1, replace document's body with new body");
|
||||||
}, "replace document's body with new body");
|
}, "replace document's body with new body");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let new_frameset = document.createElement("frameset");
|
var new_frameset = document.createElement("frameset");
|
||||||
assert_not_equals(new_frameset, null, "test2-0, replace document's body with new frameset");
|
assert_not_equals(new_frameset, null, "test2-0, replace document's body with new frameset");
|
||||||
document.body = new_frameset;
|
document.body = new_frameset;
|
||||||
assert_equals(new_frameset, document.body, "test2-1, replace document's body with new frameset");
|
assert_equals(new_frameset, document.body, "test2-1, replace document's body with new frameset");
|
||||||
}, "replace document's body with new frameset");
|
}, "replace document's body with new frameset");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let new_document = new Document();
|
var new_document = new Document();
|
||||||
new_document.appendChild(new_document.createElement("html"));
|
new_document.appendChild(new_document.createElement("html"));
|
||||||
let new_div = new_document.createElement("div");
|
var new_div = new_document.createElement("div");
|
||||||
|
|
||||||
assert_not_equals(new_div, null, "test4-0, append an invalid element to a new document");
|
assert_not_equals(new_div, null, "test4-0, append an invalid element to a new document");
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@
|
||||||
}, "append an invalid element to a new document");
|
}, "append an invalid element to a new document");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let new_document = document.implementation.createHTMLDocument();
|
var new_document = document.implementation.createHTMLDocument();
|
||||||
let new_body = new_document.createElement("body");
|
var new_body = new_document.createElement("body");
|
||||||
|
|
||||||
assert_not_equals(new_body, null, "test5-0, append body to a new document");
|
assert_not_equals(new_body, null, "test5-0, append body to a new document");
|
||||||
assert_true(new_body instanceof HTMLBodyElement, "test5-1, append body to a new document: should be HTMLBodyElement");
|
assert_true(new_body instanceof HTMLBodyElement, "test5-1, append body to a new document: should be HTMLBodyElement");
|
||||||
|
@ -51,8 +51,8 @@
|
||||||
}, "append body to a new document");
|
}, "append body to a new document");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let new_document = document.implementation.createHTMLDocument();
|
var new_document = document.implementation.createHTMLDocument();
|
||||||
let new_frameset = new_document.createElement("frameset");
|
var new_frameset = new_document.createElement("frameset");
|
||||||
|
|
||||||
assert_not_equals(new_frameset, null, "test6-0, append frameset to a new document");
|
assert_not_equals(new_frameset, null, "test6-0, append frameset to a new document");
|
||||||
assert_true(new_frameset instanceof HTMLFrameSetElement, "test6-1, append frameset to a new document: should be HTMLFrameSetElement");
|
assert_true(new_frameset instanceof HTMLFrameSetElement, "test6-1, append frameset to a new document: should be HTMLFrameSetElement");
|
||||||
|
|
|
@ -8,17 +8,17 @@
|
||||||
<div id="bar"></div>
|
<div id="bar"></div>
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
test(function() {
|
||||||
let gBody = document.getElementsByTagName("body")[0];
|
var gBody = document.getElementsByTagName("body")[0];
|
||||||
|
|
||||||
// Test the assertion with inserting node with child having id into the document (mozilla#2630)
|
// Test the assertion with inserting node with child having id into the document (mozilla#2630)
|
||||||
// This need not to port to WPF-test because this tests servo's internally flags.
|
// This need not to port to WPF-test because this tests servo's internally flags.
|
||||||
{
|
{
|
||||||
let TEST_ID = "test-9";
|
var TEST_ID = "test-9";
|
||||||
let a = document.createElement("a");
|
var a = document.createElement("a");
|
||||||
let b = document.createElement("b");
|
var b = document.createElement("b");
|
||||||
a.appendChild(b).id = TEST_ID;
|
a.appendChild(b).id = TEST_ID;
|
||||||
gBody.appendChild(a);
|
gBody.appendChild(a);
|
||||||
let result = document.getElementById(TEST_ID);
|
var result = document.getElementById(TEST_ID);
|
||||||
assert_equals(result, b, "test 9-0");
|
assert_equals(result, b, "test 9-0");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div name="foo"></div>
|
<div name="foo"></div>
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
test(function() {
|
||||||
let nameList = document.getElementsByName("foo");
|
var nameList = document.getElementsByName("foo");
|
||||||
assert_true(nameList instanceof NodeList, "Should be NodeList");
|
assert_true(nameList instanceof NodeList, "Should be NodeList");
|
||||||
assert_false(nameList instanceof HTMLCollection, "Should not be HTMLCollection");
|
assert_false(nameList instanceof HTMLCollection, "Should not be HTMLCollection");
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
}, "existing document's head");
|
}, "existing document's head");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let new_document = new Document();
|
var new_document = new Document();
|
||||||
new_document.appendChild(new_document.createElement("html"));
|
new_document.appendChild(new_document.createElement("html"));
|
||||||
let new_head = new_document.createElement("head");
|
var new_head = new_document.createElement("head");
|
||||||
|
|
||||||
assert_not_equals(new_head, null, "test2-0, append head to a new document");
|
assert_not_equals(new_head, null, "test2-0, append head to a new document");
|
||||||
assert_true(new_head instanceof HTMLHeadElement, "test2-1, append head to a new document: should be HTMLHeadElement");
|
assert_true(new_head instanceof HTMLHeadElement, "test2-1, append head to a new document: should be HTMLHeadElement");
|
||||||
|
@ -29,10 +29,10 @@
|
||||||
}, "append head to a new document");
|
}, "append head to a new document");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let new_document = new Document();
|
var new_document = new Document();
|
||||||
let html = new_document.createElement("html");
|
var html = new_document.createElement("html");
|
||||||
let foo = new_document.createElement("foo");
|
var foo = new_document.createElement("foo");
|
||||||
let head = new_document.createElement("head");
|
var head = new_document.createElement("head");
|
||||||
new_document.appendChild(html);
|
new_document.appendChild(html);
|
||||||
html.appendChild(foo);
|
html.appendChild(foo);
|
||||||
foo.appendChild(head);
|
foo.appendChild(head);
|
||||||
|
|
|
@ -7,28 +7,28 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="test" foo="bar"></div>
|
<div id="test" foo="bar"></div>
|
||||||
<script>
|
<script>
|
||||||
let element = document.getElementById("test");
|
var element = document.getElementById("test");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let r1 = element.getAttribute("id");
|
var r1 = element.getAttribute("id");
|
||||||
assert_equals(r1, "test", "test1-0, Element.getAttribute().");
|
assert_equals(r1, "test", "test1-0, Element.getAttribute().");
|
||||||
let r2 = element.getAttribute("foo");
|
var r2 = element.getAttribute("foo");
|
||||||
assert_equals(r2, "bar", "test1-1, Element.getAttribute().");
|
assert_equals(r2, "bar", "test1-1, Element.getAttribute().");
|
||||||
});
|
});
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let NAME = "hoge";
|
var NAME = "hoge";
|
||||||
let VALUE = "fuga";
|
var VALUE = "fuga";
|
||||||
element.setAttribute(NAME, VALUE);
|
element.setAttribute(NAME, VALUE);
|
||||||
let r = element.getAttribute(NAME);
|
var r = element.getAttribute(NAME);
|
||||||
assert_equals(r, VALUE, "test2. Element.setAttribute().");
|
assert_equals(r, VALUE, "test2. Element.setAttribute().");
|
||||||
});
|
});
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let NAME = "foo";
|
var NAME = "foo";
|
||||||
let VALUE = "mozilla";
|
var VALUE = "mozilla";
|
||||||
element.setAttribute(NAME, VALUE);
|
element.setAttribute(NAME, VALUE);
|
||||||
let r = element.getAttribute(NAME);
|
var r = element.getAttribute(NAME);
|
||||||
assert_equals(r, VALUE, "test3, attribute update by Element.setAttribute().")
|
assert_equals(r, VALUE, "test3, attribute update by Element.setAttribute().")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -36,18 +36,18 @@
|
||||||
element.setAttribute("id", "bar");
|
element.setAttribute("id", "bar");
|
||||||
element.removeAttribute("id");
|
element.removeAttribute("id");
|
||||||
|
|
||||||
let r1 = element.hasAttribute("id");
|
var r1 = element.hasAttribute("id");
|
||||||
assert_equals(r1, false, "test4-0, Element.removeAttribute().");
|
assert_equals(r1, false, "test4-0, Element.removeAttribute().");
|
||||||
let r2 = element.getAttribute("id");
|
var r2 = element.getAttribute("id");
|
||||||
assert_equals(r2, null, "test4-1, Element.removeAttribute().");
|
assert_equals(r2, null, "test4-1, Element.removeAttribute().");
|
||||||
});
|
});
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
element.setAttribute("xml:lang", "en");
|
element.setAttribute("xml:lang", "en");
|
||||||
|
|
||||||
let r1 = element.hasAttribute("xml:lang");
|
var r1 = element.hasAttribute("xml:lang");
|
||||||
assert_equals(r1, true, "test5-0, Element.setAttribute('xml:lang').");
|
assert_equals(r1, true, "test5-0, Element.setAttribute('xml:lang').");
|
||||||
let r2 = element.getAttribute("xml:lang");
|
var r2 = element.getAttribute("xml:lang");
|
||||||
assert_not_equals(r2, null, "test5-1, Element.setAttribute('xml:lang').");
|
assert_not_equals(r2, null, "test5-1, Element.setAttribute('xml:lang').");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
test(function() {
|
||||||
let div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.className = "foo bar";
|
div.className = "foo bar";
|
||||||
|
|
||||||
let classList = div.classList;
|
var classList = div.classList;
|
||||||
div.className = "";
|
div.className = "";
|
||||||
|
|
||||||
assert_equals(classList.item(0), null, "classList.item(0) must return null when all classes have been removed");
|
assert_equals(classList.item(0), null, "classList.item(0) must return null when all classes have been removed");
|
||||||
|
|
|
@ -9,19 +9,19 @@
|
||||||
<div id="foo-2" class="baz"></div>
|
<div id="foo-2" class="baz"></div>
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
test(function() {
|
||||||
let foo1 = document.getElementById("foo-1");
|
var foo1 = document.getElementById("foo-1");
|
||||||
let foo2 = document.getElementById("foo-2");
|
var foo2 = document.getElementById("foo-2");
|
||||||
|
|
||||||
foo1.className += " bar";
|
foo1.className += " bar";
|
||||||
assert_equals(foo1.className, "foo bar");
|
assert_equals(foo1.className, "foo bar");
|
||||||
|
|
||||||
let foo3 = document.createElement("div");
|
var foo3 = document.createElement("div");
|
||||||
foo3.id = "foo-3";
|
foo3.id = "foo-3";
|
||||||
foo3.className = "foo";
|
foo3.className = "foo";
|
||||||
document.body.appendChild(foo3);
|
document.body.appendChild(foo3);
|
||||||
assert_equals(foo3, document.getElementById("foo-3"));
|
assert_equals(foo3, document.getElementById("foo-3"));
|
||||||
|
|
||||||
let collection = document.getElementsByClassName("foo");
|
var collection = document.getElementsByClassName("foo");
|
||||||
assert_equals(collection.length, 2);
|
assert_equals(collection.length, 2);
|
||||||
assert_equals(collection[0].id, foo1.id);
|
assert_equals(collection[0].id, foo1.id);
|
||||||
assert_equals(collection[1].id, foo3.id);
|
assert_equals(collection[1].id, foo3.id);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
test(function() {
|
||||||
let test = document.getElementById("foo");
|
var test = document.getElementById("foo");
|
||||||
|
|
||||||
assert_equals(test.matches("#foo"), true, "test-1");
|
assert_equals(test.matches("#foo"), true, "test-1");
|
||||||
assert_equals(test.matches("#not-foo"), false, "test-2");
|
assert_equals(test.matches("#not-foo"), false, "test-2");
|
||||||
|
|
|
@ -15,16 +15,16 @@
|
||||||
<p id="p3" class="bbb ccc"/>
|
<p id="p3" class="bbb ccc"/>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
let foo1 = document.getElementById("foo-1");
|
var foo1 = document.getElementById("foo-1");
|
||||||
let foo2 = document.getElementById("foo-2");
|
var foo2 = document.getElementById("foo-2");
|
||||||
let bar = document.getElementById("bar");
|
var bar = document.getElementById("bar");
|
||||||
let live = document.getElementById("live");
|
var live = document.getElementById("live");
|
||||||
let child = document.createElement("p");
|
var child = document.createElement("p");
|
||||||
let p1 = document.getElementById("p1");
|
var p1 = document.getElementById("p1");
|
||||||
let p2 = document.getElementById("p2");
|
var p2 = document.getElementById("p2");
|
||||||
let p3 = document.getElementById("p3");
|
var p3 = document.getElementById("p3");
|
||||||
|
|
||||||
let htmlcollection = null;
|
var htmlcollection = null;
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
htmlcollection = document.getElementsByClassName("foo");
|
htmlcollection = document.getElementsByClassName("foo");
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
assert_equals(htmlcollection.length, 1);
|
assert_equals(htmlcollection.length, 1);
|
||||||
assert_equals(htmlcollection.item(0), live);
|
assert_equals(htmlcollection.item(0), live);
|
||||||
|
|
||||||
let new_live = document.createElement("div");
|
var new_live = document.createElement("div");
|
||||||
new_live.className = "live";
|
new_live.className = "live";
|
||||||
document.body.appendChild(new_live);
|
document.body.appendChild(new_live);
|
||||||
assert_equals(htmlcollection.length, 2);
|
assert_equals(htmlcollection.length, 2);
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
htmlcollection = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "div");
|
htmlcollection = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "div");
|
||||||
assert_equals(htmlcollection.length, 5);
|
assert_equals(htmlcollection.length, 5);
|
||||||
|
|
||||||
let from_element = document.documentElement.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "div");
|
var from_element = document.documentElement.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "div");
|
||||||
assert_equals(htmlcollection.length, from_element.length);
|
assert_equals(htmlcollection.length, from_element.length);
|
||||||
|
|
||||||
htmlcollection = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "DIV");
|
htmlcollection = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "DIV");
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
htmlcollection = document.getElementsByClassName("aaa,bbb");
|
htmlcollection = document.getElementsByClassName("aaa,bbb");
|
||||||
assert_equals(htmlcollection.length, 0);
|
assert_equals(htmlcollection.length, 0);
|
||||||
|
|
||||||
let from_element = document.getElementById("class-example").getElementsByClassName("bbb");
|
var from_element = document.getElementById("class-example").getElementsByClassName("bbb");
|
||||||
assert_equals(from_element.length, 2);
|
assert_equals(from_element.length, 2);
|
||||||
assert_equals(from_element.item(0), p1);
|
assert_equals(from_element.item(0), p1);
|
||||||
assert_equals(from_element.item(1), p3);
|
assert_equals(from_element.item(1), p3);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div id="bar" class="myClass"></p>
|
<div id="bar" class="myClass"></p>
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
test(function() {
|
||||||
let div = document.getElementById("foo");
|
var div = document.getElementById("foo");
|
||||||
assert_equals(document.querySelector("#foo"), div);
|
assert_equals(document.querySelector("#foo"), div);
|
||||||
|
|
||||||
div = document.getElementById("foo\\bar");
|
div = document.getElementById("foo\\bar");
|
||||||
|
@ -26,8 +26,8 @@
|
||||||
}, "Document");
|
}, "Document");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let body = document.body;
|
var body = document.body;
|
||||||
let div = document.getElementById("foo");
|
var div = document.getElementById("foo");
|
||||||
assert_equals(body.querySelector("#foo"), div);
|
assert_equals(body.querySelector("#foo"), div);
|
||||||
|
|
||||||
div = document.getElementById("foo\\bar");
|
div = document.getElementById("foo\\bar");
|
||||||
|
@ -42,17 +42,17 @@
|
||||||
}, "Element");
|
}, "Element");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let docfrag = document.createDocumentFragment();
|
var docfrag = document.createDocumentFragment();
|
||||||
|
|
||||||
let div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.id = "foo";
|
div.id = "foo";
|
||||||
div.className = "myClass";
|
div.className = "myClass";
|
||||||
|
|
||||||
let child = document.createElement("div");
|
var child = document.createElement("div");
|
||||||
div.appendChild(child);
|
div.appendChild(child);
|
||||||
docfrag.appendChild(div);
|
docfrag.appendChild(div);
|
||||||
|
|
||||||
let p = document.createElement("p");
|
var p = document.createElement("p");
|
||||||
p.id = "bar";
|
p.id = "bar";
|
||||||
p.className = "myClass";
|
p.className = "myClass";
|
||||||
docfrag.appendChild(p);
|
docfrag.appendChild(p);
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
<div id="baz" class="test"></div>
|
<div id="baz" class="test"></div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
let foo = document.getElementById("foo");
|
var foo = document.getElementById("foo");
|
||||||
let bar = document.getElementById("bar");
|
var bar = document.getElementById("bar");
|
||||||
let baz = document.getElementById("baz");
|
var baz = document.getElementById("baz");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let nodelist = document.querySelectorAll(".test");
|
var nodelist = document.querySelectorAll(".test");
|
||||||
assert_true(nodelist instanceof NodeList, "Should be NodeList");
|
assert_true(nodelist instanceof NodeList, "Should be NodeList");
|
||||||
assert_equals(nodelist.length, 3);
|
assert_equals(nodelist.length, 3);
|
||||||
assert_equals(nodelist.item(0), foo);
|
assert_equals(nodelist.item(0), foo);
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
}, "Document");
|
}, "Document");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let div = document.getElementById("parent");
|
var div = document.getElementById("parent");
|
||||||
let nodelist = div.querySelectorAll(".test");
|
var nodelist = div.querySelectorAll(".test");
|
||||||
assert_equals(nodelist.length, 3);
|
assert_equals(nodelist.length, 3);
|
||||||
|
|
||||||
nodelist = div.querySelectorAll("div:nth-of-type(1)");
|
nodelist = div.querySelectorAll("div:nth-of-type(1)");
|
||||||
|
@ -37,17 +37,17 @@
|
||||||
}, "Element");
|
}, "Element");
|
||||||
|
|
||||||
test(function() {
|
test(function() {
|
||||||
let docfrag = document.createDocumentFragment();
|
var docfrag = document.createDocumentFragment();
|
||||||
|
|
||||||
let div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.id = "foo";
|
div.id = "foo";
|
||||||
div.className = "myClass";
|
div.className = "myClass";
|
||||||
|
|
||||||
let child = document.createElement("div");
|
var child = document.createElement("div");
|
||||||
div.appendChild(child);
|
div.appendChild(child);
|
||||||
docfrag.appendChild(div);
|
docfrag.appendChild(div);
|
||||||
|
|
||||||
let nodelist = docfrag.querySelectorAll("#foo");
|
var nodelist = docfrag.querySelectorAll("#foo");
|
||||||
assert_equals(nodelist.item(0), div);
|
assert_equals(nodelist.item(0), div);
|
||||||
|
|
||||||
nodelist = docfrag.querySelectorAll("#foo:nth-child(1)");
|
nodelist = docfrag.querySelectorAll("#foo:nth-child(1)");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue