canvas-color-space
canvas-color-space copied to clipboard
Interfaces just for feature detection is an antipattern
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.
Additionally, it is invalid WebIDL. Currently, WebIDL only allows for constant primitive types, which are "bigint, boolean and the numeric types."
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.