- External, as <script src="..." />
- Internal, as <script>alert(1);</script>
- As action on events: <a href="" onclick="alert(5); return false;">whow!</a>
On external ( <script src="..." /> ) I must create a <script> element and append on <head> element. This is a workaround needed on Firefox too, but not on Opera.
On internal ( <script>alert(1);</script> ) I must run eval(script.text); . This is a workaround needed on Firefox too, but not on Opera.
THE REAL PROBLEM:
As action on events ( <a href="" onclick="alert(5); return false;">whow!</a> ) doesn't work at all. Work fine on Firefox / Opera.
What browser are you seeing this problem with? If you're running Safari, could you please try running it with a nightly WebKit build from <http://nightly.webkit.org>?
If you'll still see a problem with a nightly, please provide a test case.
Created attachment 39915 [details]
php test file
I test it both with Safari and nightly WebKit. The same activity.
I provide a php file which reproduce the bug. No other files needed.
Open it with browser and after loading and clicking the alerts, click the link.
It will reload the page, but the link is:
<a href="" onclick="alert('you just clicked!'); return false;">click me! click me now!</a>
Throws an alert with text 'you just clicked!' and return to page without reloading.
PS: I am impressed from fast response.
Thank you! This is pretty much the same as bug 25130, which talks about cloneContents() - so it is useful to know that cloneNode() is affected, too.
The bugs will likely have a common fix, so I'm resolving this one as a duplicate.
*** This bug has been marked as a duplicate of bug 25130 ***