Skip to content
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

Warn for 'class' and 'for' property names #330

Merged
merged 1 commit into from
Sep 10, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/dom/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/dom/__tests__/DOMPropertyOperations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down