次の方法:すべてのブラウザでsetTimeout(f、0)と等価ですか?クロスブラウザの問題を解決するのはなぜですか?
Init: function (selector, settings)
{
setTimeout(function()
{
var s =
{
width: '100%',
script_url: '/Content/Scripts/tiny_mce/tiny_mce.js',
theme: "advanced",
plugins: "autolink,lists,pagebreak,style,layer,table,paste,directionality,noneditable,visualchars,xhtmlxtras,template",
theme_advanced_buttons1: "fontselect,fontsizeselect,|,bold,italic,underline,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_buttons4: "",
theme_advanced_more_colors: false,
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "none",
theme_advanced_resizing: false,
convert_urls: !!$(selector).data("richEditor-ConvertUrls") // by default we don't convert urls
};
$.extend(s, settings);
$(selector).tinymce(s);
},0);
}
作品、何らかの理由で 、私はFirefox用setTimeout(f,0)
呼び出しを必要とする、この方法は、エディタがハング、この呼び出しなしで、MVCのAJAX部分負荷で呼び出されますfirefoxとページブレーク(ほとんどの場合、例外の結果をクリックすると結果が出る)。コールでは、すべてが完璧に動作します。
私はこのsetTimeoutコール(他の回避策を通して)を避ける方法を知りましたが、それがオプションではない場合、私はその理由を知りたいと思います。
私はこのケースでは最もクリーンな解決策ではないかもしれないと怖いです。
あなたのAjaxコールバックはあなたのページを内容で更新しますか?これは、DOMが更新される前に発生している可能性があります。その場合、jQuerys readyイベントを使用してDOMが '$(セレクタ)'にtinymceを適用する前に終了するのを待つことができると思います。 – JesseBuesking
DOMを更新しますが、これは '$(f(){});' – bevacqua
でも実行されます。タイムアウトの中に 's'を宣言している理由はありますか?それをここに掲示する)。また、jsfiddleでこの問題を再現する方法もありますか?それは私が試して助けてくれるようにするだろう。 – JesseBuesking