Add getElementsByClassName to the DOM polyfill - #625
Open
airhorns wants to merge 1 commit into
Open
Conversation
airhorns
force-pushed
the
polyfill-get-elements-by-class-name
branch
2 times, most recently
from
July 28, 2026 14:19
4ebbda6 to
9b7d4e5
Compare
Assisted-By: devx/ca2f43ab-bbf9-4273-b1bc-0b06f8c90a57
airhorns
force-pushed
the
polyfill-get-elements-by-class-name
branch
from
July 28, 2026 14:20
9b7d4e5 to
c281215
Compare
JoviDeCroock
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Remote code is commonly type-checked against
lib.dom, butdocument.getElementsByClassName()andelement.getElementsByClassName()are missing at runtime from@remote-dom/polyfill. This adds both standard hosts (deliberately notDocumentFragment) and returns matches in tree order.The lookup tokenizes ASCII whitespace, requires every requested class, removes duplicate search tokens, and compares class names literally. It does not build a CSS selector, so class names containing selector punctuation such as
.and:work correctly.The returned value follows the polyfill's existing concrete
NodeListcollection model. LiveHTMLCollectionbehavior remains a separate compatibility concern, as it does in #620.Validation
pnpm exec vitest run(179 tests)pnpm lintpnpm type-checkmise exec node@20.20.0 -- pnpm --filter @remote-dom/polyfill build