-
Notifications
You must be signed in to change notification settings - Fork 393
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
Normalize whitespace for attributes (breaking change) #4124
Labels
Comments
can i work on this ? |
@HermanBide I would recommend against taking this one, since it is a breaking change and so we will have to be careful about it. |
This issue has been linked to a new work item: W-16419702 |
nolanlawson
changed the title
Normalize whitespace for
Normalize whitespace for attributes (breaking change)
Aug 5, 2024
style
and class
attributes (breaking change)
Per #3548 this is also true for arbitrary attributes. |
This was referenced Sep 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For HTML templates containing static
style
/class
attributes such as this:... we are inconsistent about how this is actually serialized to the DOM. For static-optimized nodes, the attributes are kept as-is. For non-static-optimized nodes, the whitespace/semicolons are normalized:
This also applies to the case of blank vs missing attributes. For example:
In the static-optimized case, these attributes are kept as-is. For the non-static-optimized case, the attributes are removed entirely:
This doesn't really matter unless the developer is doing something zany (e.g.
querySelector('[class="foo bar baz"]')
rather thanquerySelector('.foo.bar.baz')
), but we should at least be consistent about it.We have also warned developers about this in the past, but not every developer follows these guidelines.
This would be a potentially breaking change.
The text was updated successfully, but these errors were encountered: