Skip to content

Commit

Permalink
attributeBindings is frozen, slice it before push
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 committed Jan 24, 2017
1 parent 168c506 commit 001b11e
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 001b11e

Please sign in to comment.