用于RapidSpell的CKEditor自定义插件在IE 8上抛出错误



我使用以下代码为 RapidSpell 创建了一个自定义插件。

CKEDITOR.plugins.add('spell',
    {
        init: function (editor) {
            editor.addCommand('spell', {
                exec: function (editor) {
                    rapidSpell.ayt_aytEnabled = false;
                    spell('cke_contents_Model_NoteText', 'dialog');
                }
            });
            editor.ui.addButton('spell', {
                label: 'Spell Check',
                command: 'spell',
                icon: this.path + 'icons/spell.png'
            });
        }
});
function spell(id, mode) {
    var ifr = document.getElementsByClassName('cke_wysiwyg_frame cke_reset')[0];
    ifr.setAttribute('id', id + '_ifr');
    ifr.id = id + '_ifr';
    if (mode == 'dialog')
        rapidSpell.dialog_spellCheck(true, ifr.id);
    else
        rapidSpell.ayt_spellCheck(ifr.id);
}

它在IE 9中工作正常,但在IE 8中抛出Javascript错误。我正在使用CKEditor 4,它也与IE8兼容。所以我想知道问题出在哪里。

消息:对象不支持此属性或方法 行: 21 字符: 5 代码: 0 URI:https://btsdebasctk01.wrbts.ads.wrberkley.com/Library/Scripts/ckeditor4/plugins/inlinespell/plugin.js?t=E0LB

IE9 中添加了对getElementsByClassName函数的支持。

如果不需要支持 IE8 之前的任何内容,请改用 querySelectorAll

如果您需要支持 IE7 或更早版本,请使用像这样的 polyfill,或者支持此功能的库,如 jQuery。

相关内容

最新更新