Bug Tracker

Ticket #777 (closed bug: fixed)

Opened 2 years ago

Last modified 1 year ago

evalScripts() runs embed js befor previous external code

Reported by: butterbrot Assigned to: john
Type: bug Priority: minor
Milestone: 1.1.4 Component: ajax
Version: 1.1.3 Keywords: eval external javascript order
Cc: Needs: Review

Description (last modified by john) (diff)

<script type="text/javascript" src="alert_hello.js"></script>

<script type="text/javascript">

alert("I dont know any 'alert_hello.js' function");

</script>

ALERT[I dont know any 'alert_hello.js] ALERT[Hello]

none-optional-solution:

evalScripts: function() {

var rv = function(html,rv){

if ( this.src ) { // for some weird reason, it doesn't work if the callback is ommited

jQuery.getScript( this.src , function(source) {

html.find('script:first').remove().end(); html.find('script').each(rv,[html,rv]).end();

}); return false;

} else {

jQuery.globalEval( this.text this.textContent this.innerHTML "" );

}

} return this.find('script').each(rv,[this,rv]).end();

}

Attachments

Change History

Changed 2 years ago by john

  • priority changed from trivial to minor
  • version deleted
  • milestone deleted

Changed 1 year ago by john

  • need set to Review
  • owner set to john
  • version set to 1.1.3
  • description changed from <script type="text/javascript" src="alert_hello.js"></script> <script type="text/javascript"> alert("I dont know any 'alert_hello.js' function"); </script> ALERT[I dont know any 'alert_hello.js] ALERT[Hello] none-optional-solution: evalScripts: function() { var rv = function(html,rv){ if ( this.src ) { // for some weird reason, it doesn't work if the callback is ommited jQuery.getScript( this.src , function(source) { html.find('script:first').remove().end(); html.find('script').each(rv,[html,rv]).end(); }); return false; } else { jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" ); } } return this.find('script').each(rv,[this,rv]).end(); } to <script type="text/javascript" src="alert_hello.js"></script> <script type="text/javascript"> alert("I dont know any 'alert_hello.js' function"); </script> ALERT[I dont know any 'alert_hello.js] ALERT[Hello] none-optional-solution: evalScripts: function() { var rv = function(html,rv){ if ( this.src ) { // for some weird reason, it doesn't work if the callback is ommited jQuery.getScript( this.src , function(source) { html.find('script:first').remove().end(); html.find('script').each(rv,[html,rv]).end(); }); return false; } else { jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" ); } } return this.find('script').each(rv,[this,rv]).end(); }
  • milestone set to 1.1.4

Changed 1 year ago by john

  • status changed from new to closed
  • resolution set to fixed

Fixed in SVN rev [2428].

Note: See TracTickets for help on using tickets.