W3C home > Mailing lists > Public > public-webapi@w3.org > April 2006

Re: ISSUE-66: should Documents that aren\'t being presented be required to have a null defaultView?

From: Maciej Stachowiak <mjs@apple.com>
Date: Wed, 5 Apr 2006 17:19:44 -0700
Message-Id: <6EC2B8C8-6573-4D32-AE04-72243A7FBC76@apple.com>
Cc: Jonas Sicking <jonas@sicking.cc>, Web APIs WG <public-webapi@w3.org>
To: Ian Hickson <ian@hixie.ch>

On Apr 5, 2006, at 4:47 PM, Ian Hickson wrote:

>
> On Wed, 5 Apr 2006, Jonas Sicking wrote:
>>
>> We definitely want to allow all Documents to implement  
>> DocumentWindow. I
>> don't want to have two versions of every document class and have to
>> worry about constructing the right one.
>
> Um, well, every browser I've tested already does it, and given the  
> kind of
> stuff that DocumentWindow has (.location, .cookie, .execCommand,  
> etc), all
> of which has to be neutered for these non-Windowed Documents, it seems
> easiest to just remove the relevant members.

"Just remove" implies a lot more implementation effort than "return  
null for inapplicable attributes". BTW what was your test? I tried this:

javascript:alert("defaultView" in  
document.implementation.createDocument(null, null, null));
javascript:alert(document.implementation.createDocument(null, null,  
null).defaultView);
javascript:alert("location" in document.implementation.createDocument 
(null, null, null))
javascript:alert(document.implementation.createDocument(null, null,  
null).location);

The "in" expressions give "true" and the attempts to get the  
attribute give "null" in Firefox and Opera. This implies JS  
properties that are present but currently "null". An absent JS  
property would give "false" and "undefined" respectively.

Safari actually screws both of these up, in the first case  
defaultView is present, but that will shortly be fixed, and location  
is absent because we only have it on HTMLDocument instead of  
Document, unlike Firefox and Opera.

So I think the current rough consensus behavior is effectively that  
DocumentWindow is implemented but attributes that don't make sense  
for the non-presented case return null.

Regards,
Maciej
Received on Thursday, 6 April 2006 00:19:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:54 GMT