Skip to content

Update the existing boolean attributes pattern#123

Open
shoumaw wants to merge 3 commits intomainfrom
feature/update-boolean-attributes-pattern
Open

Update the existing boolean attributes pattern#123
shoumaw wants to merge 3 commits intomainfrom
feature/update-boolean-attributes-pattern

Conversation

@shoumaw
Copy link
Copy Markdown

@shoumaw shoumaw commented Jun 13, 2023

The existing regex pattern for boolean attributes is far from the DOM specs.

So this PR modifies this pattern to be as follows:
Checked:

  • <my-component checked />
  • <my-component checked="" />
  • <my-component checked="checked" />
  • <my-component checked="true" />

Unchecked:

  • <my-component />
  • <my-component checked="false" />

Otherwise, use existing behavior and log a warning to the user that this behavior is deprecated

Comment thread docs/api.md

- When specifying Array or Object as the type, the string passed into the attribute must pass `JSON.parse()` requirements.
- When specifying Boolean as the type, "true", "1", "yes", "TRUE", and "t" are mapped to `true`. All strings NOT begining with t, T, 1, y, or Y will be `false`.
- When specifying Boolean as the type, "true", "1", "yes", "TRUE", and "t" are mapped to `true`. All strings NOT beginning with t, T, 1, y, or Y will be `false`.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@christopherjbaker any suggestions on the format of mentioning the deprecated behavior and the new behavior

@christopherjbaker
Copy link
Copy Markdown

We need to ensure this won't be a breaking change, and clearly document the new behaviours.

jrencz added a commit to jrencz/react-to-web-component that referenced this pull request Jan 12, 2024
Borrows some ideas from bitovi#123

Fixes bitovi#162
@christopherjbaker christopherjbaker self-assigned this Jul 12, 2024
@christopherjbaker christopherjbaker added the started Work on this bug has started label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

started Work on this bug has started

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants