Event ev;
DocumentEvent de = (DocumentEvent)elt.getOwnerDocument();
ev = de.createEvent("SVGEvents");
ev.initEvent("SVGLoad", false, false);
EventTarget t = (EventTarget)elt;
final String s =
elt.getAttributeNS(null, SVGConstants.SVG_ONLOAD_ATTRIBUTE);
EventListener l = null;
if (s.length() > 0) {
if (checkCanRun) {
// Check that it is ok to run embeded scripts
checkCompatibleScriptURL(lang, docPURL);
checkCanRun = false; // we only check once for onload handlers
}
l = new EventListener() {
public void handleEvent(Event evt) {
try {
interp.bindObject(EVENT_NAME, evt);
interp.bindObject(ALTERNATE_EVENT_NAME, evt);
interp.evaluate(new StringReader(s));
} catch (IOException io) {
} catch (InterpreterException e) {
handleInterpreterException(e);
}
}
};
t.addEventListener("SVGLoad", l, false);
}
t.dispatchEvent(ev);
if (s.length() > 0) {
t.removeEventListener("SVGLoad", l, false);
}
}