About KJS::HTMLCollection::getNamedItems
David Faure
david at mandrakesoft.com
Thu Aug 15 10:25:10 BST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 15 August 2002 10:31, Koos Vriezen wrote:
> Hi,
>
> Ok, tested on IE 6.0:
> <html><body onLoad='alert(""+document.myname.nodeName)'>
> <form name="myname">
> <input name="myname" type="text">
> </form>
> </body></html>
> Message box shows FORM. With document.myname.myname.nodeName it shows
> INPUT.
This only proves that the site works, it doesn't explain why/how.
What does alert(""+document.myname) show?
And document.myname[0].nodeName, and with [1] ?
(to see if it behaves as an array AND as a normal element too)
> If I add another form with 'myname' as name, the alert box shows
> 'undefined', without the 'nodeName' its '[Object]'
So you get a list of two forms in that case....
> It seems that no collection is returned when child/parent with the same
> name occur.
That's a VERY broad statement, which would need further testing with other
kind of elements.
- From the above one could also conclude that "document.formname" first looks
at forms (and returns only forms, if it found any). The reason I'm tempted to
believe in this "exception" is that document.formname is already an exception:
we (and IE) look for that before looking for JS properties that have been
set in the document. What I mean is (with the above <form> tag assumed) :
document.myname = 'foo';
alert(document.myname); << will still return the FORM object, not 'foo'.
But this only happens with forms and images apparently. The other cases
of document.myname lookup are done after the JS property lookup.
- --
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
KOffice-1.2-rc1 is out. ftp://ftp.kde.org/pub/kde/unstable/koffice-1.2-rc1/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9W3N372KcVAmwbhARArevAJ9CQmSDIgWloHqpByUeCxsAcwHZjgCgiB+a
YTNVIq4YuFlMGlyJLHgyKgQ=
=HlaI
-----END PGP SIGNATURE-----
More information about the kfm-devel
mailing list