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

Missing getClientRects method and other stuff #21

Open
flip111 opened this issue Apr 6, 2020 · 7 comments
Open

Missing getClientRects method and other stuff #21

flip111 opened this issue Apr 6, 2020 · 7 comments
Labels
purs-0.15 A reminder to address this issue or merge this PR before we release PureScript v0.15.0 type: enhancement A new feature or addition.

Comments

@flip111
Copy link
Contributor

flip111 commented Apr 6, 2020

I want to implement this code here https://stackoverflow.com/a/3028037/1833322

which has the line

const isVisible = elem => !!elem && !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length )

For that i need getClientRects. This method is not available in the documentation

https://pursuit.purescript.org/packages/purescript-web-dom/4.0.1/docs/Web.DOM.Element

I also saw a bunch of other properties, methods and event handlers that don't seem to be implemented

From: https://developer.mozilla.org/en-US/docs/Web/API/Element

properties

Element.computedName
Element.computedRole
Element.innerHTML
Element.outerHTML
Element.part
NonDocumentTypeChildNode.nextElementSibling
NonDocumentTypeChildNode.previousElementSibling
Element.shadowRoot
Element.slot
Element.undoManager
Element.undoScope
Slotable.assignedSlot

event handlers

Element.onfullscreenchange
Element.onfullscreenerror

methods

EventTarget.addEventListener()
Element.attachShadow()
Element.animate()
Element.closest()
Element.createShadowRoot()
Element.computedStyleMap()
EventTarget.dispatchEvent()
Element.getAnimations()
Element.getAttributeNames()
Element.getAttributeNS()
Element.getBoundingClientRect()
Element.getClientRects()
Element.hasAttributeNS()
Element.hasPointerCapture()
Element.insertAdjacentElement()
Element.insertAdjacentHTML()
Element.insertAdjacentText()
Element.matches()
Element.pseudo()
Element.querySelector()
Element.querySelectorAll()
Element.releasePointerCapture()
ChildNode.remove()
Element.removeAttributeNS()
Element.removeAttributeNode()
EventTarget.removeEventListener()
Element.requestFullscreen()
Element.requestPointerLock()
Element.scroll()
Element.scrollBy()
Element.scrollIntoView()
Element.scrollTo()
Element.setAttributeNS()
Element.setPointerCapture()
Element.toggleAttribute()

@garyb
Copy link
Member

garyb commented Apr 6, 2020

A lot of these are defined in https://github.com/purescript-web/purescript-web-html

The DOM API applies to XML, SVG, etc. and the HTML API extends it. See the READMEs of the respective libraries for links to the relevant specs 🙂

@flip111
Copy link
Contributor Author

flip111 commented Apr 6, 2020

I don't find the getClientRects function when i search on pursuit. I searched for some other things as well and i can't find them either.

@garyb
Copy link
Member

garyb commented Apr 6, 2020

Ah yeah, some of them, like getClientRects is part of CSSOM-view: https://drafts.csswg.org/cssom-view/#dom-element-getclientrects, which there isn't really a library for yet. There's a CSSOM lib but that's also lacking stuff, and CSSOM-view is a separate spec again.

There are definitely things from your list that already exist elsewhere though, a random selection:

It's not uncommon for people to request things from the MDN listings, but we don't go from those listings - they cut across multiple specifications, and not everything listed is even specified - some of the properties and functions are experimental/deprecated/from obsolete proposals.

The goal of the purescript-web libraries is to implement individual specifications. This has become a little harder since things were switched over to living standards rather than the previous versioned specifications admittedly, but the idea is to avoid opinionating the libraries and instead having them as basic building blocks that people can rely on and build on top of if they want to improve the ergonomics to their taste.

@flip111
Copy link
Contributor Author

flip111 commented Apr 6, 2020

@garyb what are the steps to add getClientRects? I can try to do it

Should it go here? https://github.com/purescript-web/purescript-web-cssom
Or new purescript-web-cssom-view?

What's the "living standard?". MDN is not a standard, but it's an authority in the field though.

btw i already left out the deprecated and obsolute items.

@keijokapp
Copy link

I made my own purescript-web-geometry for DOMRect and DOMRectList, and purescript-web-cssom-view which should implement all interfaces in CSSOM View Module except

These packages are not fully tested yet - I'd like to get some kind of approval before spending more time on it.

What's the process of getting these packages reviewed, added to purescript-web, and published?

@thomashoneyman
Copy link
Contributor

@keijokapp you can ping myself and @garyb to review your library, and I can take care of transferring the library into purescript-web and migrated in the registry / published. You'd be a maintainer on the library. We're both active in Slack, or on the PureScript Discourse.

@JordanMartinez JordanMartinez added purs-0.15 A reminder to address this issue or merge this PR before we release PureScript v0.15.0 type: enhancement A new feature or addition. labels Dec 7, 2021
@JordanMartinez
Copy link
Contributor

This should also be done with the next round of breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
purs-0.15 A reminder to address this issue or merge this PR before we release PureScript v0.15.0 type: enhancement A new feature or addition.
Projects
None yet
Development

No branches or pull requests

5 participants