Bug Tracker

Modify

Ticket #1559 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

Can no longer append script elements with a src attrib for an external domain.

Reported by: pmclanahan Owned by:
Priority: minor Milestone: 1.2
Component: core Version: 1.1.4
Keywords: append domManip ajax script Cc:
Blocking: Blocked by:

Description

When writing a plugin that grabs JSON feeds from external domains (del.icio.us for example) I need to be able to append a script element to the DOM. This is no longer possible due to the modifications to the domManip function in rev. 2428. This change forces jQuery to use $.ajax to get scripts which will fail for external domain requests because of browser security restrictions. It is easy to go back to pure DOM methods to append these script elements, but I believe that jQuery should be able to deal with this. The following code worked in 1.1.3, but no longer works in 1.1.4.

$('head').append($.SCRIPT({src:url,type:'text/javascript'}));

Note: The $.SCRIPT function is from Michael Geary's Easy DOM Creation plugin ( http://mg.to/2006/02/27/easy-dom-creation-for-jquery-and-prototype)

I should have a patch available for review shortly.

Attachments

jquery_domManip.patch Download (1.1 KB) - added by pmclanahan 6 years ago.
Patch against jquery.js

Change History

Changed 6 years ago by pmclanahan

Patch against jquery.js

comment:1 Changed 6 years ago by pmclanahan

I created a test case:

 http://jqueryjs.googlecode.com/svn/branches/paulm-dev/plugins/delicious/demo.html

And a patch (attached) which is tested above

comment:2 Changed 6 years ago by john

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

Fixed in jQuery 1.2 - you can now append remote scripts.

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.