asamuzak / domselector Goto Github PK
View Code? Open in Web Editor NEWA CSS selector engine.
License: MIT License
A CSS selector engine.
License: MIT License
wpt tests are:
Add support for it or add it in unsupported pseudo-class list.
Probably the implementation is wrong.
Just check with node.lookupNamespaceURI(prefix)
?
I have a small idea for performance work, which may be good or may be bad. I wanted to share it with you in case it was helpful.
Basically, if you take a benchmark where nwmatcher is fast, have you looked at how it does its work? And how that work compares to dom-selector? Can dom-selector switch to nwmatcher's strategy? Doing so might require ugly special cases or fast paths, but maybe it is worth it.
Feel free to close this if it is not helpful.
I use Vue 2 + Vitest + JsDom for running component tests.
Since JsDom changed to you package my tests are failing.
I'm currently unable to create a minimal repo to demonstrate this issue.
However I tried to debug it and it comes down to this code section.
let parent = node;
while (parent) {
if (parent.parentNode) {
parent = parent.parentNode;
} else {
break;
}
}
document = parent.ownerDocument;
root = parent;
After the closest
method is called on an HTML Element this section is executed. By the end document
is null
and therefore throws an error here:
const walker = document.createTreeWalker(root, filter);
I looked into the state of the while loop before the error was thrown:
The loop break if parent is Document, however on Document there is no ownerDocument
(https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument), resulting in document
beeing null
and thus causing the issue when running document.createTreeWalker
@asamuzaK Do you have any tests implemented to tests this part of your if-else-statement for the case ELEMENT_NODE
?
If so, where do I find it, so I can try to demonstrate the issue. If not, could you please make sure the while loop is working as intended. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.