[HtmlUnit] SVN: [14643] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[HtmlUnit] SVN: [14643] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit

HtmlUnit - Dev mailing list
Revision: 14643
          http://sourceforge.net/p/htmlunit/code/14643
Author:   rbri
Date:     2017-07-03 18:25:12 +0000 (Mon, 03 Jul 2017)
Log Message:
-----------
ignore self when checking for label elements during bubbling

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java 2017-07-03 17:37:27 UTC (rev 14642)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java 2017-07-03 18:25:12 UTC (rev 14643)
@@ -158,7 +158,7 @@
         // then the click on the referenced element
         final HtmlElement element = getReferencedElement();
         if (element != null) {
-            response = element.click(false, false, false, false);
+            response = element.click(false, false, false, false, false, false);
         }
         else {
             response = page;

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java 2017-07-03 17:37:27 UTC (rev 14642)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java 2017-07-03 18:25:12 UTC (rev 14643)
@@ -186,9 +186,6 @@
             final boolean processLabelAfterBubbling = event.processLabelAfterBubbling();
 
             while (eventTarget != null) {
-                if (label == null && processLabelAfterBubbling && eventTarget instanceof HTMLLabelElement) {
-                    label = (HtmlLabel) eventTarget.getDomNodeOrNull();
-                }
                 final EventTarget jsNode = eventTarget;
                 final EventListenersContainer elc = jsNode.eventListenersContainer_;
                 if (elc != null && !(jsNode instanceof Window) && (isAttached || !(jsNode instanceof HTMLElement))) {
@@ -204,6 +201,12 @@
                     eventTarget = (EventTarget) domNode.getParentNode().getScriptableObject();
                 }
                 event.setEventPhase(Event.BUBBLING_PHASE);
+
+                if (eventTarget != null
+                        && label == null
+                        && processLabelAfterBubbling && eventTarget instanceof HTMLLabelElement) {
+                    label = (HtmlLabel) eventTarget.getDomNodeOrNull();
+                }
             }
 
             if (label != null) {


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop