Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[945] Update boolean attributes to be empty value for consistency#983

Closed
timurista wants to merge 7 commits into
preactjs:masterfrom
timurista:bug/boolean-attributes-inconsistent-945
Closed

[945] Update boolean attributes to be empty value for consistency#983
timurista wants to merge 7 commits into
preactjs:masterfrom
timurista:bug/boolean-attributes-inconsistent-945

Conversation

@timurista

@timurista timurista commented Jan 21, 2018

Copy link
Copy Markdown
Contributor

Change boolean attributes to have empty value

In response to #945
I added an explicit check in case the value === "true" which simply sets attribute to "" which is inline with web standard in moz docs: https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute

Boolean attributes are considered to be true if they're present on the element at all, regardless of their actual value; as a rule, you should specify the empty string ("") in value (some people use the attribute's name; this works but is non-standard). See the example below for a practical demonstration.

I also updated the test to make sure it renders empt value instead of ="true"

@timurista timurista changed the title Bug/boolean attributes inconsistent 945 [945] Update boolean attributes to be empty value for consistency Jan 21, 2018
@coveralls

coveralls commented Jan 21, 2018

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 3dda298 on timurista:bug/boolean-attributes-inconsistent-945 into c7eeb2f on developit:master.

@developit developit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! Need to figure out if there's a way to compress this :)

@timurista

Copy link
Copy Markdown
Contributor Author

@developit did you want me to still merge this? Which part still needs to be compressed? Are we talking the elseif statement or something else?

@developit

Copy link
Copy Markdown
Member

Not sure yet - let's leave it open for a bit, we won't be cutting a release until next week.

@timurista

Copy link
Copy Markdown
Contributor Author

sure, np 👍 sounds good to me

@timurista timurista force-pushed the bug/boolean-attributes-inconsistent-945 branch from 63ea8a2 to a16e084 Compare January 27, 2018 14:50
@timurista

Copy link
Copy Markdown
Contributor Author

@developit any news on the perf-review?

@developit

Copy link
Copy Markdown
Member

I'm concerned that this may cause issues with some DOM Boolean Attributes, but haven't been able to determine if that's likely or not.

@timurista

Copy link
Copy Markdown
Contributor Author

@developit you want me to close this then?

@developit

Copy link
Copy Markdown
Member

no - I want to write some tests around it and was hoping to have time to research the effects. I actually think we should merge this, I just need to be sure of the implications.

@timurista

Copy link
Copy Markdown
Contributor Author

@developit this is very out of date, you want me to close it?

@timurista timurista closed this Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants