W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2012

Re: In WebIDL, should having a .prototype on interface objects be optional?

From: Cameron McCormack <cam@mcc.id.au>
Date: Sat, 29 Sep 2012 09:14:29 +1000
Message-ID: <50662F55.8080002@mcc.id.au>
To: Travis Leithead <travis.leithead@microsoft.com>
CC: Boris Zbarsky <bzbarsky@MIT.EDU>, "public-script-coord@w3.org" <public-script-coord@w3.org>, public-webapps <public-webapps@w3.org>
Travis Leithead:
> I guess you'd check for URL.href then? Or try { new URL("/test"); } catch (ex) { console.log("not supported"); }

I agree with Travis, you should be checking the particular features you 
want to use, rather than checking the existence of the prototype as a 
proxy for that test.

If URL.prototype was required to exist, you could just do ("href" in 
URL.prototype).  Since it currently doesn't, you could do ("href" in 
(URL.prototype || {})).
Received on Friday, 28 September 2012 23:15:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:07 UTC