Skip to content

Commit

Permalink
Merge pull request #10205 from rwjblue/normalize-property-names
Browse files Browse the repository at this point in the history
[BUGFIX beta] Ensure that property name case is normalized.
  • Loading branch information
mixonic committed Jan 14, 2015
2 parents b30e309 + 2fac275 commit 5975723
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/ember-views/lib/system/render_buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import jQuery from "ember-views/system/jquery";
import Ember from "ember-metal/core";
import { create } from "ember-metal/platform";
import environment from "ember-metal/environment";
import { normalizeProperty } from "morph/dom-helper/prop";

// The HTML spec allows for "omitted start tags". These tags are optional
// when their intended child is the first thing in the parent tag. For
Expand Down Expand Up @@ -491,7 +492,9 @@ RenderBuffer.prototype = {

if (props) {
for (prop in props) {
this.dom.setPropertyStrict(element, prop, props[prop]);
var normalizedCase = normalizeProperty(element, prop) || prop;

this.dom.setPropertyStrict(element, normalizedCase, props[prop]);
}

this.elementProperties = null;
Expand Down
15 changes: 15 additions & 0 deletions packages/ember-views/tests/views/view/attribute_bindings_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ test("should render attribute bindings", function() {
ok(!view.$().attr('notNumber'), "removes notNumber attribute when NaN");
});

test("should normalize case for attribute bindings", function() {
view = EmberView.create({
tagName: 'form',
attributeBindings: ['novalidate'],

novalidate: true // intentionally lowercase
});

run(function() {
view.createElement();
});

ok(view.$().prop('noValidate'), "sets property with correct case");
});

test("should update attribute bindings", function() {
view = EmberView.create({
classNameBindings: ['priority', 'isUrgent', 'isClassified:classified', 'canIgnore'],
Expand Down

0 comments on commit 5975723

Please sign in to comment.