why do you have <!-- comments --> instead of /* comments */ in a script?

On 5/27/07, Network Newbie <[EMAIL PROTECTED]> wrote:


When the function 'globalEval' is evaluating script source that
contains html comments (i.e. <!--), it will get 'syntax error'. html
comments should be stripped before execution.

Example:
-script source
<script language=javascript>
<!--
        //alert(typeof WebControls.registerListControl);
        alert(3);
//-->
</script>

--modifled globalEval function that fixes the issue

        globalEval: function( data ) {
                if ( window.execScript )
                        window.execScript( data.replace(/^\s*\<\!--.*$\n/gm,"")
);
                else if ( jQuery.browser.safari )
                        // safari doesn't provide a synchronous global
eval
                        window.setTimeout( data, 0 );
                else
                        eval.call( window, data );
        }




--
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ

Reply via email to