Skip to content
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
6 changes: 2 additions & 4 deletions src/core/a-entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,10 @@ var proto = Object.create(ANode.prototype, {
value: function (name) {
var component;
var isDefault;
var isMixedIn;

// Don't remove default or mixed-in components.
isDefault = name in this.defaultComponents;
isMixedIn = isComponentMixedIn(name, this.mixinEls);
if (isDefault || isMixedIn) { return; }
if (isDefault) { return; }

component = this.components[name];
if (!component) { return; }
Expand Down Expand Up @@ -517,7 +515,7 @@ var proto = Object.create(ANode.prototype, {

// Remove component.
if (component && propertyName === undefined) {
this.setEntityAttribute(attr, undefined, null);
this.removeComponent(attr);
// Do not remove the component from the DOM if default component.
if (this.components[attr]) { return; }
}
Expand Down
6 changes: 3 additions & 3 deletions tests/core/a-entity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,17 +981,17 @@ suite('a-entity', function () {
assert.ok('position' in el.components);
});

test('does not remove mixed-in component', function () {
test('can remove mixed-in component', function () {
var el = this.el;
var mixinId = 'geometry';
mixinFactory(mixinId, {geometry: 'primitive: box'});
el.setAttribute('mixin', mixinId);
el.setAttribute('geometry', 'primitive: sphere');
assert.ok('geometry' in el.components);
el.removeAttribute('geometry');
assert.notEqual(el.getAttribute('geometry'), null);
assert.equal(el.getAttribute('geometry'), null);
// Geometry still exists since it is mixed in.
assert.ok('geometry' in el.components);
assert.notOk('geometry' in el.components);
});

test('resets a component property', function () {
Expand Down