Re: XSLT processing model in Mozilla

Jonas Sicking <[email protected]> Mon, 06 Aug 2007 18:29:55 -0700
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Message-ID <[email protected]>
John J. Barton wrote:
>>>> What it might be is that you're managing to attach eventlisteners to 
>>>> the source XML file, i.e. the one before transformation takes place. 
>>>> I do think we might (arguably errorously) be firing events at that 
>>>> document.
>>>
>>> I am trying to attach to the *window* before the transformation. The 
>>> last point that I can trace is the load of the .xsl file.
>>
>> Note that scripts in the .xsl file are not run before the 
>> transformation. They are run during the transformation when those 
>> result elements are created.
> 
> Right, but what window are they created in? Or what happens to the 
> window during the transformation besides the document transform?

I assume you mean "run" when you say "created"? It happens in the window 
that is returned when you say 'window' in the webpage.


>>>> However I think we're not firing them at the result document, which 
>>>> probably is where firebug is attaching its listeners.
>>>
>>> In my test the listeners that succeed are in the .xsl file. The 
>>> window.addEventListener() calls are in the XSLT result and were are 
>>> not in the xml file.  The listeners that fail are attached in a 
>>> nsiWebProgressListener on a window with a .xml uri before the 
>>> transformation.
>>>
>>> Now "source document" and "result document" sounds interesting. From 
>>> my point of view there is only a window, its primary document. Can I 
>>> see the source document or result document in javascript code?
>>
>> You can't get to the source document from within a webpage. You might 
>> be able to get to it from chrome, I don't know. You can try. The 
>> result document is what you get when you use 'document' in javascript 
>> in the result page.
> 
> Yes, but my problem is that the *window* that the result document lives 
> in is somehow not the same as the source window. I only have the source 
> window to watch. So I can't get the result document because I don't have 
> the result window.  Or rather I have event listeners on the source 
> window and they appear to get erased.  The result window could be the 
> same object, but its contents outside of the document being transformed 
> seem to be changed.

After some digging and help from jst we determined that what happens is 
that we once the xslt execution starts remove all registered 
eventhandlers and remove all set properties on the window.

This is something that we could try to fix, we probably should. Feel 
free to file a bug on it and help out with testing patches once they're 
written.

Best,
Jonas Sicking