We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Can we add Document.getElementsByClassName?
Currently Im doing this workaround to polyfill getElementsByClassName
const patchDoc = doc => { doc.getElementsByClassName = search => { const results = []; const elements = doc.getElementsByTagName('*'); const pattern = new RegExp(`(^|\\s)${search}(\\s|$)`); for (let i = 0; i < elements.length; i++) { if (pattern.test(elements[i].getAttribute('class'))) { results.push(elements[i]); } } return results; }; return doc; } const doc = patchDoc(new DOMParser().parseFromString(html));
The text was updated successfully, but these errors were encountered:
I'm for it. PR would be welcome.
Sorry, something went wrong.
ef4356b
Merge pull request #25 from codler/patch-2
7c54a0b
Fix #24 Implement Document.getElementsByClassName
getElementsByClassName
No branches or pull requests
Can we add Document.getElementsByClassName?
Currently Im doing this workaround to polyfill getElementsByClassName
The text was updated successfully, but these errors were encountered: