cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gunnar Brand <g.br...@interface-business.de>
Subject Re: [BUG] forms-lib.js
Date Tue, 15 Jun 2004 16:51:37 GMT
Am 16:29 14.06.2004 +0200 schrieb Klaus Bertram:
>Hi all,
>i test the gui form with the standard IE5.0 based on win2000
>there are 2 possible bugs
>1 is based in the htmlarea script. (I look at it)
>after excluding the load of the script there are a an error in 
>forms-lib.js at line 65
>the compare of
>   if (name == undefined)
>can't work because undefined as name is not defined ;)
>I add
>   var undefined;
>at top and it rocks
>Tested under IE5.0, IE6.0, Moz 1.6
>
>Klaus

Hello.

Your finding and your solution is correct, IE5.0 (but not Opera, Mozilla 
and IE5.5+) does not know the keyword "undefined".
I found this bug a year ago and used this solution:
eval(navigator.userAgent.indexOf("MSIE 5.0")!=-1 ? "var undefined;" : 
"void(0);");
which doesn't define the variable in browsers that support the keyword (I 
am not talking about IE4 etc here).

IE5.0 is kind of bad for javascript users, because it claims to be 
compatible to a javascript version but then fails to do so.
I can't remember if it is version 1.2 or 1.3 but most likely 1.3.
For example Array methods like push, pop, slice, splice, shift, unshift do 
not exist.
I had quite some fun (not!) to reimplement those methods in pure 
javascript. I don't know about the document.getElementById method, but I 
wrote a simple replacement using document.all for it, too. Of course one 
can't rewrite all missing stuff like the function invoking string replace 
but it was enough to get my application running.

I took a look at this forms-lib.js to check for other errors and there is 
this fixme entry:

   form["forms_submit_id"].value = name;
         // FIXME: programmatically submitting the form doesn't trigger 
onsubmit ? (both in IE and Moz)
         forms_onsubmit();
         form.submit();

Actually, this has been the case since Javascript version 1.1 (and probably 
1.0, but I lack the original netscape documentation of that version) and is 
_correct_ behaviour.
Calling form.submit() should not trigger the onsubmit eventhandler. Buggy 
Opera does so, though.
One can call onsubmit() by hand (after checking if it is defined) or 
click() of one of the submit buttons of the form to trigger the form's 
onsubmit handler. The latter solution is not very safe.
And: Since Opera messes up at this part, relying on onsubmit not being 
invoked when form.submit() is called has also become very dangerous. So 
doing it by hand is probably the best idea.


gunnar



-- 
G. Brand - interface:projects GmbH
Tolkewitzer Strasse 49
D-01277 Dresden
mail:   g.brand@interface-projects.de
tel:    ++49-351-3 18 09 - 41

Ein Unternehmen der interface:business-Gruppe


Mime
View raw message