-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
set value property explicitly for "option" element even if value is empty #6228
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
We definitely need unit test here to avoid future regressions |
#6219 (comment) for more information on this bug. I'm not sure how the team feels about it, but an acceptable short-term workaround if we want to get it out quickly could be (haven't tested it): } else if (propertyInfo.mustUseProperty) {
var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
if (!propertyInfo.hasSideEffects ||
('' + node[propName]) !== ('' + value) ||
!node.hasAttribute(propertyInfo.attributeName)) { // <-------- BUG FIX -------------
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
} Basically, we forcibly set the property whenever |
@syranide |
@everdimension Answering in original issue instead. |
…tDOMComponent test
@everdimension updated the pull request. |
Updated PR to always set |
@@ -174,8 +174,10 @@ var DOMPropertyOperations = { | |||
var propName = propertyInfo.propertyName; | |||
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the | |||
// property type before comparing; only `value` does and is string. | |||
// Must set `value` property if it is not null and not yet set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You call out value
as being special here but this will apply to other things too (eg selected
which is also MUST_USE_PROPERTY
). Is that your intention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not saying it shouldn't be changed, but it only applies to HAS_SIDE_EFFECTS
which is only used by value
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zpao It's a question of being either clear or general. In any case, I'm not aware of other attributes which may need to be handled similarly. And currently it is the only one. The previous comment line mentions this, so I believe writing value
makes it more clear for others reading this code.
Going to take this for 15 to fix the regression. There has been some discussion about doing something more involved with properties and attributes but this is the safest fix for the time being. Thank for doing this! |
Fixes #6219
option
element has empty string asvalue
, it should be usedoption
has novalue
attribute, the contents of theoption
tag should be used