Re: [dom] Is it recommended to use Node.getFeature() or Node.isSupported()?

Le 22/08/2013 04:11, Tab Atkins Jr. a écrit :
> On Wed, Aug 21, 2013 at 5:56 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> On 8/21/13 8:43 PM, James Craig wrote:
>>> if (typeof document.body.ondismissrequest !== "undefined") {
>>
>> Just if ("ondismissrequest" in document.body), I'd think.
I could not agree more :-)

> Yeah, this is all you need to do.  It's not perfect, but web devs are
> good at making a racket when we accidentally ship something that
> passes this test but doesn't actually work.
Unfortunately indeed.
This reminds me of discussions related to FirefoxOS (when some features, 
disabled for security reasons are exposed as null [1]).
Also reminds me of a comment I read from the Persona project [2]

Maybe specs (WebIDL?) should start providing guidance on how not to 
expose an API when it doesn't work (disabled for security reason or else)?
I'm not sure yet what form that would take, but what I read at [2] made 
me realize that there is some loopholes in spec-land (loopholes that 
don't have tests for them, etc.)

David

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=838614
[2] 
https://github.com/mozilla/browserid/blob/a23791b9651fd0c3b96b25e3abcb810f51c03532/resources/static/include_js/_include.js#L41-L70

Received on Thursday, 22 August 2013 08:04:27 UTC