mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[querySelectorAll] Fixes for empty result
This commit is contained in:
parent
8ebba7478b
commit
d6ff5fc0c2
@ -2101,13 +2101,6 @@ document_querySelectorAll(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
try {
|
try {
|
||||||
*elements = root->find(xpath);
|
*elements = root->find(xpath);
|
||||||
} catch (xmlpp::exception) {
|
} catch (xmlpp::exception) {
|
||||||
args.rval().setNull();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elements->size() == 0) {
|
|
||||||
args.rval().setNull();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject *elem = getCollection(ctx, elements);
|
JSObject *elem = getCollection(ctx, elements);
|
||||||
|
@ -3007,13 +3007,6 @@ element_querySelectorAll(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
try {
|
try {
|
||||||
*elements = el->find(xpath);
|
*elements = el->find(xpath);
|
||||||
} catch (xmlpp::exception) {
|
} catch (xmlpp::exception) {
|
||||||
args.rval().setNull();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elements->size() == 0) {
|
|
||||||
args.rval().setNull();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject *elem = getCollection(ctx, elements);
|
JSObject *elem = getCollection(ctx, elements);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<p>Click the button to add a background color all elements with class="example".</p>
|
<p>Click the button to add a background color all elements with class="example".</p>
|
||||||
|
|
||||||
<button onclick="myFunction()">Try it</button>
|
<button onclick="myFunction()">Try it</button>
|
||||||
|
<button onclick="myFunction2()">Empty list</button>
|
||||||
|
|
||||||
<p><strong>Note:</strong> The querySelectorAll() method is not supported in Internet Explorer 8 and earlier versions.</p>
|
<p><strong>Note:</strong> The querySelectorAll() method is not supported in Internet Explorer 8 and earlier versions.</p>
|
||||||
|
|
||||||
@ -19,6 +20,12 @@ function myFunction() {
|
|||||||
alert(i + ' ' + x[i].outerHTML);
|
alert(i + ' ' + x[i].outerHTML);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function myFunction2() {
|
||||||
|
x = document.querySelectorAll(".example6");
|
||||||
|
alert(x.length);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user