-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Range and Selection APIs #2719
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, good stuff. Only one concern with the Range constructor.
I admit not reviewing several of the very-long files in great detail, but scrolling through them they all seem very nicely structured, with lots of spec references, just in the awesome manner I've come to appreciate from your work. So I'm happy to merge this soon.
lib/jsdom/browser/Window.js
Outdated
@@ -401,6 +414,27 @@ function Window(options) { | |||
writable: true | |||
}); | |||
|
|||
// https://dom.spec.whatwg.org/#dom-range-range | |||
function Range() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why implement this in this manner instead of using webidl2js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed anymore, it was used to associate the Range
with the Document
. This is not needed anymore with the webidl2js constructor reform. The Document
can now be extracted out of the newly introduced globalObject
.
2993143
to
2d4e35c
Compare
I re-ran the CI three times and it gives segfaults on the latest Node stable once we start hitting the dom/ranges tests. https://travis-ci.org/jsdom/jsdom/jobs/618664359 . So probably we shouldn't merge until we either find a workaround or Node.js fixes their upstream bug. I haven't tried reproducing locally yet; I hope it isn't hard to do so :(. |
I was able to reproduce the issue locally against node |
The segfault was fixed with node |
I really appreciate this work. I'm refactoring a highlighting feature, so this will be extremely valuable to me. |
Thank you for this! Should it have also implemented If range itself is fully supported, I believe this will open the door to automated color contrast accessibility testing via |
There's probably no way for us to implement |
@TimothyGu Thank you for the information! |
Changes
This PR implements the
Range
and theSelection
APIs. Sorry for this large PR, however the Range WPT tests are highly coupled with the Selection WPT tests and because of this wanted to make those 2 land at the same time.Fix #317, fix #937