[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re[4]: [cgmo-webcgm] Issue: addEventListener
Hi all, First, a few questions to Ulrich... - Could you provide us with a few lines of JS that would illustrate how your default event listener works in your viewer? - Is the 'onload' the only default event listener you support? Dieter... please see inline... Monday, March 21, 2005, 11:54:06 AM, Dieter wrote: DW> I think that an onLoad event needs to be installed somehow with the viewer DW> rather than with the document. You may be right, but this may not be easy to do. (not sure yet). DW> Consider the following (assuming that the addEventListener method is moved DW> up to the metafile interface: Ok. DW> <script language="JavaScript"> DW> function handleLoad(evt) DW> { DW> window.alert( "load finished" ); DW> } DW> function init() DW> { DW> var cgmDoc = DW> document.getElementById("ivx1").getWebCGMDocument(); DW> cgmDoc.src = 'first.cgm'; DW> cgmDoc.addEventListener( "load", handleLoad ); DW> cgmDoc.src = 'second.cgm'; } DW> </script> DW> As of now, handleLoad wouldn't be called for first.cgm, Correct. DW> and it would be removed by closing first.cgm before opening second.cgm, I'm not so sure about that, I think an implementation could keep the information around. Ralf (co-worker), let me know if I'm wrong. DW> so it wouldn't be called for second.cgm either, right? I think it could get called for second.cgm, but still, the problem exists for first.cgm. DW> It would be good to know how the SVG folks handle this case. Both HTML and SVG support the predefined event listeners: onload, onclick, onmousemove etc... <html onload="do something"...> or <svg onload="do something"...> So, while reading the file, an implementation can add the event handler _before_ the document is finished loading _and_ execute it before the first rendering. DW> Some solution might be to install a default handler with the viewer, DW> and the viewer installs it on the opening document as early as possible. Default handlers or listeners? In the case of handlers, you are in fact suggesting that we agree on a function name, and that upon loading the viewer calls that function if it present in the HTML script, right? Could some other approach be: - add onload="function to call" inside the CGM itself? - or add onload="function to call" as some sort of parameter to the object tag? - or simply document that for the 'load' event, you need to set the event listener before setting 'src'; and that 'load' doesn't work if the source filename is set on the object tag. Thoughts? -- Benoit mailto:benoit@itedo.com DW> Dieter DW> -----Original Message----- DW> From: Ulrich Laesche [mailto:ulrich@ematek.de] DW> Sent: Monday, March 21, 2005 4:24 PM DW> To: cgmo-webcgm@lists.oasis-open.org DW> Subject: FW: Re[2]: [cgmo-webcgm] Issue: addEventListener DW> Sorry, I hit the wrong reply button. DW> -----Original Message----- DW> From: Benoit Bezaire [mailto:benoit@itedo.com] DW> Sent: Montag, 21. Marz 2005 15:58 DW> To: Ulrich Laesche DW> Subject: Re[2]: [cgmo-webcgm] Issue: addEventListener DW> Hi Ulrich, DW> I was wondering if you could CC the group? I want to CC the group (I DW> think they should be involved). Do you mind resending, and doing a DW> reply all. DW> -- DW> Benoit mailto:benoit@itedo.com DW> Monday, March 21, 2005, 8:15:37 AM, Ulrich wrote: UL>> Hi Benoit, UL>> Once installed, the event handler should be triggered on a Reload DW> Picture UL>> occurrance, right? Still, this doesn't solve the problem you described UL>> below (unless you want to load an image twice to execute some onload UL>> actions). UL>> So far, we (Ematek) always assumed the onload event handler in the DW> script UL>> being present by default (like in your SVG sample). Apparently the spec DW> now UL>> says that no event handler is present by default and that it needs to be UL>> installed prior to become active. UL>> We could assume that the load action is not finished before the second DW> line UL>> of the script is recognized (when moving the load handler to the DW> Metafile UL>> interface, cgmDoc.addEventListener( "load", handleLoad )). However, DW> this is UL>> mere speculation and may work or not depending on the implementation or UL>> performance. UL>> What does the SVG standard propose in this respect? As the Event DW> handling UL>> mechanism should work with all other events the onload should either be UL>> handled the same way (with some reasonable behavior assumptions) or DW> become a UL>> different method. UL>> Regards UL>> Ulrich UL>> -----Original Message----- UL>> From: Benoit Bezaire [mailto:benoit@itedo.com] UL>> Sent: Donnerstag, 17. Marz 2005 18:41 UL>> To: CGMO WebCGM TC UL>> Subject: [cgmo-webcgm] Issue: addEventListener UL>> Hi CGMO, UL>> We came upon a problem while working on addEventListener... If you UL>> consider the following ECMAScript: UL>> <script language="JavaScript"> UL>> function handleLoad(evt) UL>> { UL>> window.alert( "load finished" ); UL>> } UL>> function init() UL>> { UL>> var cgmDoc = UL>> document.getElementById("ivx1").getWebCGMDocument(); UL>> cgmDoc.src = 'appstructure.cgm'; UL>> cgmPic = cgmDoc.firstPicture; UL>> cgmPic.addEventListener( "load", handleLoad ); UL>> } UL>> </script> UL>> The problem is that the "load" event will never be triggered because UL>> by the time you get to the addEventListener, the document is already UL>> fully loaded. UL>> Do people know if moving the addEventListner to the WebCGMMetafile UL>> interface solves the problem? Ulrich, your guys worked on this, UL>> right? UL>> Assuming the source file was set on the <object> tag and that the UL>> addEventListener method was on the WebCGMMetafile, would the UL>> following code work? UL>> function init() UL>> { UL>> var cgmDoc = UL>> document.getElementById("ivx1").getWebCGMDocument(); UL>> cgmDoc.addEventListener( "load", handleLoad ); UL>> } UL>> I'm thinking no... I tried this with an SVG viewer and it didn't UL>> work (but it could be a bug). I can only get the load event to be UL>> tricked if the event listener is already in the SVG file: UL>> <svg onload="do something"...> UL>> Is there a way to catch the 'load' event in a WebCGM viewer UL>> implementation? UL>> -- UL>> Benoit mailto:benoit@itedo.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]