mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 838518 part 2. Fix nodeiterator callers per the API change that was made. r=smaug
This commit is contained in:
parent
d71214e1ed
commit
ebdd009711
@ -31,7 +31,7 @@ function test() {
|
|||||||
{
|
{
|
||||||
node.normalize();
|
node.normalize();
|
||||||
let iter = node.ownerDocument.createNodeIterator(node, NodeFilter.SHOW_TEXT + NodeFilter.SHOW_COMMENT,
|
let iter = node.ownerDocument.createNodeIterator(node, NodeFilter.SHOW_TEXT + NodeFilter.SHOW_COMMENT,
|
||||||
null, false);
|
null);
|
||||||
|
|
||||||
while ((node = iter.nextNode())) {
|
while ((node = iter.nextNode())) {
|
||||||
node.nodeValue = node.nodeValue.replace(/\s+/g, '');
|
node.nodeValue = node.nodeValue.replace(/\s+/g, '');
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
var iterator = document.createNodeIterator(document,
|
var iterator = document.createNodeIterator(document,
|
||||||
NodeFilter.SHOW_ALL,
|
NodeFilter.SHOW_ALL,
|
||||||
null, false);
|
null);
|
||||||
var node;
|
var node;
|
||||||
|
|
||||||
// forwards
|
// forwards
|
||||||
@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
found.length = 0;
|
found.length = 0;
|
||||||
iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL,
|
iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL,
|
||||||
filter, false);
|
filter);
|
||||||
|
|
||||||
// forwards
|
// forwards
|
||||||
while (node = iterator.nextNode())
|
while (node = iterator.nextNode())
|
||||||
@ -116,7 +116,7 @@
|
|||||||
if (n < 0)
|
if (n < 0)
|
||||||
iterator.detach();
|
iterator.detach();
|
||||||
return NodeFilter.FILTER_ACCEPT;
|
return NodeFilter.FILTER_ACCEPT;
|
||||||
}, false);
|
});
|
||||||
while (--n >= 0)
|
while (--n >= 0)
|
||||||
iterator.nextNode();
|
iterator.nextNode();
|
||||||
try {
|
try {
|
||||||
@ -141,8 +141,7 @@
|
|||||||
|
|
||||||
return document.createNodeIterator(grandparent,
|
return document.createNodeIterator(grandparent,
|
||||||
NodeFilter.SHOW_ALL,
|
NodeFilter.SHOW_ALL,
|
||||||
filter,
|
filter);
|
||||||
false);
|
|
||||||
})(function filter(n) {
|
})(function filter(n) {
|
||||||
if (n.nodeName != "img")
|
if (n.nodeName != "img")
|
||||||
return NodeFilter.FILTER_ACCEPT;
|
return NodeFilter.FILTER_ACCEPT;
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
var E = $('E');
|
var E = $('E');
|
||||||
|
|
||||||
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
||||||
null, false);
|
null);
|
||||||
check(iterator.nextNode(), root, '1.0');
|
check(iterator.nextNode(), root, '1.0');
|
||||||
|
|
||||||
// 1. Remove a node unrelated to the reference node
|
// 1. Remove a node unrelated to the reference node
|
||||||
@ -87,7 +87,7 @@
|
|||||||
var G = $('G');
|
var G = $('G');
|
||||||
var H = $('H');
|
var H = $('H');
|
||||||
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
||||||
null, false);
|
null);
|
||||||
|
|
||||||
check(iterator.nextNode(), root, '2.0');
|
check(iterator.nextNode(), root, '2.0');
|
||||||
check(iterator.nextNode(), F, '2.1');
|
check(iterator.nextNode(), F, '2.1');
|
||||||
@ -109,7 +109,7 @@
|
|||||||
var KK = $('KK');
|
var KK = $('KK');
|
||||||
|
|
||||||
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
||||||
null, false);
|
null);
|
||||||
check(iterator.nextNode(), root, '3.0');
|
check(iterator.nextNode(), root, '3.0');
|
||||||
check(iterator.nextNode(), I, '3.1');
|
check(iterator.nextNode(), I, '3.1');
|
||||||
check(iterator.nextNode(), II, '3.2');
|
check(iterator.nextNode(), II, '3.2');
|
||||||
@ -135,7 +135,7 @@
|
|||||||
var N = $('N');
|
var N = $('N');
|
||||||
|
|
||||||
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
||||||
null, false);
|
null);
|
||||||
check(iterator.nextNode(), root, '4.1');
|
check(iterator.nextNode(), root, '4.1');
|
||||||
check(iterator.nextNode(), L, '4.2');
|
check(iterator.nextNode(), L, '4.2');
|
||||||
check(iterator.nextNode(), M, '4.3');
|
check(iterator.nextNode(), M, '4.3');
|
||||||
@ -153,7 +153,7 @@
|
|||||||
var Q = $('Q');
|
var Q = $('Q');
|
||||||
|
|
||||||
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
||||||
null, false);
|
null);
|
||||||
check(iterator.nextNode(), root, '5.1');
|
check(iterator.nextNode(), root, '5.1');
|
||||||
check(iterator.nextNode(), O, '5.2');
|
check(iterator.nextNode(), O, '5.2');
|
||||||
check(iterator.nextNode(), P, '5.3');
|
check(iterator.nextNode(), P, '5.3');
|
||||||
@ -172,7 +172,7 @@
|
|||||||
var T = $('T');
|
var T = $('T');
|
||||||
|
|
||||||
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
||||||
null, false);
|
null);
|
||||||
check(iterator.nextNode(), root, '6.1');
|
check(iterator.nextNode(), root, '6.1');
|
||||||
check(iterator.nextNode(), R, '6.2');
|
check(iterator.nextNode(), R, '6.2');
|
||||||
check(iterator.nextNode(), S, '6.3');
|
check(iterator.nextNode(), S, '6.3');
|
||||||
@ -191,7 +191,7 @@
|
|||||||
var W = $('W');
|
var W = $('W');
|
||||||
|
|
||||||
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
|
||||||
null, false);
|
null);
|
||||||
check(iterator.nextNode(), root, '7.1');
|
check(iterator.nextNode(), root, '7.1');
|
||||||
check(iterator.nextNode(), U, '7.2');
|
check(iterator.nextNode(), U, '7.2');
|
||||||
check(iterator.nextNode(), V, '7.3');
|
check(iterator.nextNode(), V, '7.3');
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
function checkseq(it, root, expect) {
|
function checkseq(it, root, expect) {
|
||||||
var checkIt = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
var checkIt = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
var printedPointer = (it.referenceNode == undefined);
|
var printedPointer = (it.referenceNode == undefined);
|
||||||
var string = '';
|
var string = '';
|
||||||
var node;
|
var node;
|
||||||
@ -62,7 +62,7 @@
|
|||||||
(function(){
|
(function(){
|
||||||
var root = resetContent();
|
var root = resetContent();
|
||||||
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
|
|
||||||
checkseq(it, root, 'A B C D E F G H I');
|
checkseq(it, root, 'A B C D E F G H I');
|
||||||
it.nextNode();
|
it.nextNode();
|
||||||
@ -77,7 +77,7 @@
|
|||||||
(function(){
|
(function(){
|
||||||
var root = resetContent();
|
var root = resetContent();
|
||||||
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
|
|
||||||
for (var i = 0; i < 4; i++)
|
for (var i = 0; i < 4; i++)
|
||||||
it.nextNode();
|
it.nextNode();
|
||||||
@ -102,7 +102,7 @@
|
|||||||
(function(){
|
(function(){
|
||||||
var root = resetContent();
|
var root = resetContent();
|
||||||
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
|
|
||||||
})();
|
})();
|
||||||
*/
|
*/
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
function resetContent() {
|
function resetContent() {
|
||||||
content.innerHTML = initInner;
|
content.innerHTML = initInner;
|
||||||
var checkIt = document.createNodeIterator(content, NodeFilter.SHOW_ELEMENT,
|
var checkIt = document.createNodeIterator(content, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
var node;
|
var node;
|
||||||
while ((node = checkIt.nextNode()) != null) {
|
while ((node = checkIt.nextNode()) != null) {
|
||||||
if (node.id) {
|
if (node.id) {
|
||||||
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
function checkseq(it, root, expect) {
|
function checkseq(it, root, expect) {
|
||||||
var checkIt = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
var checkIt = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
var printedPointer = (it.referenceNode == undefined);
|
var printedPointer = (it.referenceNode == undefined);
|
||||||
var string = '';
|
var string = '';
|
||||||
var node;
|
var node;
|
||||||
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
resetContent();
|
resetContent();
|
||||||
var it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
|
var it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
checkseq(it, root, "root B C D * [E] E1 E11");
|
checkseq(it, root, "root B C D * [E] E1 E11");
|
||||||
|
|
||||||
removeNode(C);
|
removeNode(C);
|
||||||
@ -94,7 +94,7 @@
|
|||||||
|
|
||||||
resetContent();
|
resetContent();
|
||||||
it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
|
it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
checkseq(it, root, "root B C D * [E] E1 E11");
|
checkseq(it, root, "root B C D * [E] E1 E11");
|
||||||
|
|
||||||
it.nextNode();
|
it.nextNode();
|
||||||
@ -119,7 +119,7 @@
|
|||||||
|
|
||||||
resetContent();
|
resetContent();
|
||||||
it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
|
it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
|
||||||
testNodeFilter, false);
|
testNodeFilter);
|
||||||
checkseq(it, root, "root B C D * [E] E1 E11");
|
checkseq(it, root, "root B C D * [E] E1 E11");
|
||||||
|
|
||||||
removeNode(root);
|
removeNode(root);
|
||||||
|
@ -55,8 +55,7 @@ function filter(node) {
|
|||||||
it = document.createNodeIterator(
|
it = document.createNodeIterator(
|
||||||
document.getElementById("nodes"),
|
document.getElementById("nodes"),
|
||||||
NodeFilter.SHOW_ELEMENT,
|
NodeFilter.SHOW_ELEMENT,
|
||||||
filter,
|
filter
|
||||||
false
|
|
||||||
);
|
);
|
||||||
while (it.nextNode());
|
while (it.nextNode());
|
||||||
})();
|
})();
|
||||||
|
@ -139,7 +139,7 @@
|
|||||||
"NodeIterator interface: attribute pointerBeforeReferenceNode": true,
|
"NodeIterator interface: attribute pointerBeforeReferenceNode": true,
|
||||||
"NodeIterator interface: attribute whatToShow": true,
|
"NodeIterator interface: attribute whatToShow": true,
|
||||||
"NodeIterator interface: attribute filter": true,
|
"NodeIterator interface: attribute filter": true,
|
||||||
"Stringification of document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)": "debug",
|
"Stringification of document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null)": "debug",
|
||||||
"TreeWalker interface: existence and properties of interface object": true,
|
"TreeWalker interface: existence and properties of interface object": true,
|
||||||
"TreeWalker interface: existence and properties of interface prototype object": true,
|
"TreeWalker interface: existence and properties of interface prototype object": true,
|
||||||
"TreeWalker interface: existence and properties of interface prototype object's \"constructor\" property": true,
|
"TreeWalker interface: existence and properties of interface prototype object's \"constructor\" property": true,
|
||||||
|
@ -509,7 +509,7 @@ idlArray.add_objects({
|
|||||||
ProcessingInstruction: ['xmlDoc.createProcessingInstruction("abc", "def")'],
|
ProcessingInstruction: ['xmlDoc.createProcessingInstruction("abc", "def")'],
|
||||||
Comment: ['document.createComment("abc")'],
|
Comment: ['document.createComment("abc")'],
|
||||||
Range: ['document.createRange()', 'detachedRange'],
|
Range: ['document.createRange()', 'detachedRange'],
|
||||||
NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)'],
|
NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null)'],
|
||||||
TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null)'],
|
TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null)'],
|
||||||
NodeList: ['document.querySelectorAll("script")'],
|
NodeList: ['document.querySelectorAll("script")'],
|
||||||
HTMLCollection: ['document.body.children'],
|
HTMLCollection: ['document.body.children'],
|
||||||
|
@ -23,8 +23,7 @@ function test(val) {
|
|||||||
try {
|
try {
|
||||||
document.createNodeIterator(document.body,
|
document.createNodeIterator(document.body,
|
||||||
NodeFilter.SHOW_ALL,
|
NodeFilter.SHOW_ALL,
|
||||||
function() { throw val },
|
function() { throw val }).nextNode();
|
||||||
true).nextNode();
|
|
||||||
ok(false, "NodeIterator::nextNode() should have thrown an exception.");
|
ok(false, "NodeIterator::nextNode() should have thrown an exception.");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
ok(val === ex, "NodeIterator did not properly forward exception " +
|
ok(val === ex, "NodeIterator did not properly forward exception " +
|
||||||
|
@ -23,7 +23,7 @@ function foo() {
|
|||||||
ok(true, "Able to call the function");
|
ok(true, "Able to call the function");
|
||||||
}
|
}
|
||||||
|
|
||||||
var iter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, foo, false);
|
var iter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, foo);
|
||||||
var doublewrapped = iter.filter;
|
var doublewrapped = iter.filter;
|
||||||
|
|
||||||
ok(doublewrapped.toString().indexOf("wrapped") > 0, "got a double-wrapped object back");
|
ok(doublewrapped.toString().indexOf("wrapped") > 0, "got a double-wrapped object back");
|
||||||
|
@ -2710,7 +2710,7 @@ function importDialog(aParent, aSrc, aArguments) {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
let currentNode;
|
let currentNode;
|
||||||
let nodeIterator = xhr.responseXML.createNodeIterator(xhr.responseXML, NodeFilter.SHOW_TEXT, null, false);
|
let nodeIterator = xhr.responseXML.createNodeIterator(xhr.responseXML, NodeFilter.SHOW_TEXT, null);
|
||||||
while (currentNode = nodeIterator.nextNode()) {
|
while (currentNode = nodeIterator.nextNode()) {
|
||||||
let trimmed = currentNode.nodeValue.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
|
let trimmed = currentNode.nodeValue.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
|
||||||
if (!trimmed.length)
|
if (!trimmed.length)
|
||||||
|
Loading…
Reference in New Issue
Block a user