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

Accept el.setAttribute('mixin', '') #2291

Merged
merged 1 commit into from
Jan 17, 2017
Merged

Accept el.setAttribute('mixin', '') #2291

merged 1 commit into from
Jan 17, 2017

Conversation

takahirox
Copy link
Collaborator

Description:

This PR enables el.setAttribute('mixin', '') (#2280).
It clears all mixins of el.

This PR doesn't touch removeAttribute('mixin') because
another guy is working on here #2282

@ngokevin
Copy link
Member

Thanks!

@ngokevin ngokevin merged commit fb5e95c into aframevr:master Jan 17, 2017
var el = this.el;
mixinFactory('material', {material: 'shader: flat'});
mixinFactory('position', {position: '1 2 3'});
el.setAttribute('mixin', 'material position');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we check for el.mixinEls too? assert.equal(el.mixinEls.length, 2) before and assert.equal(el.mixinEls.length, 0) after

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. I will.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@takahirox
Copy link
Collaborator Author

BTW, I'm thinking to replace new(old)Mixins.split(' ') with new(old)Mixins.trim().split(/\s+/).
The latter can accept two or more spaces, tabs, and new lines.
It'd be useful for users.

(example in the console)
-> var str = ' abc def\tghi\n jkl  mn  '
<- undefined
-> str
<- " abc def	ghi
     jkl  mn  "
-> str.split(' ')
<- ["", "abc", "def	ghi↵", "jkl", "", "mn", "", ""]
-> str.trim().split(/\s+/)
<- ["abc", "def", "ghi", "jkl", "mn"]

What do you guys think?

@dmarcos
Copy link
Member

dmarcos commented Jan 17, 2017

sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants