CKEDITOR.htmlParser.filter
class
Filter is a configurable tool for transforming and filtering nodes. It is mainly used during data processing phase which is done not on real DOM nodes, but on their simplified form represented by CKEDITOR.htmlParser.node class and its subclasses.
var filter = new CKEDITOR.htmlParser.filter( {
text: function( value ) {
return '@' + value + '@';
},
elements: {
p: function( element ) {
element.attributes.foo = '1';
}
}
} );
var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<p>Foo<b>bar!</b></p>' ),
writer = new CKEDITOR.htmlParser.basicWriter();
filter.applyTo( fragment );
fragment.writeHtml( writer );
writer.getHtml(); // '<p foo="1">@Foo@<b>@bar!@</b></p>'
Filtering
Properties
-
Rules for attribute names.
-
-
Rules for comment nodes.
-
Rules for element names.
-
-
ID of filter instance, which is used to mark elements to which this filter has been already applied.
-
Rules for a root node.
-
Rules for text nodes.
Methods
-
constructor( [ rules ] ) → filter
CKEDITOR.htmlParser.filter#constructor
Creates a filter class instance.
Parameters
[ rules ] : filterRulesDefinition
Returns
filter
-
addRules( rules, [ options ] )
CKEDITOR.htmlParser.filter#addRules
Add rules to this filter.
Parameters
rules : filterRulesDefinition
Object containing filter rules.
[ options ] : Object | Number
Object containing rules' options or a priority (for a backward compatibility with CKEditor versions up to 4.2.x).
-
applyTo( node )
CKEDITOR.htmlParser.filter#applyTo