Skip to content

Commit

Permalink
HAS_SIDE_EFFECTS properties must compare as property type
Browse files Browse the repository at this point in the history
  • Loading branch information
syranide committed Jul 24, 2014
1 parent 32b84a4 commit 3b94abc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/browser/ui/dom/DOMPropertyOperations.js
Expand Up @@ -130,10 +130,17 @@ var DOMPropertyOperations = {
} else if (shouldIgnoreValue(name, value)) {
this.deleteValueForProperty(node, name);
} else if (DOMProperty.mustUseAttribute[name]) {
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
} else {
var propName = DOMProperty.getPropertyName[name];
if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) {
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
if (!DOMProperty.hasSideEffects[name] ||
('' + node[propName]) !== ('' + value)) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
Expand Down Expand Up @@ -168,7 +175,7 @@ var DOMPropertyOperations = {
propName
);
if (!DOMProperty.hasSideEffects[name] ||
node[propName] !== defaultValue) {
('' + node[propName]) !== defaultValue) {
node[propName] = defaultValue;
}
}
Expand Down

0 comments on commit 3b94abc

Please sign in to comment.