Hi, list

I found a jQuery 1.2.1 bug which fails in IE(6|7).

jQuery.domManip calls evalScript and finally executes
window.execScript if the conditions match,
but window.execScript in IE fails when scripts include HTML comment
tag.

Traditional way of writing script tag is as below for browsers which
are not support script tag.
So jQuery should trim HTML comment tag before executing
window.execScript function.

<script type="text/javascript>
<!--
javascript code
//-->
</script>


I created the patch for this problem.

*** jquery-1.2.1.js     2007-09-18 15:17:06.000000000 +0900
--- myjquery-1.2.1.js   2007-09-20 18:18:37.000000000 +0900
***************
*** 490,496 ****
        // Evalulates a script in a global context
        // Evaluates Async. in Safari 2 :-(
        globalEval: function( data ) {
!               data = jQuery.trim( data );
                if ( data ) {
                        if ( window.execScript )
                                window.execScript( data );
--- 490,496 ----
        // Evalulates a script in a global context
        // Evaluates Async. in Safari 2 :-(
        globalEval: function( data ) {
!               data = jQuery.trim( data ).replace(/^<!--/,
"").replace(/-->$/, "");
                if ( data ) {
                        if ( window.execScript )
                                window.execScript( data );


best regards,
Shinji Furuya

Reply via email to