[whatwg] Challenging canvas.supportsContext

Jonas Sicking jonas at sicking.cc
Tue Jun 25 16:44:04 PDT 2013


On Tue, Jun 25, 2013 at 10:28 PM, Simon Pieters <simonp at opera.com> wrote:
> On Tue, 25 Jun 2013 21:01:27 +0200, Dean Jackson <dino at apple.com> wrote:
>
>> Showing or hiding interface objects is not something I want to do.
>
> It's possible that I missed it, but, why not?

I have the same question.

The whole hasFeature and isSupported disasters of DOM2 (or was it 3?)
lead to us advocating, and a lot of websites switching to, patterns
like:

if (window.indexedDB) {
  x = indexedDB.open(...);
  ...
}

and

if (window.WebSocket) {
  x = new WebSocket(...);
}

I.e. testing for features by checking if the DOM calls are available,
not by creating separate functions that are supposed to tell you if a
given feature is there or not.

Granted, this is somewhat different since the interface object would
act like a proxy to see if a feature is there, even though you
generally don't use the feature through the interface object.

But it's an interface object that should naturally be there if you
implement the feature, and naturally not there if you don't.

/ Jonas



More information about the whatwg mailing list