-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Find html elements by class #1933
Conversation
I've rebased this; I think some things need to be rethought. The current map is needed for tests - of tag names to element constructors - but a similar map is needed in Before making changed, please reset your local branch to match the rebased commit I've pushed up. |
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.
Let's also add a test that the two maps are in fact inverses of each other.
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.
I ended up publishing https://npmjs.com/html-element-map and updated this PR to use it; I'll merge after tests pass.
(linking to aweary/rst-selector-parser#15 as well) |
* @param {RSTNode} root | ||
*/ | ||
export function reduceTreeBySelector(selector, root) { | ||
if (typeof selector !== 'string') { | ||
const elements = elementsByConstructor(selector); |
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 pops "Update your Java installation" in IE11 😢
ljharb/html-element-map#3
Fixes #1929.
@ljharb This is the the test case that I wrote. Could you check and see if it's the right idea before I continue writing it for all the other elements?