public/ckeditor/4.4dev/core/filter.js
function( transformations ) {
			if ( this.disabled )
				return;

			if ( !transformations )
				return;

			var optimized = this._.transformations,
				group, i;

			for ( i = 0; i < transformations.length; ++i ) {
				group = optimizeTransformationsGroup( transformations[ i ] );

				if ( !optimized[ group.name ] )
					optimized[ group.name ] = [];

				optimized[ group.name ].push( group.rules );
			}
		}
function( transformations ) {
			if ( this.disabled )
				return;

			if ( !transformations )
				return;

			var optimized = this._.transformations,
				group, i;

			for ( i = 0; i < transformations.length; ++i ) {
				group = optimizeTransformationsGroup( transformations[ i ] );

				if ( !optimized[ group.name ] )
					optimized[ group.name ] = [];

				optimized[ group.name ].push( group.rules );
			}
		}
function ( transformations ) { if ( this . disabled ) return ; if ( ! transformations ) return ; var optimized = this . _ . transformations , group , i ; for ( i = 0 ; i < transformations . length ; ++ i ) { group = optimizeTransformationsGroup ( transformations [ i ] ) ; if ( ! optimized [ group . name ] ) optimized [ group . name ] = [ ] ; optimized [ group . name ] . push ( group . rules ) ; } }
Adds an array of content transformation groups. One group
may contain many transformation rules, but only the first
matching rule in a group is executed.

A single transformation rule is an object with four properties:

* `check` (optional) &ndash; if set and {@link CKEDITOR.filter} does
not accept this {@link CKEDITOR.filter.contentRule}, this transformation rule
will not be executed (it does not *match*). This value is passed
to {@link #check}.
* `element` (optional) &ndash; this string property tells the filter on which
element this transformation can be run. It is optional, because
the element name can be obtained from `check` (if it is a String format)
or `left` (if it is a {@link CKEDITOR.style} instance).
* `left` (optional) &ndash; a function accepting an element or a {@link CKEDITOR.style}
instance verifying whether the transformation should be
executed on this specific element. If it returns `false` or if an element
does not match this style, this transformation rule does not *match*.
* `right` &ndash; a function accepting an element and {@link CKEDITOR.filter.transformationsTools}
or a string containing the name of the {@link CKEDITOR.filter.transformationsTools} method
that should be called on an element.

A shorthand format is also available. A transformation rule can be defined by
a single string `'check:right'`. The string before `':'` will be used as
the `check` property and the second part as the `right` property.

Transformation rules can be grouped. The filter will try to apply
the first rule in a group. If it *matches*, the filter will ignore subsequent rules and
will move to the next group. If it does not *match*, the next rule will be checked.

Examples:

editor.filter.addTransformations( [
// First group.
[
// First rule. If table{width} is allowed, it
// executes {@link CKEDITOR.filter.transformationsTools#sizeToStyle} on a table element.
'table{width}: sizeToStyle',
// Second rule should not be executed if the first was.
'table[width]: sizeToAttribute'
],
// Second group.
[
// This rule will add the foo="1" attribute to all images that
// do not have it.
{
element: 'img',
left: function( el ) {
return !el.attributes.foo;
},
right: function( el, tools ) {
el.attributes.foo = '1';
}
}
]
] );

// Case 1:
// config.allowedContent = 'table{height,width}; tr td'.
//
// '<table style="height:100px; width:200px">...</table>'		-> '<table style="height:100px; width:200px">...</table>'
// '<table height="100" width="200">...</table>'				-> '<table style="height:100px; width:200px">...</table>'

// Case 2:
// config.allowedContent = 'table[height,width]; tr td'.
//
// '<table style="height:100px; width:200px">...</table>'		-> '<table height="100" width="200">...</table>'
// '<table height="100" width="200">...</table>'				-> '<table height="100" width="200"">...</table>'

// Case 3:
// config.allowedContent = 'table{width,height}[height,width]; tr td'.
//
// '<table style="height:100px; width:200px">...</table>'		-> '<table style="height:100px; width:200px">...</table>'
// '<table height="100" width="200">...</table>'				-> '<table style="height:100px; width:200px">...</table>'
//
// Note: Both forms are allowed (size set by style and by attributes), but only
// the first transformation is applied &mdash; the size is always transformed to a style.
// This is because only the first transformation matching allowed content rules is applied.

This method is used by the editor to add {@link CKEDITOR.feature#contentTransformations}
when adding a feature by {@link #addFeature} or {@link CKEDITOR.editor#addFeature}.

@param {Array} transformations
Adds an array of content transformation groups . One group may contain many transformation rules but only the first matching rule in a group is executed .