Repository navigation
Conversation
Element already had set/get/removeAttribute(NS); the has* pair was the missing piece. Follows the existing pattern: hasAttribute() delegates to hasAttributeNS(null, ...), which checks the attributes list with the same case-insensitive filter used by get/set. Uses an existence check (rather than getAttributeNS) so attributes with an empty-string value still report true.
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.
Element already had
set/get/removeAttribute(NS); thehas*pair was the missing piece.hasAttribute(key)delegates tohasAttributeNS(null, key), matching the existing non-NS/NS pattern.hasAttributeNS(ns, name)checks the attributes list with the same case-insensitivecreateAttributeFilterused by get/set.getAttributeNS), so an attribute with an empty-string value still reportstrue.Verified locally (before the fix both methods were
undefined):false; aftersetAttribute→true; afterremoveAttribute→falsehasAttributetrue; name matching is case-insensitive like get/setTests: added
#hasAttribute()(3 tests) and#hasAttributeNS()(1 test) totest/undom.js; full suite 28 passing (24 existing + 4 new), eslint 0 errors. Note: the repo's ownnpm testuses the oldesmloader, which no longer works on Node 24, so the suite was run via@babel/registerinstead; no test or source changes were needed for that.