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

Interfaces just for feature detection is an antipattern #44

Open
domenic opened this issue Feb 16, 2021 · 2 comments
Open

Interfaces just for feature detection is an antipattern #44

domenic opened this issue Feb 16, 2021 · 2 comments

Comments

@domenic
Copy link

domenic commented Feb 16, 2021

Interfaces are meant to represent instances of an object (in the OOP sense, bundling together data and operations on that data). They are not used for feature detection.

I suggest instead adding something like HTMLCanvasElement.supportsColorSpace("display-p3") or similar.

@weinig
Copy link

weinig commented Apr 28, 2021

Additionally, it is invalid WebIDL. Currently, WebIDL only allows for constant primitive types, which are "bigint, boolean and the numeric types."

@kdashg
Copy link
Contributor

kdashg commented Apr 28, 2021

Ok, well, that's unfortunate: I think the ergonomics are better this way, as it matches how function feature detection is done, extending the approach there to enums.

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

3 participants