Merge pull request #1225 from spicyj/cprop

Fix removing DOM property with mapped name
This commit is contained in:
Paul O’Shannessy
2014-03-10 11:29:10 -07:00
2 changed files with 28 additions and 1 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ var DOMPropertyOperations = {
var propName = DOMProperty.getPropertyName[name];
var defaultValue = DOMProperty.getDefaultValueForProperty(
node.nodeName,
name
propName
);
if (!DOMProperty.hasSideEffects[name] ||
node[propName] !== defaultValue) {
@@ -192,6 +192,33 @@ describe('DOMPropertyOperations', function() {
expect(stubNode.className).toBe('');
});
it('should remove property properly even with different name', function() {
// Suppose 'foobar' is a property that corresponds to the underlying
// 'className' property:
DOMProperty.injection.injectDOMPropertyConfig({
Properties: {foobar: DOMProperty.injection.MUST_USE_PROPERTY},
DOMPropertyNames: {
foobar: 'className'
}
});
DOMPropertyOperations.setValueForProperty(
stubNode,
'foobar',
'selected'
);
expect(stubNode.className).toBe('selected');
DOMPropertyOperations.setValueForProperty(
stubNode,
'foobar',
null
);
// className should be '', not 'null' or null (which becomes 'null' in
// some browsers)
expect(stubNode.className).toBe('');
});
});
describe('injectDOMPropertyConfig', function() {