public/ckeditor/4.4dev/core/filter.js
function( test, applyTransformations, strictCheck ) {
			if ( this.disabled )
				return true;

			// If rules are an array, expand it and return the logical OR value of
			// the rules.
			if ( CKEDITOR.tools.isArray( test ) ) {
				for ( var i = test.length ; i-- ; ) {
					if ( this.check( test[ i ], applyTransformations, strictCheck ) )
						return true;
				}
				return false;
			}

			var element, result, cacheKey;

			if ( typeof test == 'string' ) {
				cacheKey = test + '<' + ( applyTransformations === false ? '0' : '1' ) + ( strictCheck ? '1' : '0' ) + '>';

				// Check if result of this check hasn't been already cached.
				if ( cacheKey in this._.cachedChecks )
					return this._.cachedChecks[ cacheKey ];

				// Create test element from string.
				element = mockElementFromString( test );
			} else {
				// Create test element from CKEDITOR.style.
				element = mockElementFromStyle( test );
			}

			// Make a deep copy.
			var clone = CKEDITOR.tools.clone( element ),
				toBeRemoved = [],
				transformations;

			// Apply transformations to original element.
			// Transformations will be applied to clone by the filter function.
			if ( applyTransformations !== false && ( transformations = this._.transformations[ element.name ] ) ) {
				for ( i = 0; i < transformations.length; ++i )
					applyTransformationsGroup( this, element, transformations[ i ] );

				// Transformations could modify styles or classes, so they need to be copied
				// to attributes object.
				updateAttributes( element );
			}

			// Filter clone of mocked element.
			processElement( this, clone, toBeRemoved, {
				doFilter: true,
				doTransform: applyTransformations !== false,
				skipRequired: !strictCheck,
				skipFinalValidation: !strictCheck
			} );

			// Element has been marked for removal.
			if ( toBeRemoved.length > 0 ) {
				result = false;
			// Compare only left to right, because clone may be only trimmed version of original element.
			} else if ( !CKEDITOR.tools.objectCompare( element.attributes, clone.attributes, true ) ) {
				result = false;
			} else {
				result = true;
			}

			// Cache result of this test - we can build cache only for string tests.
			if ( typeof test == 'string' )
				this._.cachedChecks[ cacheKey ] = result;

			return result;
		}
function( test, applyTransformations, strictCheck ) {
			if ( this.disabled )
				return true;

			// If rules are an array, expand it and return the logical OR value of
			// the rules.
			if ( CKEDITOR.tools.isArray( test ) ) {
				for ( var i = test.length ; i-- ; ) {
					if ( this.check( test[ i ], applyTransformations, strictCheck ) )
						return true;
				}
				return false;
			}

			var element, result, cacheKey;

			if ( typeof test == 'string' ) {
				cacheKey = test + '<' + ( applyTransformations === false ? '0' : '1' ) + ( strictCheck ? '1' : '0' ) + '>';

				// Check if result of this check hasn't been already cached.
				if ( cacheKey in this._.cachedChecks )
					return this._.cachedChecks[ cacheKey ];

				// Create test element from string.
				element = mockElementFromString( test );
			} else {
				// Create test element from CKEDITOR.style.
				element = mockElementFromStyle( test );
			}

			// Make a deep copy.
			var clone = CKEDITOR.tools.clone( element ),
				toBeRemoved = [],
				transformations;

			// Apply transformations to original element.
			// Transformations will be applied to clone by the filter function.
			if ( applyTransformations !== false && ( transformations = this._.transformations[ element.name ] ) ) {
				for ( i = 0; i < transformations.length; ++i )
					applyTransformationsGroup( this, element, transformations[ i ] );

				// Transformations could modify styles or classes, so they need to be copied
				// to attributes object.
				updateAttributes( element );
			}

			// Filter clone of mocked element.
			processElement( this, clone, toBeRemoved, {
				doFilter: true,
				doTransform: applyTransformations !== false,
				skipRequired: !strictCheck,
				skipFinalValidation: !strictCheck
			} );

			// Element has been marked for removal.
			if ( toBeRemoved.length > 0 ) {
				result = false;
			// Compare only left to right, because clone may be only trimmed version of original element.
			} else if ( !CKEDITOR.tools.objectCompare( element.attributes, clone.attributes, true ) ) {
				result = false;
			} else {
				result = true;
			}

			// Cache result of this test - we can build cache only for string tests.
			if ( typeof test == 'string' )
				this._.cachedChecks[ cacheKey ] = result;

			return result;
		}
function ( test , applyTransformations , strictCheck ) { if ( this . disabled ) return true ; // If rules are an array, expand it and return the logical OR value of // the rules. if ( CKEDITOR . tools . isArray ( test ) ) { for ( var i = test . length ; i -- ; ) { if ( this . check ( test [ i ] , applyTransformations , strictCheck ) ) return true ; } return false ; } var element , result , cacheKey ; if ( typeof test == 'string' ) { cacheKey = test + '<' + ( applyTransformations === false ? '0' : '1' ) + ( strictCheck ? '1' : '0' ) + '>' ; // Check if result of this check hasn't been already cached. if ( cacheKey in this . _ . cachedChecks ) return this . _ . cachedChecks [ cacheKey ] ; // Create test element from string. element = mockElementFromString ( test ) ; } else { // Create test element from CKEDITOR.style. element = mockElementFromStyle ( test ) ; } // Make a deep copy. var clone = CKEDITOR . tools . clone ( element ) , toBeRemoved = [ ] , transformations ; // Apply transformations to original element. // Transformations will be applied to clone by the filter function. if ( applyTransformations !== false && ( transformations = this . _ . transformations [ element . name ] ) ) { for ( i = 0 ; i < transformations . length ; ++ i ) applyTransformationsGroup ( this , element , transformations [ i ] ) ; // Transformations could modify styles or classes, so they need to be copied // to attributes object. updateAttributes ( element ) ; } // Filter clone of mocked element. processElement ( this , clone , toBeRemoved , { doFilter : true , doTransform : applyTransformations !== false , skipRequired : ! strictCheck , skipFinalValidation : ! strictCheck } ) ; // Element has been marked for removal. if ( toBeRemoved . length > 0 ) { result = false ; // Compare only left to right, because clone may be only trimmed version of original element. } else if ( ! CKEDITOR . tools . objectCompare ( element . attributes , clone . attributes , true ) ) { result = false ; } else { result = true ; } // Cache result of this test - we can build cache only for string tests. if ( typeof test == 'string' ) this . _ . cachedChecks [ cacheKey ] = result ; return result ; }
Checks whether the content defined in the `test` argument is allowed
by this filter.

If `strictCheck` is set to `false` (default value), this method checks
if all parts of the `test` (styles, attributes, and classes) are
accepted by the filter. If `strictCheck` is set to `true`, the test
must also contain the required attributes, styles, and classes.

For example:

// Rule: 'img[!src,alt]'.
filter.check( 'img[alt]' ); // -> true
filter.check( 'img[alt]', true, true ); // -> false

Second `check()` call returned `false` because `src` is required.

**Note:** The `test` argument is of {@link CKEDITOR.filter.contentRule} type, which is
a limited version of {@link CKEDITOR.filter.allowedContentRules}. Read more about it
in the {@link CKEDITOR.filter.contentRule}'s documentation.

@param {CKEDITOR.filter.contentRule} test
@param {Boolean} [applyTransformations=true] Whether to use registered transformations.
@param {Boolean} [strictCheck] Whether the filter should check if an element with exactly
these properties is allowed.
@returns {Boolean} Returns `true` if the content is allowed.
Checks whether the content defined in the test argument is allowed by this filter .