[ htmlunit-Bugs-1260369 ] can't set current node property inside onclick

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

[ htmlunit-Bugs-1260369 ] can't set current node property inside onclick

SourceForge.net
Bugs item #1260369, was opened at 2005-08-16 00:38
Message generated for change (Settings changed) made by mguillem
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1260369&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: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Brad Clarke (yourgod)
>Assigned to: Marc Guillemot (mguillem)
Summary: can't set current node property inside onclick

Initial Comment:
There are various little problems with setting event
handlers but this one is more than I can do to fix.
Doing an "alert(onclick)" instead of the "alert('foo')"
returns the correct text but trying to set onclick
never seems to make it's way back into htmlunit's code.



Index: ClickableElementTest.java
===================================================================
RCS file:
/cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/ClickableElementTest.java,v
retrieving revision 1.13
diff -u -r1.13 ClickableElementTest.java
--- ClickableElementTest.java 26 Mar 2005 02:13:44
-0000 1.13
+++ ClickableElementTest.java 15 Aug 2005 22:35:38 -0000
@@ -963,4 +963,16 @@
     public void testVariable_onClick() throws Exception {
         onClickSimpleTest("var");
     }
+    
+    /**
+     * Test setting onClick handler from inside the
onClick handler
+     *
+     * @throws Exception if the test fails
+     */
+    public void testSetOnClick() throws Exception {
+        final List expectedAlerts = Arrays.asList(new
String[] {"foo"});
+        onClickPageTest("<body><form>" +
+                "<button type='button' id='clickId'
onclick='alert(\foo\); onclick==\\;'>Item</button>" +
+                "</form></body>", 2, expectedAlerts);
+    }    
 }


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

>Comment By: Marc Guillemot (mguillem)
Date: 2005-10-12 17:36

Message:
Logged In: YES
user_id=402164

Now fixed in CVS.

I've changed your test to set the onclick to null rather
that "" which is not currently working but this is a
different issue.

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

Comment By: Marc Guillemot (mguillem)
Date: 2005-08-16 16:14

Message:
Logged In: YES
user_id=402164

I think that I've found the problem. Rhino is ok but our
SimpleScriptable is wrong: it should override has(String,
Scriptable).

It has taken me a (too) long time to find the cause of the
problem and I can't do anything further on it right now.

Overriding has(String, Scriptable) would fix this special
issue. I don't know if we need to override has(int,
Scriptable) or other methods like delete(...) or getIds().
I'm still convinced, that we should configure all our
properties/functions directly in Rhino and override get and
put only for some special cases. This would avoid problems
like this one.

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

Comment By: Marc Guillemot (mguillem)
Date: 2005-08-16 09:44

Message:
Logged In: YES
user_id=402164

Can you add your test as notYetImplemented? (with "="
instead of "==")

I guess that it is a bug in Rhino. If I change the onclick
code to "alert(id); id=\foo\;" the id is first correctly
"alerted" but then not correctly changed.
I will try to generate a simple test case for the Rhino guys
(not sure when I find time for it).

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1260369&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