Repository navigation
Add dom-selector CSS engine once again - #3854
Conversation
|
Benchmark results:
|
|
The test failures appears to be related to #3154, not this PR. |
|
Ref #3659 jsdom + nwsapi jsdom + dom-selector |
|
Re: https://github.com/jsdom/jsdom/actions/runs/14283858797/job/40036577613#step:4:139 It appears to have been changed to liblzma5_5.6.1+really5.4.5-1ubuntu0.2_amd64.deb Not sure what to do here. |
|
@domenic |
|
I will try to work on this on my next jsdom weekend, although I have a pretty packed schedule for the next couple of weeks so it might be some time. I will not be able to merge until we get CI passing, one way or another. I guess the problem is that |
| @@ -0,0 +1,377 @@ | |||
| <!DOCTYPE html> | |||
There was a problem hiding this comment.
Are these all from-scratch tests that we should work to upstream?? Or are derived from existing tests?
There was a problem hiding this comment.
They are copied from /dom/nodes/
Should we rename them too?
There was a problem hiding this comment.
Why can't we just use the original dom/nodes ones?
There was a problem hiding this comment.
Both files are called within to-upstream/dom/nodes/ParentNode-querySelector-All-dont-upstream.html, to-upstream/dom/nodes/ParentNode-querySelector-All-xht-dont-upstream.xht.
<script src="selectors.js"></script>
<script src="ParentNode-querySelector-All.js"></script>
Is the following what you are suggesting?:
- Change those two paths to absolute paths like
<script src="/dom/nodes/selectors.js"></script> <script src="/dom/nodes/ParentNode-querySelector-All.js"></script> - In
run-single-wpt.js, make modifications in the same way as/resources/testharness.jsso that they are loaded from the./testsfolder
There was a problem hiding this comment.
The file I am commenting on here is ParentNode-querySelector-All-content.html, not selectors.js or ParentNode-querySelector-All.js. I am asking whether ParentNode-querySelector-All-content.html (and ParentNode-querySelector-All-content.xht) are completely new tests, or are derived from existing tests.
Separately, if we can reduce duplication for selectors.js and ParentNode-querySelector-All.js using a technique like what you describe, I think that would be good.
There was a problem hiding this comment.
Ah, they are loaded in iframe.
ParentNode-querySelector-All-dont-upstream.html
L19:
frame.src = "ParentNode-querySelector-All-content.html#target";
ParentNode-querySelector-All-xht-dont-upstream.xht
L21:
frame.src = "ParentNode-querySelector-All-content.xht#target";
I think we can remove them and load from ./tests too.
There was a problem hiding this comment.
Loading xht (xhtml) files from ./tests didn't work well.
It seemed to be a content-type issue, but maybe I'm just doing things wrong.
18e4f10 to
557429d
Compare
All green now. The timeout is likely due to memory swap. This function creates and adds a lot of element nodes, many times. |
domenic
left a comment
There was a problem hiding this comment.
Overall this looks very nice. I really appreciate the attention to test coverage.
I left a few minor comments, and we should separate out the test-splitting work into #3860 which I would appreciate your review on. But I think we should be able to merge this soon.
I guess you are suggesting we do a prerelease test first? I am a bit worried we won't get enough testing coverage because a lot of people use jsdom as a transitive dependency (via Jest or Vitest or something, from what I understand). But maybe we can make it work if we:
- Make a list of all issues where people are discussing either selector functionality or selector performance. Probably, that list = your list of fixed issues in the OP, plus #3667, #3644, and #3659
- For each issue we add a small message asking people to test and giving them instructions on how to use package.json overrides to upgrade to a prerelease version.
| "/dom/nodes/selectors.js" | ||
| ]; | ||
| if (extraResources.includes(url.pathname)) { | ||
| const filePath = path.resolve(__dirname, "tests" + url.pathname + (url.hash ? url.hash : "")); |
There was a problem hiding this comment.
Why not just + url.hash?
Although, I don't think we have any cases where the hash is used, so maybe it's simpler to just omit that whole thing?
There was a problem hiding this comment.
I'll fix url.hash part.
hash is needed in, for example, test/web-platform-tests/to-upstream/dom/nodes/ParentNode-querySelector-All-dont-upstream.html L19
It loads iframe content with hash.
There was a problem hiding this comment.
It's surprising that this makes a difference to the super.fetch() call. The file on disk does not have a hash in its name...
|
What I have in mind is:
I think I can take care of contacting jest-dom, vitest. |
|
I find leaving PRs open, so that releases on npm correspond to nothing clear on GitHub, to be a bit confusing. So I would prefer a slightly modified flow for that part. Let's merge to main and do a release from main, just with a prerelease version number. I am unsure whether it should be a new major version or a new minor version. It is theoretically not a breaking change so a new minor version is more appropriate. But maybe it would be more cautious to do a major version? I like the idea of contacting jest-dom and vitest to have them test. I think asking for feedback from people in #3659 by commenting on that thread would also be good. |
|
TODO:
|
Add reflow step to avoid cache
Ref #3667, #3644
This is another attempt to replace the CSS selector engine.
I believe there will be few performance issues this time.
However, do not merge until we can confirm there is no issue in a real project.
Until then, I would like you to publish a development release.
Issues fixed by this PR:
fix #2159, fix #3321, fix #3370, fix #3432, fix #3466,
fix #3469, fix #3544, fix #3603, fix #3610, fix #3612,
fix #3618, fix #3620, fix #3686, fix #3692, fix #3750,
fix #3780, fix #3792, fix #3802, fix #3818