AW: <label> bug

Tobias Anton tobias at ke.informatik.tu-darmstadt.de
Sat Jun 10 13:50:54 BST 2006


Unhandled click events should bubble to their parents. This does not look
like the correct fix, because you use recursion for bubbling, although the
default event handler routine in dom_nodeimpl.cpp already contains an
iterative procedure for bubbling events through the DOM tree.

Tobias

-----Ursprüngliche Nachricht-----
Von: George Staikos [mailto:staikos at kde.org] 
Gesendet: Mittwoch, 7. Juni 2006 20:14
An: kfm-devel at kde.org
Betreff: <label> bug


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