public/ckeditor/4.4dev/core/filter.js
function updateElement( element, status ) {
		var validAttrs = status.validAttributes,
			validStyles = status.validStyles,
			validClasses = status.validClasses,
			attrs = element.attributes,
			styles = element.styles,
			classes = element.classes,
			origClasses = element.classBackup,
			origStyles = element.styleBackup,
			name, origName, i,
			stylesArr = [],
			classesArr = [],
			internalAttr = /^data-cke-/,
			isModified = false;

		// Will be recreated later if any of styles/classes were passed.
		delete attrs.style;
		delete attrs[ 'class' ];
		// Clean up.
		delete element.classBackup;
		delete element.styleBackup;

		if ( !status.allAttributes ) {
			for ( name in attrs ) {
				// If not valid and not internal attribute delete it.
				if ( !validAttrs[ name ] ) {
					// Allow all internal attibutes...
					if ( internalAttr.test( name ) ) {
						// ... unless this is a saved attribute and the original one isn't allowed.
						if ( name != ( origName = name.replace( /^data-cke-saved-/, '' ) ) &&
							!validAttrs[ origName ]
						) {
							delete attrs[ name ];
							isModified = true;
						}
					} else {
						delete attrs[ name ];
						isModified = true;
					}
				}

			}
		}

		if ( !status.allStyles || status.hadInvalidStyle ) {
			for ( name in styles ) {
				// We check status.allStyles because when there was a '*' ACR and some
				// DACR we have now both properties true - status.allStyles and status.hadInvalidStyle.
				// However unlike in the case when we only have '*' ACR, in which we can just copy original
				// styles, in this case we must copy only those styles which were not removed by DACRs.
				if ( status.allStyles || validStyles[ name ] )
					stylesArr.push( name + ':' + styles[ name ] );
				else
					isModified = true;
			}
			if ( stylesArr.length )
				attrs.style = stylesArr.sort().join( '; ' );
		}
		else if ( origStyles ) {
			attrs.style = origStyles;
		}

		if ( !status.allClasses || status.hadInvalidClass ) {
			for ( i = 0; i < classes.length; ++i ) {
				// See comment for styles.
				if ( status.allClasses || validClasses[ classes[ i ] ] )
					classesArr.push( classes[ i ] );
			}
			if ( classesArr.length )
				attrs[ 'class' ] = classesArr.sort().join( ' ' );

			if ( origClasses && classesArr.length < origClasses.split( /\s+/ ).length )
				isModified = true;
		}
		else if ( origClasses ) {
			attrs[ 'class' ] = origClasses;
		}

		return isModified;
	}
function updateElement( element, status ) {
		var validAttrs = status.validAttributes,
			validStyles = status.validStyles,
			validClasses = status.validClasses,
			attrs = element.attributes,
			styles = element.styles,
			classes = element.classes,
			origClasses = element.classBackup,
			origStyles = element.styleBackup,
			name, origName, i,
			stylesArr = [],
			classesArr = [],
			internalAttr = /^data-cke-/,
			isModified = false;

		// Will be recreated later if any of styles/classes were passed.
		delete attrs.style;
		delete attrs[ 'class' ];
		// Clean up.
		delete element.classBackup;
		delete element.styleBackup;

		if ( !status.allAttributes ) {
			for ( name in attrs ) {
				// If not valid and not internal attribute delete it.
				if ( !validAttrs[ name ] ) {
					// Allow all internal attibutes...
					if ( internalAttr.test( name ) ) {
						// ... unless this is a saved attribute and the original one isn't allowed.
						if ( name != ( origName = name.replace( /^data-cke-saved-/, '' ) ) &&
							!validAttrs[ origName ]
						) {
							delete attrs[ name ];
							isModified = true;
						}
					} else {
						delete attrs[ name ];
						isModified = true;
					}
				}

			}
		}

		if ( !status.allStyles || status.hadInvalidStyle ) {
			for ( name in styles ) {
				// We check status.allStyles because when there was a '*' ACR and some
				// DACR we have now both properties true - status.allStyles and status.hadInvalidStyle.
				// However unlike in the case when we only have '*' ACR, in which we can just copy original
				// styles, in this case we must copy only those styles which were not removed by DACRs.
				if ( status.allStyles || validStyles[ name ] )
					stylesArr.push( name + ':' + styles[ name ] );
				else
					isModified = true;
			}
			if ( stylesArr.length )
				attrs.style = stylesArr.sort().join( '; ' );
		}
		else if ( origStyles ) {
			attrs.style = origStyles;
		}

		if ( !status.allClasses || status.hadInvalidClass ) {
			for ( i = 0; i < classes.length; ++i ) {
				// See comment for styles.
				if ( status.allClasses || validClasses[ classes[ i ] ] )
					classesArr.push( classes[ i ] );
			}
			if ( classesArr.length )
				attrs[ 'class' ] = classesArr.sort().join( ' ' );

			if ( origClasses && classesArr.length < origClasses.split( /\s+/ ).length )
				isModified = true;
		}
		else if ( origClasses ) {
			attrs[ 'class' ] = origClasses;
		}

		return isModified;
	}
function updateElement ( element , status ) { var validAttrs = status . validAttributes , validStyles = status . validStyles , validClasses = status . validClasses , attrs = element . attributes , styles = element . styles , classes = element . classes , origClasses = element . classBackup , origStyles = element . styleBackup , name , origName , i , stylesArr = [ ] , classesArr = [ ] , internalAttr = / ^data-cke- / , isModified = false ; // Will be recreated later if any of styles/classes were passed. delete attrs . style ; delete attrs [ 'class' ] ; // Clean up. delete element . classBackup ; delete element . styleBackup ; if ( ! status . allAttributes ) { for ( name in attrs ) { // If not valid and not internal attribute delete it. if ( ! validAttrs [ name ] ) { // Allow all internal attibutes... if ( internalAttr . test ( name ) ) { // ... unless this is a saved attribute and the original one isn't allowed. if ( name != ( origName = name . replace ( / ^data-cke-saved- / , '' ) ) && ! validAttrs [ origName ] ) { delete attrs [ name ] ; isModified = true ; } } else { delete attrs [ name ] ; isModified = true ; } } } } if ( ! status . allStyles || status . hadInvalidStyle ) { for ( name in styles ) { // We check status.allStyles because when there was a '*' ACR and some // DACR we have now both properties true - status.allStyles and status.hadInvalidStyle. // However unlike in the case when we only have '*' ACR, in which we can just copy original // styles, in this case we must copy only those styles which were not removed by DACRs. if ( status . allStyles || validStyles [ name ] ) stylesArr . push ( name + ':' + styles [ name ] ) ; else isModified = true ; } if ( stylesArr . length ) attrs . style = stylesArr . sort ( ) . join ( '; ' ) ; } else if ( origStyles ) { attrs . style = origStyles ; } if ( ! status . allClasses || status . hadInvalidClass ) { for ( i = 0 ; i < classes . length ; ++ i ) { // See comment for styles. if ( status . allClasses || validClasses [ classes [ i ] ] ) classesArr . push ( classes [ i ] ) ; } if ( classesArr . length ) attrs [ 'class' ] = classesArr . sort ( ) . join ( ' ' ) ; if ( origClasses && classesArr . length < origClasses . split ( / \s+ / ) . length ) isModified = true ; } else if ( origClasses ) { attrs [ 'class' ] = origClasses ; } return isModified ; }
Update element object based on status of filtering. @returns Whether element was modified.
Update element object based on status of filtering .