Bug Tracker

Opened 10 years ago

Closed 8 years ago

#6400 closed bug (worksforme)

script error with ajax call not shown

Reported by: paztaga Owned by:
Priority: low Milestone: 1.next
Component: ajax Version: 1.4.2
Keywords: ajax, script, error, ajaxrewrite Cc:
Blocked by: Blocking:

Description

with jquery 1.4.2, script errors in ajax result is not shown in firebug.

using: -firefox 3.6.3 -firebug 1.5.3

exemple: MAIN FILE:

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="title" content="connect" /> <meta name="language" content="fr" /> <meta name="robots" content="index, follow" />

<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script>

</head> <body>

<script type="text/javascript"> $(function() {

$('body').load('test.html');

}); </script> </body>

</html>

END OF MAIN FILE

TEST.HTML FILE

<div id="xx">

coucou

</div>

<script type="text/javascript">

var x = 1; x.func();

</script> END OF TEST.HTML

As x.func is not function, firebug should display an error and it doesn't.

If you use jquery 1.3.2 instead, firebug display error:

"x.func is not a function"

Change History (6)

comment:1 Changed 9 years ago by addyosmani

need: ReviewPatch
Priority: low

I've tested out your code in FireFox and you're correct in saying that the script tags aren't being executed. This is the reason you're not receiving any logged output via the Firebug console.

jQuery's load() function is a shorthand version of .ajax() which simplifies you haven't to write out the entire request yourself.

Taking a look under the bonnet of load(), it would appear that on success, between lines 4833 and 4835 we're actually stripping any of the script tags found in order to avoid a permission denied issue in IE.

If possible I would recommend we review this functionality in the future to establish whether there is an argument for casing the script strip specifically to IE or finding a generic fix.

There may be arguments against the former, as a consistent experience across all browsers is likely desirable.

comment:2 Changed 9 years ago by addyosmani

Status: newopen

comment:3 Changed 9 years ago by addyosmani

Milestone: 1.4.31.4.4

comment:4 Changed 9 years ago by snover

Milestone: 1.4.41.4.5

Retargeting due to severity of regressions in 1.4.3.

comment:5 Changed 9 years ago by Rick Waldron

Keywords: ajaxrewrite added

comment:6 Changed 8 years ago by john

Resolution: worksforme
Status: openclosed

I'm fairly certain that this is working in jQuery 1.5+ now.

Note: See TracTickets for help on using tickets.