Describe the bug
With the getObject and getAllObject methods in querySelector.js, > symbol is removed in splitting, but never processed back and won't take effect. This causes all related Shadow.findElement(s) behaviors to be malfunctioning. See the following example:
To Reproduce
Steps to reproduce the behavior:
- Consider a following DOM:
<html>
<div id="a">
<div id="b">
<div id="c"></div>
</div>
<div id="d"></div>
</div>
<script src="querySelector.js"></script>
</html>
- run
getAllObject("div#a > div") in the console.
- Actual result is
[<div id="b">, <div id="c">, <div id="d">], but #c is not a direct child of #a
Expected behavior
Expected result should be [<div id="b">, <div id="d">]
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: MacOS 13.6.4
- Browser: Chrome 123 / Safari 17.3.1
Additional context
|
const multiLevelSelectors = splitByCharacterUnlessQuoted(selector, '>'); |
I don't understand why
> is used to process multi-level DOM.
For functional, this is not needed at all, since without splitting, the script still works fine for piercing through multi-level shadow roots.
For performance, if we have to use some symbol to reduce the max size of possible elements cached in the
allElements array,
& would be a much better choice considering only one character is allowed in
splitByCharacterUnlessQuoted.
Describe the bug
With the
getObjectandgetAllObjectmethods inquerySelector.js,>symbol is removed in splitting, but never processed back and won't take effect. This causes all relatedShadow.findElement(s)behaviors to be malfunctioning. See the following example:To Reproduce
Steps to reproduce the behavior:
getAllObject("div#a > div")in the console.[<div id="b">, <div id="c">, <div id="d">], but#cis not a direct child of#aExpected behavior
Expected result should be
[<div id="b">, <div id="d">]Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
shadow-automation-selenium/resources/querySelector.js
Line 245 in 3376e82
I don't understand why
>is used to process multi-level DOM.For functional, this is not needed at all, since without splitting, the script still works fine for piercing through multi-level shadow roots.
For performance, if we have to use some symbol to reduce the max size of possible elements cached in the
allElementsarray,&would be a much better choice considering only one character is allowed insplitByCharacterUnlessQuoted.