Re: [PageVisibility] Feedback on the spec

On Mon, 16 Apr 2012, Boris Zbarsky wrote:

> On 4/16/12 12:25 PM, James Graham wrote:
>> In that case I totally misunderstood the spec on this point. Am I
>> missing something obvious?
>
> http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-visibilitychange-event 
> says:
>
>  The User Agent MUST fire the visiblitychange event at the Document
>  when the User Agent determines that the visibility of the Document
>  contained by the top level browsing context has changed.
>
> I agree that this is not as clear as it should be.  It should probably just 
> says that the event is fired at a Document when the UA determines that the 
> .visibilityState of that Document has changed.

OK, I am reassured that I at least found the right part of the spec :) But 
I am now even more confused about what the expected behaviour is. I 
presumed that the reference to "top level browsing context" here and in 
other places (e.g. the definition of the visibilitystate attribute) was 
intended to simplify the case where only a single descendant browsing 
context was rendered invisible e.g. due to partial covering of the browser 
window by some other window or by another tab in a MDI application.

Am I wrong in assuming that the visibility is supposed to reflect only the 
visibility of the top level browsing context as a whole, and not be 
individually correct for each nested browsing context?

Assuming I am not wrong about that, I think the right fix to the problem 
above is to specify that when the visibility of a top level browsing 
context changes, an event is fired on that browsing context's document 
object and on the document object of each descendant browsing context.

In general I find references to "the Document contained by the top level 
browsing context" to be unclear. I think this is because there are 
multiple browsing contexts and multiple documents involved. I assume this 
is supposed to be something like the value of window.top.document? 
Couldn't that be defined as a term like "topmost document" and that 
definition used throughout the spec?

Received on Monday, 16 April 2012 19:14:39 UTC