-
Notifications
You must be signed in to change notification settings - Fork 192
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
[BUGFIX beta] Fix range element reporting wrong initial value #425
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If a template had an `input` `range` whose type was set before a max or a min attribute was added, the initial value would be wrong. In plain HTML, the initial value for `<input max="10" type="range" />` would be `5` (`(min + max) / 2 = (0 + 10) / 2 = 5`). In Glimmer, this would be 10 because the code would be equivalent to: ```js let input = document.createElement('input'); input.type = "range"; input.max = "10"; ``` Setting `type` to `range` would make the value sanitization algorihtm to kick in, setting the value to 50. When setting the `max` to `10`, the algorithm would sanitize the value (50 by now) to the maximum (10). More info in whatwg/html#2427 Fixes emberjs/ember.js#14958
Waiting for master to be stable to rebase. |
We can't fix it at this layer because the attribute could come from a few e.g. |
Thank you for the hint. I'll do it tomorrow (kinda late here). |
Serabe
added a commit
to Serabe/glimmer-vm
that referenced
this pull request
Oct 27, 2017
If a template had an `input` `range` whose type was set before a max or a min attribute was added, the initial value would be wrong. In plain HTML, the initial value for `<input max="10" type="range" />` would be `5` (`(min + max) / 2 = (0 + 10) / 2 = 5`). In Glimmer, this would be 10 because the code would be equivalent to: ```js let input = document.createElement('input'); input.type = "range"; input.max = "10"; ``` Setting `type` to `range` would make the value sanitization algorihtm to kick in, setting the value to 50. When setting the `max` to `10`, the algorithm would sanitize the value (50 by now) to the maximum (10). This was originally discussed in glimmerjs#425, but an alternative solution was asked for. While this PR keeps part of the original implementation (could not find a simple way to fix the issue when a template is being rendered), this PR goes further and fixes it for Emberish components and `...attributes` in Glimmer components. More info in whatwg/html#2427 Fixes emberjs/ember.js#14958
Closed in favor of #726 |
Serabe
added a commit
to Serabe/glimmer-vm
that referenced
this pull request
Nov 17, 2017
If a template had an `input` `range` whose type was set before a max or a min attribute was added, the initial value would be wrong. In plain HTML, the initial value for `<input max="10" type="range" />` would be `5` (`(min + max) / 2 = (0 + 10) / 2 = 5`). In Glimmer, this would be 10 because the code would be equivalent to: ```js let input = document.createElement('input'); input.type = "range"; input.max = "10"; ``` Setting `type` to `range` would make the value sanitization algorihtm to kick in, setting the value to 50. When setting the `max` to `10`, the algorithm would sanitize the value (50 by now) to the maximum (10). This was originally discussed in glimmerjs#425, but an alternative solution was asked for. While this PR keeps part of the original implementation (could not find a simple way to fix the issue when a template is being rendered), this PR goes further and fixes it for Emberish components and `...attributes` in Glimmer components. More info in whatwg/html#2427 Fixes emberjs/ember.js#14958
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a template had an
input
range
whose type was set before a max or a minattribute was added, the initial value would be wrong.
In plain HTML, the initial value for
<input max="10" type="range" />
would be5
((min + max) / 2 = (0 + 10) / 2 = 5
).In Glimmer, this would be 10 because the code would be equivalent to:
Setting
type
torange
would make the value sanitization algorihtm to kickin, setting the value to 50. When setting the
max
to10
, the algorithmwould sanitize the value (50 by now) to the maximum (10).
More info in whatwg/html#2427
Fixes emberjs/ember.js#14958