JS regression - found the problem
David Faure
dfaure at trolltech.com
Thu Apr 3 08:47:25 BST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 03 April 2003 06:29, David Joham wrote:
> Found the problem...
>
> In HM_ScriptDOM.js, there's a call to the removeAttribute method of a newly created DOM object.
> This call is failing in Konq with a "DOM Exception 8" error for some reason.
>
> This call seems to fail whenever you call it in Konqueror regardless of whether or not the DOM
> object was in the HTML or created via JavaScript. Putting a try/catch around this one line of code
> made the menus work with one visual glitch that's new since the last time I looked at these menus.
> Nothing major at all, the menus are fully functional.
>
> I've created a small recreation that demonstrates the problem. Debugging Konq's code is beyond my
> C++ skills so I'll have to pass this off to someone more qualified at this point.
No problem, you did the hard part of the job ;)
- --- dom_element.cpp 8 Feb 2003 02:24:52 -0000 1.37
+++ dom_element.cpp 3 Apr 2003 07:42:16 -0000
@@ -180,8 +180,7 @@ void Element::removeAttribute( const DOM
int exceptioncode = 0;
NamedNodeMapImpl *attributes = static_cast<ElementImpl*>(impl)->attributes(false);
attributes->removeNamedItem(id, DOMString(), DOMString(), exceptioncode);
- - if ( exceptioncode )
- - throw DOMException( exceptioncode );
+ // ignore exceptioncode, it's allowed to remove attributes that don't exist.
}
Attr Element::getAttributeNode( const DOMString &name )
This fixes it, and the spec for removeAttribute indeed doesn't say that it
should throw a NOT_FOUND_ERR.
I wonder how many other methods near that one are similarly wrong though
(and what should happen on null nodes (impl==0)?
And to match to the spec in the header filer, isn't there a test for
impl->isReadOnly() missing, like in removeAttributeNode?).
- --
David FAURE, faure at kde.org, sponsored by TrollTech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
How to write a Makefile.am for KDE/Qt code:
http://developer.kde.org/documentation/other/makefile_am_howto.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE+i+cO72KcVAmwbhARAlRnAJ9SFYYDQ57ovtLg1ocs2IjwUVu7ywCfRKh9
b+tsWB3eXeX5BC6eVLwaLhU=
=aeh2
-----END PGP SIGNATURE-----
More information about the kfm-devel
mailing list