Skip to main content

Bug Tracker

Side navigation

#10285 closed bug (fixed)

Opened September 15, 2011 05:59PM UTC

Closed May 12, 2012 09:27PM UTC

Last modified October 22, 2012 04:15PM UTC

evalScript rcleanScript replacement fails in IE8

Reported by: Owned by:
Priority: high Milestone: 1.8
Component: ajax Version: 1.6.4rc1
Keywords: Cc:
Blocked by: Blocking:

In evalScript the use of the rcleanScript RegExp to wrap XML Comments/CDATA tags with a multiline comment fails because Internet Explorer 8 does not support the $0 backreference. This is actually correct behavior, as the ECMAScript specification explicitly states that n has a non-zero value; the $0 backreference is probably included in most implementations by convention.

'abc'.replace(/a/, '($0)'); // '($0)bc'
'abc'.replace(/a/, '($&)'); // '(a)bc'

The end result is that given an inline script:

<script language="text/javascript"><!--

the eval'd string looks like:


which bombs when it encounters the XML comment end (as the start is missing).

As a workaround you can insert a single-line comment before the end-comment tag in your inline script:

<script language="text/javascript"><!--

so your eval'd script looks like:

Attachments (0)
Change History (13)

Changed September 19, 2011 04:05PM UTC by rwaldron comment:1

owner: →
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate:

Open the link and click to "Fork" (in the top menu) to get started.

Changed September 19, 2011 04:26PM UTC by rwaldron comment:2

component: unfiledcore
priority: undecidedlow

Changed October 04, 2011 08:13AM UTC by trac-o-bot comment:3

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed May 07, 2012 01:56AM UTC by dmethvin comment:4

resolution: invalid
status: closedreopened

Changed May 07, 2012 02:54AM UTC by dmethvin comment:5

component: coreajax
milestone: None1.8
priority: lowhigh
status: reopenedopen

Here's a quick repro, you can see the error in the console:

Turns out the unit test case we have has a newline before the closing comment, which behaves differently (thanks to our old pal ASI).

Changed May 11, 2012 08:08PM UTC by dmethvin comment:6

Tracing down the problem, it seems to be cause by the commenting out of the closing HTML comment sequence. ///*-->\\n*/ gives an error but ///*-->*/ does not. It seems like we can just remove these entirely rather than commenting them out?

Changed May 11, 2012 09:57PM UTC by jaubourg comment:7

err, I fixed this one, didn't I? Or is there something I missed here?

Changed May 12, 2012 01:39AM UTC by dmethvin comment:8

I was getting an error from the commenting, not sure if it's specific to a platform but it was throwing an error in IE9. You can see it in the job here:

Removing the chars rather than commenting them out fixed the problem, but I wasn't sure if there was a reason for leaving them in but commented.

I don't know about the second error in the test there, HTML5 elements.

Changed May 12, 2012 01:41AM UTC by dmethvin comment:9

OBTW, I think the original assertion about the $0 backreference is correct, it should be $& if we're going to keep commenting this out.

Changed May 12, 2012 09:26PM UTC by jaubourg comment:10

#11402 is a duplicate of this ticket.

Changed May 12, 2012 09:27PM UTC by jaubourg comment:11

resolution: → fixed
status: openclosed

Changed May 16, 2012 06:05PM UTC by jaubourg comment:12

Fixes #10285 (for real this time).

Changeset: 7778c7722239bf5b286e4d8f2740af9abe800c09

Changed October 22, 2012 04:15PM UTC by comment:13

I'm still running into this issue. I was using 1.2.6 - with a lot of concerns about the age of the library. I updated to 1.7.2 and began getting this error (80020101). After reading, I updated to 1.8.2 (which completely locked up my opening page...) so I went to 1.8.1 and got the opening page to load, but when the AJAX call is made, I keep getting the error as I did with 1.7.2.