Closed
Description
Here's a basic example that should work in a browser:
<html>
<head>
<script src="./nwsapi-2.2.7.js"></script>
<script type="module">
const parent = document.querySelector("div");
console.log("NWSAPI", [...NW.Dom.select(":scope > div", parent)].map(d => d.className));
console.log("NATIVE", [...parent.querySelectorAll(":scope > div")].map(d => d.className));
</script>
</head>
<body>
<div>
<div class=outer>
<div class=inner></div>
</div>
<div class=other-outer></div>
</div>
</body>
</html>
The output that I get:
NWSAPI Array [ "outer", "inner", "other-outer" ]
NATIVE Array [ "outer", "other-outer" ]
NWSAPI incorrectly selects the div with the inner
classname while the browser correctly excludes that div, since it's not a direct child of the parent/context div.
The bug is due to makeref
relying on classnames and/or ID's to distinguish the parent/context element from the children
Metadata
Metadata
Assignees
Labels
No labels