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

HTML API inconsistencies #410

Open
JbIPS opened this issue Apr 3, 2014 · 1 comment
Open

HTML API inconsistencies #410

JbIPS opened this issue Apr 3, 2014 · 1 comment

Comments

@JbIPS
Copy link

JbIPS commented Apr 3, 2014

Hi,
I tried to compile my Haxe/JS code with Cocktail and got some errors in return.

  1. js.html.Element.classList in Haxe return a DOMTokenList, but in Cocktail, this is an Array, so no add() method. Is it OK to create a class DOMTokenList in Cocktail that fill the gap?
  2. Element has no field getBoundingClientRect. That sounds like a pain in the neck. Is there another way to get Element coordinates in Cocktail?

Thanks,

EDIT: I'm using GitHub HEAD version

@yanhick
Copy link
Member

yanhick commented Apr 4, 2014

  1. Yes, I didn't implement DOMTokenList yet because it's one of the weird w3c data structures and I didn't get around to work on it yet. You can check NamedNodeMap for inspiration : https://github.com/silexlabs/Cocktail/blob/master/cocktail/core/dom/NamedNodeMap.hx
  2. It's not implemented yet. You can use "offsetTop" and "offsetLeft" to get the absolute pixel position of any element, like here :
    http://stackoverflow.com/questions/1409355/finding-the-offset-client-position-of-an-element

If you want to implement getBoundingClientRect, you need to :

JbIPS added a commit to JbIPS/Cocktail that referenced this issue Apr 4, 2014
Create the DOMToken list implementation (issue silexlabs#410)
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