Skip to content
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

Update the existing boolean attributes pattern #123

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shoumaw
Copy link

@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

@@ -10,7 +10,7 @@
- `options.props` - Array of camelCasedProps to watch as String values or { [camelCasedProps]: "string" | "number" | "boolean" | "function" | "json" }

- 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
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
Contributor

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
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.

None yet

2 participants