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

[BUGFIX beta] Avoid allocating a binding map in meta when possible #12939

Merged
merged 1 commit into from
Feb 9, 2016
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});