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

Should cropTo be able to directly take an element as input? #19

Open
youennf opened this issue Feb 2, 2022 · 2 comments
Open

Should cropTo be able to directly take an element as input? #19

youennf opened this issue Feb 2, 2022 · 2 comments

Comments

@youennf
Copy link
Contributor

youennf commented Feb 2, 2022

It seems potentially useful to pass an element directly to cropTo instead of a a CropTarget, especially if CropTarget is created asynchronously.
One potential issue is if at some point, it is found good to have a CropTarget getter on the track itself.

@eladalon1983
Copy link
Member

eladalon1983 commented Feb 2, 2022

It seems potentially useful to pass an element directly to cropTo instead of a a CropTarget, especially if CropTarget is created asynchronously.

I think it's a good idea. It's a non-blocking ergonomics improvement that affects only some cases. I'm marking it as such.

One potential issue is if at some point, it is found good to have a CropTarget getter on the track itself.

Resolution: Make cropTo(Element) implicitly create a CropTarget behind the scenes, and the getter will return that token, with no observable difference to the program between whether cropTo(Element) or cropTo(CropTarget) was previously called.

Noteworthy: An implicitly minted CropTarget is how Chrome would implement this anyway, and most likely other UAs as well.

@jan-ivar
Copy link
Member

See #11 (comment) for why I think this special-casing is bad, and a symptom of having an API shape so unappealing in the first place that this issue is considering adding a second one as a workaround for it.

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

No branches or pull requests

3 participants