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

New api: setMods #1601

Open
belozer opened this issue Sep 21, 2018 · 2 comments
Open

New api: setMods #1601

belozer opened this issue Sep 21, 2018 · 2 comments

Comments

@belozer
Copy link
Member

belozer commented Sep 21, 2018

this.setMod('hasPrev').setMod('hasNext');
this.setMods({ hasPrev : true, hasNext : true })

Example banchmark:
https://jsperf.com/classlist-single-vs-multi
image

@veged

@Realetive
Copy link
Contributor

А если «усложнить» проверку первого аргумента в .setMod() и, если это объект и нет второго аргумента — делать «мультидобавление»:

this.setMod('hasPrev').setMod('hasNext');

аналагично

this.setMod( { hasPrev: true, hasNext: true } );

@belozer
Copy link
Member Author

belozer commented Sep 21, 2018

@Realetive это не очевидное поведение, т.к. идёт установка нескольких модификаторов.

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

No branches or pull requests

2 participants