Skip to content

Commit

Permalink
attributeBindings is frozen, slice it before push (#59)
Browse files Browse the repository at this point in the history
As noted in the Ember v2.11 release notes, concatenated properties such
as attributeBindings are frozen in debug builds. This means we cannot
push directly onto the attributeBindings array without first copying it
via slice.

Without this change, users may see errors like this when the
`attributeBindings.push()` call is made:

Uncaught TypeError: Can't add property 2, object is not extensible

References:

emberjs/ember.js#14389
emberjs/ember.js#14601
  • Loading branch information
bgentry authored and Turbo87 committed Jan 25, 2017
1 parent 182d7f0 commit 1c03080
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addon/utils/bind-data-test-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export default function bindDataTestAttributes(component) {
let attributeBindings = component.getWithDefault('attributeBindings', []);
if (!Ember.isArray(attributeBindings)) {
attributeBindings = [attributeBindings];
} else {
attributeBindings = attributeBindings.slice();
}

dataTestProperties.forEach(it => attributeBindings.push(it));
Expand Down

0 comments on commit 1c03080

Please sign in to comment.