Quantcast

[ htmlunit-Bugs-1285430 ] onClickAction should only be called when onclick return true

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

[ htmlunit-Bugs-1285430 ] onClickAction should only be called when onclick return true

SourceForge.net
Bugs item #1285430, was opened at 2005-09-09 00:22
Message generated for change (Comment added) made by mguillem
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1285430&group_id=47038

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: Latest code in CVS
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: mkillow (mkillow)
>Assigned to: Marc Guillemot (mguillem)
Summary: onClickAction should only be called when onclick return true

Initial Comment:
Line 112 of ClickableElement.java is currently this :

if( stateUpdated || scriptResult.getJavaScriptResult
().equals( Boolean.FALSE ) ) {

Which is essentially saying that if the javascript result
is anything other than Boolean.FALSE call  
doClickAction() .  So this means if the onclick handler
returns undefined, or something other than
Boolean.FALSE we will call doClickAction().  Now If you
refer to the comments for doClickAction() they state
that if there is an onclick handler doClickAction() will
only be called if the javascript result is TRUE.  I propose
to change line 112 to :

if( stateUpdated || !scriptResult.getJavaScriptResult
().equals( Boolean.TRUE ) ) {

which will mean that we only call doClickAction() when
the javascript explicitly returns TRUE.  This is the same
behaviour as seen in IE and FireFox.

----------------------------------------------------------------------

>Comment By: Marc Guillemot (mguillem)
Date: 2005-10-12 18:59

Message:
Logged In: YES
user_id=402164

Testing with a simple link:

<html><head><title>foo</title></head><body>
<a href="foo.html" onclick="return false">link</a>
</body></html>

and different return values (true, false, 0, 1, "foo") I
think that htmlunit behaves exactly like firefox and IE and
that the only problem was an incorrect javadoc (which is now
fixed).

Please reopen if you can provide an example.

----------------------------------------------------------------------

Comment By: Rodney Gitzel (rgitzel)
Date: 2005-09-30 22:34

Message:
Logged In: YES
user_id=148993

This same fix seems to also correct a related problem I
recorded in bug #1306033.

----------------------------------------------------------------------

Comment By: Marc Guillemot (mguillem)
Date: 2005-09-12 10:14

Message:
Logged In: YES
user_id=402164

Can you provide a unit test for the expected behavior?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1285430&group_id=47038


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
Loading...