Skip to content

Commit

Permalink
[BUGFIX beta] Avoid allocating a binding map in meta when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
mmun committed Feb 9, 2016
1 parent 632a254 commit 6c8b6bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function inheritedMap(name, Meta) {
};

Meta.prototype['clear' + capitalized] = function() {
this[key] = new EmptyObject();
this[key] = undefined;
};

Meta.prototype['deleteFrom' + capitalized] = function(subkey) {
Expand Down
11 changes: 9 additions & 2 deletions packages/ember-runtime/tests/system/object/create_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Ember from 'ember-metal/core';
import isEnabled from 'ember-metal/features';
import {computed} from 'ember-metal/computed';
import {Mixin, observer} from 'ember-metal/mixin';
import { meta } from 'ember-metal/meta';
import { computed } from 'ember-metal/computed';
import { Mixin, observer } from 'ember-metal/mixin';
import EmberObject from 'ember-runtime/system/object';

var moduleOptions, originalLookup;
Expand Down Expand Up @@ -144,3 +145,9 @@ QUnit.test('EmberObject.create can take null as a parameter', function() {
var o = EmberObject.create(null);
deepEqual(EmberObject.create(), o);
});

QUnit.test('EmberObject.create avoids allocating a binding map when not necessary', function() {
let o = EmberObject.create();
let m = meta(o);
ok(!m.peekBindings(), 'A binding map is not allocated');
});

0 comments on commit 6c8b6bc

Please sign in to comment.