WICG / canvas-color-space

Proposed web platform feature to add color management, wide gamut and high bit-depth support to the <canvas> element.
Other
81 stars 19 forks source link

Interfaces just for feature detection is an antipattern #44

Open domenic opened 3 years ago

domenic commented 3 years ago

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 commented 3 years ago

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

kdashg commented 3 years ago

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.