Re: XBL in document fragments

Erik Arvidsson wrote:
> I'm not totally sure about this. The important part is that both the 
> following works:
> 
> <p id="p" style="binding:url('test.xml#test')">Foo</p>
> <script type="text/javascript">
> // assuming the binding adds a test method
> document.getElementById("p").test();
> </script>

The only way to ensure that works is to not start executing the script 
until the binding has loaded.

But what about event handlers elsewhere in the document?  Those may want 
to access the "test" attribute on the <p> while the binding is loading...

> var el = document.createElementNS(myns, "test");
> el.test();

At this point, the options are to either not return from createElementNS 
until the binding has loaded (which can lead to weird reentrancy issues 
from event handlers, unless all event handling is blocked for the 
(possibly long) time the binding needs to load) or to not even get to 
this script until the binding has loaded (which means that once we get 
to a binding definition we completely suspend all event handling on the 
page and all parsing of the page and start loading the binding).

None of which is pleasant from a user perspective (the page acts "dead" 
while the binding loads, which can take a while).  I suspect this is why 
binding loading and attachment is async in both Mozilla and IE...

-Boris

Received on Tuesday, 28 September 2004 19:52:24 UTC