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

DOMTokenList list operations #80

Open
tomsmalley opened this issue Oct 19, 2017 · 0 comments
Open

DOMTokenList list operations #80

tomsmalley opened this issue Oct 19, 2017 · 0 comments

Comments

@tomsmalley
Copy link

DOMTokenList operates on lists, but it appears that it shouldn't.
https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList

Intended use:

$0.classList
["ui", "sticky", value: "ui sticky"]
$0.classList.add('one','two');
undefined
$0.classList
["ui", "sticky", "one", "two", value: "ui sticky one two"]

But calling from haskell

stickyList <- Element.getClassList sticky
DOMTokenList.add stickyList ["one", "two"]

results in

$0.classList
["ui", "sticky", "one,two", value: "ui sticky one,two"]

I don't think this is what you would expect upon calling the add function, although the same happens if you were to do $0.classList.add(['one','two']). The only reason I think this behaviour is bad is that the function is defined to take a list explicitly, so you might expect the first behaviour instead of the second.

Since this is all generated code I have no idea if it is at all fixable, of course the workaround is simple enough: just call DOMTokenList.add individually for each addition.

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

1 participant