[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re[4]: [cgmo-webcgm] 5.7.10 Interface WebCGMEvent Example
Hi Lofton, Okay, well on my machine, with our latest implementation... var cgmDoc; works var cgmDoc = new Object(); works var cgmDoc = new WebCGMMetafile(); does not work The main problem in this example is Ecmascript variable scoping, which I admit, I do not fully understand yet (need to read more about it). I don't get how you could obtain: "var cgmDoc = new WebCGMMetafile();" -- worked. Is there a fail safe somewhere that I don't see? Does IE handle that case differently than ECMA-262, I don't know. -- Benoit mailto:benoit@itedo.com Tuesday, November 29, 2005, 12:45:22 PM, you wrote: > Being short of time, I was doing trial and error to make the examples > (Event and EventListener) work. Using WinXP, IE6, and Itedo Beta 5: > "var cgmDoc;" -- did not work (JS object failure). > "var cgmDoc = new Object();" -- worked. > "var cgmDoc = new WebCGMMetafile();" -- worked. > Now that I have a bit more time, I'm interested to hear the resolution of > the questions you raise. I'm not a JS/ES expert, but have to go back to my > reference book to sort out this stuff. Any guru out there have the answer > for us? > (We *do* need to sort it out, as it will need correction in W3C processing.) > -Lofton. > At 12:10 PM 11/29/2005 -0500, Benoit Bezaire wrote: >>Hi Lofton, >> >> From my understanding of ECMA-262. >> >>var cgmDoc; >> >>Is an uninitialized variable (actually initialized to 'undefined'); >> >>var cgmDoc = new WebCGMMetafile(); >> >>Has an additional Initializer ( = new WebCGMMetafile();) the variable >>is created (like above) when the scope is entered but assigned a >>value when the variable statement is executed. >> >>In this case, because 'WebCGMMetafile' is not an known Object, the new >>will throw a TypeError exception. >> >>You need to call getWebCGMMetafile(); to create a WebCGMMetafile >>Object. Doing: >> >>var cgmDoc = new Object(); >> >>gains you nothing (that I can see), since it will be re-assigned by >>the getWebCGMMetafile(); call. >> >>That's my understanding, if someone has a different opinion, please >>share it with the group. >> >>-- >> Benoit mailto:benoit@itedo.com >> >> >>Tuesday, November 29, 2005, 11:39:04 AM, you wrote: >> >> > At 11:16 AM 11/29/2005 -0500, Benoit Bezaire wrote: >> >><snip> >> >> >> >> >> If other vendors are able to interpret such ecmascript, maybe they >> >> >> can say so. >> >> >> >> > Curious that you ask the question. One reason I didn't catch the >> error is >> >> > that your beta (b4 and b5) code executes both examples successfully, >> on my >> >> > WinXP with IE6. (Have you subsequently changed the code so that the >> >> > invalid case fails?). I *did* execute each example before >> submitting the >> >> > text for CS ballot. >> >>Are you sure you haven't changed var cgmDoc; to var cgmDoc = new >> >>WebCGMMetafile(); between trying the test and publishing? >> >> > Well ... now I'm confused. Both the listing in the CS text, and the code >> > in the .html file (as shown by "View Source" after executing the html) say: >> >> > <script type="text/ecmascript"> >> > var cgmDoc = new WebCGMMetafile(); >> > function handleClick(evt) { >> > .... >> >> > Neither of them say "var cgmDoc;". Your original question (previous >> > message) was: >> >> >> Is var cgmDoc = new WebCGMMetafile(); valid? >> >> > (And my answer was, "not valid, because the constructor function is not >> > defined." Now ... I don't know what JS or ECMAScript say about that case, >> > if the constructor definition is missing. Does it substitute "new >> > Object()"? Fail in unpredictable ways? Other?) >> >> >>I just don't see how our implementation could create such an object. >> >>I'll have to get back to you on this. >> >> > Does JS/ES language spec itself say anything about fallback or error >> > mechanism for undefined constructor? >> >> > -Lofton. >> >> >> >>-- >> >> Benoit mailto:benoit@itedo.com >> >> >> >> >> >> > Another item for the issues/errata queue. Hmmm... Dave, do you know >> how we >> >> > handle errata pages in OASIS? (It's not like W3C, where the errata >> page is >> >> > linked off of the cover page "Status" section with a persistent >> URL. But >> >> > Mary mentioned it once and I think there is something like a convention >> >> > with a fixed location/naming construct.) >> >> >> >> > -Lofton.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]