Skip to main content

Bug Tracker

Side navigation

#6400 closed bug (worksforme)

Opened April 06, 2010 09:08AM UTC

Closed July 12, 2011 02:51PM UTC

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"

Attachments (0)
Change History (6)

Changed October 01, 2010 02:38AM UTC by addyosmani comment:1

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.

Changed October 21, 2010 01:34AM UTC by addyosmani comment:2

status: newopen

Changed October 21, 2010 01:36AM UTC by addyosmani comment:3

milestone: 1.4.31.4.4

Changed October 21, 2010 10:57PM UTC by snover comment:4

milestone: 1.4.41.4.5

Retargeting due to severity of regressions in 1.4.3.

Changed December 27, 2010 10:37PM UTC by rwaldron comment:5

keywords: ajax script errorajax,script,error,ajaxrewrite

Changed July 12, 2011 02:51PM UTC by john comment:6

resolution: → worksforme
status: openclosed

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