CKEDITOR.replaceAll自定义断言函数的语法是什么?

Geo*_*ale 4 javascript assert assertions ckeditor assertion

我想有选择地避免用CKEDITOR.replaceAll替换textareas.我不能简单地使用替换.我必须使用文档中提到的自定义断言函数.

http://docs.ckeditor.com/#!/api/CKEDITOR-method-replaceAll

// Selectively replace <textarea> elements, based on custom assertions.
CKEDITOR.replaceAll( function( textarea, config ) {
    // An assertion function that needs to be evaluated for the <textarea>
    // to be replaced. It must explicitely return "false" to ignore a
    // specific <textarea>.
    // You can also customize the editor instance by having the function
    // modify the "config" parameter.
} );
Run Code Online (Sandbox Code Playgroud)

但是assert在javascript中没有.断言的语法是什么?

Geo*_*ale 6

CKEDITOR文档中使用"断言功能" 具有误导性.assert在javascript中没有.只需使用条件并return false忽略特定的textarea.

例:

CKEDITOR.replaceAll(function (textarea, config) {
    if (textarea.classList.contains("ignore_me")) {
        return false;
    };
    <...>
});
Run Code Online (Sandbox Code Playgroud)