Skip to content

Support classes set using the class attribute#247

Merged
Janiczek merged 3 commits intoelm-explorations:masterfrom
lydell:class-attribute
Jan 30, 2026
Merged

Support classes set using the class attribute#247
Janiczek merged 3 commits intoelm-explorations:masterfrom
lydell:class-attribute

Conversation

@lydell
Copy link
Contributor

@lydell lydell commented Jul 12, 2025

Closes #246

Copy link
Collaborator

@Janiczek Janiczek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started looking at this. I had a go at trying to trickle down Result String from this classnames function but it got too much too quickly.

I'm contemplating making a validation pass of the parsed HTML during decoding of the HTML before running other queries (failing early if we find this mixing of class and className). If that doesn't seem simple enough, I'll likely merge this as-is.

I'm also contemplating having a bit of mutable state (via kernel JS) holding a flag "classnames found this collision" that we could show a warning about later, but that feels quite icky...

@Janiczek Janiczek merged commit 7c8e682 into elm-explorations:master Jan 30, 2026
0 of 9 checks passed
@Janiczek
Copy link
Collaborator

Thanks for your work on this @lydell, this is now live in 2.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selector.class only matches className property, not class attribute

2 participants