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

className functions on Ink.Dom.Css can't handle bad arguments #364

Closed
entomb opened this Issue Jun 18, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@entomb
Contributor

entomb commented Jun 18, 2014

Some of the functions provided by the Ink,Dom.Css explode erratically when called with not-very-nice arguments via arrays or comma separated strings.

expected output: when there's no class to add, no class is added.

> Ink.Dom.Css.addClassName(document.body,'') 
null

returns null instead of nothing but whatever...

actual output:

> Ink.Dom.Css.addClassName(document.body,[''])
SyntaxError: Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty.

> Ink.Dom.Css.addClassName(document.body,['a','b',''])
SyntaxError: Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty.

> Ink.Dom.Css.addClassName(document.body,[])
SyntaxError: Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty.

> Ink.Dom.Css.addClassName(document.body,'a ') //notice the whitespace
SyntaxError: Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty.

> Ink.Dom.Css.addClassName(document.body,'a,') //notice the comma
SyntaxError: Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty.

as a bonus, curious cases that work (no error, and classes added):

> Ink.Dom.Css.addClassName(document.body,['a','','c'])
undefined

> Ink.Dom.Css.addClassName(document.body,'a,,,,,,,,,,,,,,,,,b')
undefined
@fabiosantoscode

This comment has been minimized.

Show comment
Hide comment
@fabiosantoscode

fabiosantoscode Jun 25, 2014

Contributor

Closed by #370, thanks @rogeriopvl and @entomb :)

Contributor

fabiosantoscode commented Jun 25, 2014

Closed by #370, thanks @rogeriopvl and @entomb :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment