Bug 29533 - Dynamically loaded scripts
Summary: Dynamically loaded scripts
Status: RESOLVED DUPLICATE of bug 25130
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2009-09-20 18:21 PDT by chameleon
Modified: 2009-09-22 09:44 PDT (History)
1 user (show)

See Also:

php test file (1.48 KB, text/plain)
2009-09-22 05:35 PDT, chameleon
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description chameleon 2009-09-20 18:21:07 PDT
I have AJAX loaded XHTML with javascripts:
- 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.

As action on events ( <a href="" onclick="alert(5); return false;">whow!</a> ) doesn't work at all. Work fine on Firefox / Opera.
Comment 1 Alexey Proskuryakov 2009-09-21 17:45:58 PDT
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.
Comment 2 chameleon 2009-09-22 05:35:53 PDT
Created attachment 39915 [details]
php test file
Comment 3 chameleon 2009-09-22 05:43:55 PDT
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>

The correct:
Throws an alert with text 'you just clicked!' and return to page without reloading.

PS: I am impressed from fast response.
Comment 4 Alexey Proskuryakov 2009-09-22 09:44:31 PDT
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 ***