Skip to content

Commit e690eff

Browse files
authored
Merge pull request #105 from vincentfretin/dontcopyundefined
Only assign defined values from attrValue
2 parents 5b06e88 + 874be2f commit e690eff

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,14 @@ AFRAME.registerComponent('environment', {
258258
this.environmentData = {};
259259
Object.assign(this.environmentData, this.data);
260260
Object.assign(this.environmentData, this.presets[this.data.preset]);
261-
Object.assign(this.environmentData, this.el.components.environment.attrValue);
261+
// Only assign defined values from attrValue, as removeAttribute sets
262+
// properties to undefined rather than deleting them.
263+
var attrValue = this.attrValue;
264+
for (var key in attrValue) {
265+
if (attrValue[key] !== undefined) {
266+
this.environmentData[key] = attrValue[key];
267+
}
268+
}
262269
console.log(this.environmentData);
263270
}
264271

0 commit comments

Comments
 (0)