Re: Loading a resource document from script

Robin Berjon:
> Sorry for being thick but I'm not sure I understand your use case very 
> clearly. A side question that might seem unrelated to you but would help 
> me understand would be: given getURL, postURL, and parseXML (as 
> currently available in multiple SVG implementations) what would you be 
> missing to get your use case to work?

Sorry, here's a more concrete example:

  <xbl:xbl>
    <xbl:definition element="ex:button">
      <xbl:template/>
      <xbl:handlerGroup>
        <handler ev:event="xbl:prebind">
	  var href = e.getAttributeNS(XLINKNS, "href");
	  var url = href.substring(0, href.indexOf("#"));
	  var frag = href.substring(href.indexOf("#") + 1);
	  var doc = ...; // load this url, not with getURL
	  var elt = doc.getElementById(frag);
	  // ... do something with the element
	  elt.addEventListenerNS
	    (EVNS, "DOMAttrModified", f, false, null);
	</handler>
      </xbl:handlerGroup>
    </xbl:definition>
  </xbl:xbl>

  <ex:button/>
  <ex:button/>

Firstly, I don't want to load the resource document more than once.
(Ok, that could be cached by my script.)  But more importantly, I want
any attribute changes to that referenced element to trigger the event
handlers for my two button instances.  Those attribute changes might
come from script running in that resource document, or some script from
this document that happened to have access to that resource document
too.  getURL/parseXML isn't good here because it will load each time
and also it just returns a bit of static XML rather than a running SVG
document.

-- 
  e-mail : cam (at) mcc.id.au    	icq : 26955922
     web : http://mcc.id.au/	        msn : cam-msn (at) aka.mcc.id.au
  office : +61399055779		     jabber : heycam (at) jabber.org

Received on Monday, 10 October 2005 23:25:06 UTC