<label> bug

George Staikos staikos at kde.org
Wed Jun 7 19:13:30 BST 2006


An ugly site issue I ran into involves this, which does not presently behave 
as expected with KHTML;

<a href="javascript:window.alert('hi');"><label><img 
src="testlabel.gif"/></label></a>

It should alert, and does with firefox and IE, but does not with KHTML.  The 
following patch fixes it, though I'm not sure it's really the best thing to 
do.  Any comments?

Index: html_formimpl.cpp
===================================================================
--- html_formimpl.cpp   (revision 538568)
+++ html_formimpl.cpp   (working copy)
@@ -1916,6 +1916,12 @@
                getDocument()->setFocusNode(formNode);
                if (formNode->id()==ID_INPUT)
                    
static_cast<DOM::HTMLInputElementImpl*>(formNode)->click();
+           } else {
+               NodeImpl* const p = parentNode();
+               if (p) {
+                   p->defaultEventHandler(evt);
+                   return;
+               }
            }
            evt->setDefaultHandled();
        }


-- 
George Staikos 





More information about the kfm-devel mailing list