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
fix(dom): Implement getElementsByClassName
as specified
#213
Conversation
50ea8ff
to
4800332
Compare
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.
Thank you for discovering this and for your contribution.
I added some suggestions and recommendations.
If you don't have the capacity or knowledge, to do what I'm asking for, feel free to ask any questions for support, or let us know if/when it's beyond your capacity.
This PR will also have an impact on #100 since that one tries to add the ability to also call |
@ChALkeR please let us know if you plan to continue to work on this on your own, thx |
0178a7f
to
f6126f8
Compare
d743533
to
9d4280c
Compare
getElementsByClassName
as specified
I resolved all the remarks that I added earlier. Thanks again for your contribution. I needed to force push the rebased branch, other wise github was showing changes to some 30 files and conflicts. I took the liberty to rename the PR and do a minor tweak to the PR description. |
Reimplements
Document.getElementsByClassName
without using a dynamically generated regex.[
seems to be a valid classname, which was broken in this impl as it was fed into a regexp unescaped and causedxmldom
to throw.\s
in JS regexps includes more chars than space-separated tokens of html.getElementsByClassName()
method,e.g.
new RegExp("(^|\\s)" + '(((a||||)+)+)+' + "(\\s|$)").test('aaaaab')
.Refs:
Note: I couldn't find the tests for this and am unsure how to test this. cc @codler perhaps — could you confirm this would work?
Seems to work for me with simple playground tests.