About KJS::HTMLCollection::getNamedItems
David Faure
david at mandrakesoft.com
Thu Aug 15 12:53:02 BST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 15 August 2002 13:33, Koos Vriezen wrote:
> On this example:
> <html><body onLoad='alert(""+document.myname.length)'>
> <form name="myname">
> <input name="myname" type="text">
> </form></body></html>
> => 1
Ah, but that's not "length of the array", it's "number of elements in the form".
> alert(""+document.myname)
> => [Object]
IE isn't very descriptive :}
> alert(""+document.myname[0].nodeName)
> => INPUT
Confusing test/result too ;) That's not "first item called myname", it's
"first form element in the myname form". Reason:
myname[0] and myname.item(0) are the same, they lead to
<object-returned-by-'myname'>::get('0').
> document.myname[1].nodeName
> => script error
Yes, no second form element.
But this doesn't answer the "is this behaviour for forms only, or for all nested elements".
Did you try stuff like <div name='test'><div name='test'></div></div>, to
see if your idea about identically-named nested elements is true?
I think this is really only for forms. The fix would be to add a new value to the ReturnType enum
in KJS::HTMLCollection, named "ReturnForm" (i.e. only return form elements),
and add support for it in HTMLCollection, and use that value in kjs_html.cpp:169
if element.elementId() == ID_FORM.
- --
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
iD8DBQE9W5Yf72KcVAmwbhARAk+6AKCGUIk+yiqgO2IRpf29g5jHyXikdwCgj1N/
3mYBf1yw25Gul7nmk1G/BSo=
=OXez
-----END PGP SIGNATURE-----
More information about the kfm-devel
mailing list