Re: DOMContentLoaded event and iframes

WakA <p.c.spruijtenburg@_riimove_student.utwente.nl>
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <2010012501422616807-pcspruijtenburg@riimovestudentutwentenl>
On 2010-01-24 22:24:00 +0100, Boris Zbarsky <[email protected]> said:

> On 1/24/10 3:52 PM, WakA wrote:
>> Naturally, I'm not expecting or even hoping for a change in the codebase
>> or behavior in order to achieve this. If I wanted to fry an egg using my
>> browser i'm sure this would be "possible" in some way. ;) I was mostly
>> looking to DOMContentLoaded as a way to supplant a load event (that only
>> fires after all the potentially big content has been loaded). My
>> expectation for the behavior of DOMContentLoaded was thus of a load
>> event minus all the nonDOM content, but this turned out not to be since
>> the "whole" page is not fully loaded and waiting for iframes to load
>> whilst the DOMContentLoaded event is already fired.
> 
> Well...  An <iframe> is in fact "non-DOM content".

I'm not sure I would consider iframe non-DOM content. What's going on 
archtitecturally? As far as I can see the DOM just gets expanded with a 
#document node.  Also, 
http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html 
defines an HTMLIFrameElement.

> 
> The precise definition of DOMContentLoaded is "when parsing of the page 
> is done".

Which begs the question of when parsing of the page is done? If iframe 
is just regular DOM then why isn't it counted as such?

> 
>> Ideally I guess I'm looking for something like a (theoretical)
>> DOMAllContentLoaded event
> 
> Defined how?

When parsing simply wait for all objects parsing an iframe to report 
DOMAllContentLoaded (or use another faster method internally), then let 
it issue a DOMAllContentLoaded itself. That should traverse nicely with 
OO. Come to think of it, I don't think that's entirely impossible to 
implement in javascript from the outside.


Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.