Closed cdsmith closed 7 years ago
It looks like the correct members do exist in DOMRectReadOnly. So perhaps the bug is that Element.getBoundingClientRect returns a DOMRect, where it should instead return a DOMRectReadOnly.
Oh I came across this the other day too. It seems DOMRect
is a DOMRectReadOnly
(in the OO sense). That means that there is an instance IsDOMRectReadOnly DOMRect
in GHCJS.DOM.Types
. So we can use getLeft
and getTop
from GHCJS.DOM.DOMRectReadOnly
with the DOMRect
returned by getBoundingClientRect
.
Cool, thanks!
I still am glad to be using the hackage version of ghcjs-dom, though. I'll update that once 0.9 is on Hackage.
https://github.com/ghcjs/ghcjs-dom/commit/3c495cd71b2bdcc2013d305d2fab944fd9b5650a seems to have removed GHCJS.DOM.ClientRect in favor of DOMRect. However, DOMRect no longer contains
getLeft
andgetTop
. They are, instead, replaced bygetX
andgetY
, which seem to be Firefox-specific (see compatibility chart at https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)I'm not sure how to best handle this.