-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Single property components have to return the default value when the … #1631
Conversation
Going to assume work-in-progress based on discussion yesterday. |
The code is simpler now and works as expected but It introduces a wrinkle in the consistency of the system that I don't know how to do differently. Look at the following entity with a single property component called <a-entity position="" rotation="" scale="" visible="" dummy=""></a-entity> position, rotation, scale and visible are default components so they're not really defined on the entity (a mixin would take precedence) On the contrary dummy is not a default component and hence really defined on the entity. When calling |
22a6a52
to
4f7b5fd
Compare
After discussion with @ngokevin this is how the API behaves with the latest changes. Given a single property component <a-entity dummy></a-entity> These are the values returned for the components el.getAttribute('dummy') === true;
el.getAttribute('position') === null;
el.getComputedAttribute('position') === { x: 0, y: 0, z: 0 }; The only inconsistency left it's when opening the DOM inspector the entity above will appear as: <a-entity position="" rotation="" scale="" scale="" visible="" dummy></a-entity> When calling |
4244c79
to
aac6a75
Compare
return; | ||
} | ||
this.attrValue = value !== undefined ? extendProperties({}, value, isSinglePropSchema) : this.attrValue; | ||
var attrValue = this.attrValue = this.parseAttrValueForCache(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to assign to this.attrValue
here since it gets replaced.
r+ |
…DOM attribute is empty string
No description provided.