OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

cgmo-webcgm message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re[3]: [cgmo-webcgm] 5.7.10 Interface WebCGMEvent Example


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]