From 232b61044c61f248d347171f5a80d6cfca816c8c Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Mon, 9 Sep 2013 15:59:42 -0700 Subject: [PATCH] Warn for 'class' and 'for' property names Also stroke-linecap, stroke-width, stop-color, stop-opacity. Test Plan: grunt test --- src/dom/DOMProperty.js | 8 ++++++-- src/dom/__tests__/DOMPropertyOperations-test.js | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/dom/DOMProperty.js b/src/dom/DOMProperty.js index fa031bb87a..67d0596afe 100644 --- a/src/dom/DOMProperty.js +++ b/src/dom/DOMProperty.js @@ -85,8 +85,12 @@ var DOMPropertyInjection = { var lowerCased = propName.toLowerCase(); DOMProperty.getPossibleStandardName[lowerCased] = propName; - DOMProperty.getAttributeName[propName] = - DOMAttributeNames[propName] || lowerCased; + var attributeName = DOMAttributeNames[propName]; + if (attributeName) { + DOMProperty.getPossibleStandardName[attributeName] = propName; + } + + DOMProperty.getAttributeName[propName] = attributeName || lowerCased; DOMProperty.getPropertyName[propName] = DOMPropertyNames[propName] || propName; diff --git a/src/dom/__tests__/DOMPropertyOperations-test.js b/src/dom/__tests__/DOMPropertyOperations-test.js index 6382a69c5b..5f558d1300 100644 --- a/src/dom/__tests__/DOMPropertyOperations-test.js +++ b/src/dom/__tests__/DOMPropertyOperations-test.js @@ -68,6 +68,16 @@ describe('DOMPropertyOperations', function() { expect(console.warn.argsForCall[0][0]).toContain('tabIndex'); }); + it('should warn about class', function() { + spyOn(console, 'warn'); + expect(DOMPropertyOperations.createMarkupForProperty( + 'class', + 'muffins' + )).toBe(null); + expect(console.warn.argsForCall.length).toBe(1); + expect(console.warn.argsForCall[0][0]).toContain('className'); + }); + it('should create markup for boolean properties', function() { expect(DOMPropertyOperations.createMarkupForProperty( 'checked',