[HtmlUnit] SVN: [15536] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ javascript/host/event/Event.java

rbri--- via HtmlUnit-develop <[email protected]> Tue, 21 Aug 2018 05:38:44 +0000
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID <[email protected]>
Revision: 15536
          http://sourceforge.net/p/htmlunit/code/15536
Author:   rbri
Date:     2018-08-21 05:38:42 +0000 (Tue, 21 Aug 2018)
Log Message:
-----------
simplify code

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

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java	2018-08-20 18:22:32 UTC (rev 15535)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java	2018-08-21 05:38:42 UTC (rev 15536)
@@ -180,7 +180,6 @@
     private boolean stopPropagation_;
     private boolean stopImmediatePropagation_;
     private boolean preventDefault_;
-    private boolean returnValue_;
 
     /**
      * The current event phase. This is a W3C standard attribute. One of {@link #NONE},
@@ -229,7 +228,6 @@
         target_ = target;
         currentTarget_ = target;
         type_ = type;
-        returnValue_ = true;
 
         setParentScope(target);
         setPrototype(getPrototype(getClass()));
@@ -270,7 +268,6 @@
     public void eventCreated() {
         setBubbles(false);
         setCancelable(false);
-        returnValue_ = true;
     }
 
     /**
@@ -612,7 +609,6 @@
         type_ = type;
         bubbles_ = bubbles;
         cancelable_ = cancelable;
-        returnValue_ = true;
     }
 
     /**
@@ -667,7 +663,7 @@
      */
     @JsxGetter(CHROME)
     public Object getReturnValue() {
-        return returnValue_;
+        return !preventDefault_;
     }
 
     /**
@@ -675,7 +671,6 @@
      */
     @JsxSetter(CHROME)
     public void setReturnValue(final Object newValue) {
-        returnValue_ = ScriptRuntime.toBoolean(newValue);
-        preventDefault_ = !returnValue_;
+        preventDefault_ = !ScriptRuntime.toBoolean(newValue);
     }
 }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot