#10285 closed bug (fixed)
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: |
Description
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"><!-- ... --></script>
the eval'd string looks like:
/*$0*/ ... -->
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"><!-- ... //--></script>
so your eval'd script looks like:
/*$0*/ ... //-->
Change History (13)
comment:1 Changed 12 years ago by
Owner: | set to james.h.cracknell@… |
---|---|
Status: | new → pending |
comment:2 Changed 12 years ago by
Component: | unfiled → core |
---|---|
Priority: | undecided → low |
comment:3 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
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!
comment:4 Changed 11 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:5 Changed 11 years ago by
Component: | core → ajax |
---|---|
Milestone: | None → 1.8 |
Priority: | low → high |
Status: | reopened → open |
Here's a quick repro, you can see the error in the console: http://jsfiddle.net/dmethvin/aBy3L/
Turns out the unit test case we have has a newline before the closing comment, which behaves differently (thanks to our old pal ASI).
comment:6 Changed 11 years ago by
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?
comment:7 Changed 11 years ago by
err, I fixed this one, didn't I? Or is there something I missed here?
comment:8 Changed 11 years ago by
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:
http://swarm.jquery.org/job/77
http://swarm.jquery.org/index.php?action=runresults&run_id=938&client_id=5584
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.
comment:9 Changed 11 years ago by
OBTW, I think the original assertion about the $0
backreference is correct, it should be $&
if we're going to keep commenting this out.
comment:11 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
comment:12 Changed 11 years ago by
Fixes #10285 (for real this time).
Changeset: 7778c7722239bf5b286e4d8f2740af9abe800c09
comment:13 Changed 11 years ago by
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.
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: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.