Skip to content

Commit 3b94abc

Browse files
committed
HAS_SIDE_EFFECTS properties must compare as property type
1 parent 32b84a4 commit 3b94abc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/browser/ui/dom/DOMPropertyOperations.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,17 @@ var DOMPropertyOperations = {
130130
} else if (shouldIgnoreValue(name, value)) {
131131
this.deleteValueForProperty(node, name);
132132
} else if (DOMProperty.mustUseAttribute[name]) {
133+
// `setAttribute` with objects becomes only `[object]` in IE8/9,
134+
// ('' + value) makes it output the correct toString()-value.
133135
node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
134136
} else {
135137
var propName = DOMProperty.getPropertyName[name];
136-
if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) {
138+
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
139+
// property type before comparing; only `value` does and is string.
140+
if (!DOMProperty.hasSideEffects[name] ||
141+
('' + node[propName]) !== ('' + value)) {
142+
// Contrary to `setAttribute`, object properties are properly
143+
// `toString`ed by IE8/9.
137144
node[propName] = value;
138145
}
139146
}
@@ -168,7 +175,7 @@ var DOMPropertyOperations = {
168175
propName
169176
);
170177
if (!DOMProperty.hasSideEffects[name] ||
171-
node[propName] !== defaultValue) {
178+
('' + node[propName]) !== defaultValue) {
172179
node[propName] = defaultValue;
173180
}
174181
}

0 commit comments

Comments
 (0)