Re: [PageVisibility] Feedback

On Tue, 26 Jul 2011 11:09:03 -0700, Jatinder Mann <jmann@microsoft.com>  
wrote:
> 1. The hidden attribute on Document is potentially confusing with the  
> hidden attribute existing on all HTML elements, especially as the  
> Document object sometimes shares such global HTML attributes (dir and  
> numerous event handler attributes). Maybe isVisible would be better?
>
> My understanding is that the HTML5 hidden attribute is only defined for  
> HTML elements, which would preclude the Document object as it inherits  
> from Node. There is no conflict here.

There is no conflict, but possibility for confusion given that Document  
does share some attributes with elements that have the same semantics.


> Using document.hidden would make feature detection easier than using  
> document.isVisible. For example, using if (document.isVisible) for  
> feature detection has the downside that the undefined case, which legacy  
> browsers would hit, is equal to the not visible case - legacy browsers  
> will get the behavior defined for the hidden page. Doing feature  
> detection on document.hidden will ensure that the undefined case is  
> equal to the visible page case - legacy browsers will get the page with  
> the visible behavior.

Just use ("isVisible" in document).


> 3. We use strings in a number of APIs and it is clearly a better  
> approach however none of these APIs currently expose them as constants  
> and I do not think there is a good reason to do that. Examples of such  
> APIs are XMLHttpRequest (the responseType attribute) and the HTML Canvas  
> 2D Context (numerous attributes).
>
> Constants have the advantage of allowing web developers to inspect for  
> capability via developer tools and IDEs rather than read documentation  
> to find out which strings are supported.

I do not think that argument is compelling enough to deviate from the  
established conventions for web platform APIs.


> 5. Instead of using [NoInterfaceObject], a different interface name, and  
> implements, please simply use "partial interface Document".
>
> My understanding is that using [NoInterfaceObject] with a different  
> interface name and implements is functionally the same as using "partial  
> interface Document". Is this not the case?

It differs somewhat for non-ECMAScript bindings.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 26 July 2011 18:14:28 UTC