Side navigation
#1833 closed bug (invalid)
Opened October 22, 2007 03:47PM UTC
Closed November 30, 2007 03:34AM UTC
evaluated script fails with IE if enclosed by an HTML comment
Reported by: | rformato | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | ajax | Version: | 1.2.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If a script enclosed by an HTML comment is present in a fragment of HTML loaded by ajax of injected in any other way (ie. html(), etc ),
IE fails to evaluate it.
The problem is the staring line <!-- of the text inside the script tag.
Here is a simple patch to fix the bug.
globalEval: function( data ) { data = jQuery.trim( data ); if ( data ) { if ( window.execScript ) - window.execScript( data ); + window.execScript( data.replace(/^<!--.*/,"") ); else if ( jQuery.browser.safari ) // safari doesn't provide a synchronous global eval window.setTimeout( data, 0 ); else eval.call( window, data ); } }
Attachments (0)
Change History (3)
Changed October 22, 2007 03:52PM UTC by comment:1
Changed November 28, 2007 08:31AM UTC by comment:2
Do you have a specific test case of this problem? From what I can tell by the description, you are saying a script that is in an html comment doesn't get evaluated. Isn't that the expected behaviour?
Changed November 30, 2007 03:34AM UTC by comment:3
need: | Review → Test Case |
---|---|
resolution: | → invalid |
status: | new → closed |
Looking in to it more, there is a completely different global eval function in SVN (rewritten to fix Safari problems). I'm still not sure what the bug was here. Looking at the patch though this bug no longer makes sense so I'm going to mark it as invalid (since we really didn't fix anything to do with this bug). The new globalEval function creates a <script> tag so any HTML comments would be invalid javascript.
It is quite possible I'm missing the key point so I'd love to see a test case showing the problem. If one is available please reopen the bug with the test case so I can see what's going on.
Thanks.
Sorry, there are some typos in the ticket:
If a script enclosed by an HTML comment is present in a fragment of HTML loaded by ajax or injected in any other way (ie. html(), etc ), IE fails to evaluate it.
The problem is the starting line <!-- of the text inside the script tag.