Bug Tracker

Modify

Ticket #858 (closed bug: duplicate)

Opened 6 years ago

Last modified 6 years ago

evalScripts() execute javascript twice with inline script from ajax data in Firefox

Reported by: Lasiaf Owned by:
Priority: minor Milestone: 1.1.3
Component: ajax Version: 1.1
Keywords: evalscripts ajax script firefox execute Cc:
Blocking: Blocked by:

Description (last modified by joern) (diff)

Whe I try to load an external page with an inline script, firefox evaluates the script but IE dont. so my solution is put evalScripts() at the appended data, the it works in IE but it executes twice in firefox. Sample Code

		$.post("getsomething.php",{test:1},
			function(data){
				$("#mainPane").append(data).evalScripts();
			}
		)

getsomething.php

IMPORTANT DATA TO BE APPENDED
<script> 
alert("Hello World"); 
$("#txt1").val("NEW VAR DATA");
</script>

---

Whats happening is Firefox is evaluating the new appended data then evaluates it again using evalScripts()

is there a way to call evalScripts in $.html $.append when I use it in IE and if its firefox not to call evalScripts()

Change History

comment:1 Changed 6 years ago by joern

  • Version set to 1.1
  • Description modified (diff)
  • Milestone set to 1.1

A rather ugly workaround would be a manuel append using html. It's still unclear why append evaluate scripts at all, that behaviour was introduced in some of the later jQuery versions.

comment:2 Changed 6 years ago by Lasiaf

So if I use the old versions it should just work fine?

comment:3 Changed 6 years ago by brandon

This is related to #975

comment:4 Changed 6 years ago by john

  • Status changed from new to closed
  • Resolution set to duplicate

We're going to discuss this bug in #975. Closing this ticket.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.