CLICK HERE TO BUY IT TODAY! OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Framework/Model/Vendor/CkEditor/_source/core/htmlparser/element.js



/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
 * A lightweight representation of an HTML element.
 * @param {String} name The element name.
 * @param {Object} attributes And object holding all attributes defined for
 *        this element.
 * @constructor
 * @example
 */
CKEDITOR.htmlParser.element = function( nameattributes )
{
	    /**
	     * The element name.
	     * @type String
	     * @example
	     */
	    this.name name;
	    /**
	     * Holds the attributes defined for this element.
	     * @type Object
	     * @example
	     */
	    this.attributes attributes || ( attributes {} );
	    /**
	     * The nodes that are direct children of this element.
	     * @type Array
	     * @example
	     */
	    this.children [];
	    var tagName attributes._cke_real_element_type || name;
	    var dtd            CKEDITOR.dtd,
	        isBlockLike    = !!( dtd.$nonBodyContenttagName ] || dtd.$blocktagName ] || dtd.$listItemtagName ] || dtd.$tableContenttagName ] || dtd.$nonEditabletagName ] || tagName == 'br' ),
	        isEmpty        = !!dtd.$emptyname ];
	    this.isEmpty    isEmpty;
	    this.isUnknown    = !dtdname ];
	    /** @private */
	    this.=
	    {
		        isBlockLike isBlockLike,
		        hasInlineStarted isEmpty || !isBlockLike
		    };
	};
(function()
{
	    // Used to sort attribute entries in an array, where the first element of
	    // each object is the attribute name.
	    var sortAttribs = function( a)
	    {
		        a[0];
		        b[0];
		        return ? -0;
		    };
	    CKEDITOR.htmlParser.element.prototype =
	    {
		        /**
		         * The node type. This is a constant value set to {@link CKEDITOR.NODE_ELEMENT}.
		         * @type Number
		         * @example
		         */
		        type CKEDITOR.NODE_ELEMENT,
		        /**
		         * Adds a node to the element children list.
		         * @param {Object} node The node to be added. It can be any of of the
		         *        following types: {@link CKEDITOR.htmlParser.element},
		         *        {@link CKEDITOR.htmlParser.text} and
		         *        {@link CKEDITOR.htmlParser.comment}.
		         * @function
		         * @example
		         */
		        add CKEDITOR.htmlParser.fragment.prototype.add,
		        /**
		         * Clone this element.
		         * @returns {CKEDITOR.htmlParser.element} The element clone.
		         * @example
		         */
		        clone : function()
		        {
			            return new CKEDITOR.htmlParser.elementthis.namethis.attributes );
			        },
		        /**
		         * Writes the element HTML to a CKEDITOR.htmlWriter.
		         * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
		         * @example
		         */
		        writeHtml : function( writerfilter )
		        {
			            var attributes this.attributes;
			            // Ignore cke: prefixes when writing HTML.
			            var element this,
			                writeName element.name,
			                anewAttrNamevalue;
			            var isChildrenFiltered;
			            /**
			             * Providing an option for bottom-up filtering order ( element
			             * children to be pre-filtered before the element itself ).
			             */
			            element.filterChildren = function()
			            {
				                if ( !isChildrenFiltered )
				                {
					                    var writer = new CKEDITOR.htmlParser.basicWriter();
					                    CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.callelementwriterfilter );
					                    element.children = new CKEDITOR.htmlParser.fragment.fromHtmlwriter.getHtml() ).children;
					                    isChildrenFiltered 1;
					                }
				            };
			            if ( filter )
			            {
				                while ( true )
				                {
					                    if ( !( writeName filter.onElementNamewriteName ) ) )
					                        return;
					                    element.name writeName;
					                    if ( !( element filter.onElementelement ) ) )
					                        return;
					                    element.parent this.parent;
					                    if ( element.name == writeName )
					                        break;
					                    // If the element has been replaced with something of a
					                    // different type, then make the replacement write itself.
					                    if ( element.type != CKEDITOR.NODE_ELEMENT )
					                    {
						                        element.writeHtmlwriterfilter );
						                        return;
						                    }
					                    writeName element.name;
					                    // This indicate that the element has been dropped by
					                    // filter but not the children.
					                    if ( !writeName )
					                    {
						                        this.writeChildrenHtml.callelementwriterisChildrenFiltered null filter );
						                        return;
						                    }
					                }
				                // The element may have been changed, so update the local
				                // references.
				                attributes element.attributes;
				            }
			            // Open element tag.
			            writer.openTagwriteNameattributes );
			            // Copy all attributes to an array.
			            var attribsArray [];
			            // Iterate over the attributes twice since filters may alter
			            // other attributes.
			            for ( var ;
			 2;
			 i++ )
			            {
				                for ( a in attributes )
				                {
					                    newAttrName a;
					                    value attributes];
					                    if ( == )
					                        attribsArray.push( [ avalue ] );
					                    else if ( filter )
					                    {
						                        while ( true )
						                        {
							                            if ( !( newAttrName filter.onAttributeName) ) )
							                            {
								                                delete attributes];
								                                break;
								                            }
							                            else if ( newAttrName != )
							                            {
								                                delete attributes];
								                                newAttrName;
								                                continue;
								                            }
							                            else
							                                break;
							                        }
						                        if ( newAttrName )
						                        {
							                            if ( ( value filter.onAttributeelementnewAttrNamevalue ) ) === false )
							                                delete attributesnewAttrName ];
							                            else
							                                attributes newAttrName ] = value;
							                        }
						                    }
					                }
				            }
			            // Sort the attributes by name.
			            if ( writer.sortAttributes )
			                attribsArray.sortsortAttribs );
			            // Send the attributes.
			            var len attribsArray.length;
			            for ( ;
			 len ;
			 i++ )
			            {
				                var attrib attribsArray];
				                writer.attributeattrib[0], attrib[1] );
				            }
			            // Close the tag.
			            writer.openTagClosewriteNameelement.isEmpty );
			            if ( !element.isEmpty )
			            {
				                this.writeChildrenHtml.callelementwriterisChildrenFiltered null filter );
				                // Close the element.
				                writer.closeTagwriteName );
				            }
			        },
		        writeChildrenHtml : function( writerfilter )
		        {
			            // Send children.
			            CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.applythisarguments );
			        }
		    };
	})();





PHP Demo Source Code Index