次のような HTML ページがあります。
<html>
<head>
<title>Test Page</title>
<script type="text/javascript"
src="http://svn.ckeditor.com/CKEditor/releases/latest/ckeditor_basic_source.js"></script>
<script type="text/javascript">
//@x=y
</script>
</head>
<body>
Test Page
</body>
</html>
コメント//@x=y
は IE 10 でコードとして実行され、ブラウザは次のように不平を言い'y' is undefined
ます。
次の場合、ブラウザーはエラーを停止します。
- CKEditor スクリプトを削除します
@
キャラクターを削除する<script/>
タグの順序を変更する
ここで何がうまくいかないのでしょうか?
更新:根本原因をCKEditor のcore/env.jsファイルの条件付きコンパイル ステートメントに絞り込みました。
if ( !CKEDITOR.env )
{
/**
* @namespace Environment and browser information.
*/
CKEDITOR.env = (function()
{
var agent = navigator.userAgent.toLowerCase();
var opera = window.opera;
var env =
/** @lends CKEDITOR.env */
{
/**
* Indicates that CKEditor is running on Internet Explorer.
* @type Boolean
* @example
* if ( CKEDITOR.env.ie )
* alert( "I'm on IE!" );
*/
ie : /*@cc_on!@*/false,
...
その/*@cc_on!@*/
コメントを削除すると、期待どおりにすべてが正常に機能します。