Importation du code de ckeditor 4.3.4 en conservant les développements Plinn et en...
[ckeditor.git] / skins / ckeditor / _source / core / dom / element.js
diff --git a/skins/ckeditor/_source/core/dom/element.js b/skins/ckeditor/_source/core/dom/element.js
deleted file mode 100644 (file)
index 5df3d19..0000000
+++ /dev/null
@@ -1,1681 +0,0 @@
-/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-/**\r
- * @fileOverview Defines the {@link CKEDITOR.dom.element} class, which\r
- *             represents a DOM element.\r
- */\r
-\r
-/**\r
- * Represents a DOM element.\r
- * @constructor\r
- * @augments CKEDITOR.dom.node\r
- * @param {Object|String} element A native DOM element or the element name for\r
- *             new elements.\r
- * @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain\r
- *             the element in case of element creation.\r
- * @example\r
- * // Create a new <span> element.\r
- * var element = new CKEDITOR.dom.element( 'span' );\r
- * @example\r
- * // Create an element based on a native DOM element.\r
- * var element = new CKEDITOR.dom.element( document.getElementById( 'myId' ) );\r
- */\r
-CKEDITOR.dom.element = function( element, ownerDocument )\r
-{\r
-       if ( typeof element == 'string' )\r
-               element = ( ownerDocument ? ownerDocument.$ : document ).createElement( element );\r
-\r
-       // Call the base constructor (we must not call CKEDITOR.dom.node).\r
-       CKEDITOR.dom.domObject.call( this, element );\r
-};\r
-\r
-// PACKAGER_RENAME( CKEDITOR.dom.element )\r
-\r
-/**\r
- * The the {@link CKEDITOR.dom.element} representing and element. If the\r
- * element is a native DOM element, it will be transformed into a valid\r
- * CKEDITOR.dom.element object.\r
- * @returns {CKEDITOR.dom.element} The transformed element.\r
- * @example\r
- * var element = new CKEDITOR.dom.element( 'span' );\r
- * alert( element == <b>CKEDITOR.dom.element.get( element )</b> );  "true"\r
- * @example\r
- * var element = document.getElementById( 'myElement' );\r
- * alert( <b>CKEDITOR.dom.element.get( element )</b>.getName() );  e.g. "p"\r
- */\r
-CKEDITOR.dom.element.get = function( element )\r
-{\r
-       return element && ( element.$ ? element : new CKEDITOR.dom.element( element ) );\r
-};\r
-\r
-CKEDITOR.dom.element.prototype = new CKEDITOR.dom.node();\r
-\r
-/**\r
- * Creates an instance of the {@link CKEDITOR.dom.element} class based on the\r
- * HTML representation of an element.\r
- * @param {String} html The element HTML. It should define only one element in\r
- *             the "root" level. The "root" element can have child nodes, but not\r
- *             siblings.\r
- * @returns {CKEDITOR.dom.element} The element instance.\r
- * @example\r
- * var element = <b>CKEDITOR.dom.element.createFromHtml( '&lt;strong class="anyclass"&gt;My element&lt;/strong&gt;' )</b>;\r
- * alert( element.getName() );  // "strong"\r
- */\r
-CKEDITOR.dom.element.createFromHtml = function( html, ownerDocument )\r
-{\r
-       var temp = new CKEDITOR.dom.element( 'div', ownerDocument );\r
-       temp.setHtml( html );\r
-\r
-       // When returning the node, remove it from its parent to detach it.\r
-       return temp.getFirst().remove();\r
-};\r
-\r
-CKEDITOR.dom.element.setMarker = function( database, element, name, value )\r
-{\r
-       var id = element.getCustomData( 'list_marker_id' ) ||\r
-                       ( element.setCustomData( 'list_marker_id', CKEDITOR.tools.getNextNumber() ).getCustomData( 'list_marker_id' ) ),\r
-               markerNames = element.getCustomData( 'list_marker_names' ) ||\r
-                       ( element.setCustomData( 'list_marker_names', {} ).getCustomData( 'list_marker_names' ) );\r
-       database[id] = element;\r
-       markerNames[name] = 1;\r
-\r
-       return element.setCustomData( name, value );\r
-};\r
-\r
-CKEDITOR.dom.element.clearAllMarkers = function( database )\r
-{\r
-       for ( var i in database )\r
-               CKEDITOR.dom.element.clearMarkers( database, database[i], 1 );\r
-};\r
-\r
-CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatabase )\r
-{\r
-       var names = element.getCustomData( 'list_marker_names' ),\r
-               id = element.getCustomData( 'list_marker_id' );\r
-       for ( var i in names )\r
-               element.removeCustomData( i );\r
-       element.removeCustomData( 'list_marker_names' );\r
-       if ( removeFromDatabase )\r
-       {\r
-               element.removeCustomData( 'list_marker_id' );\r
-               delete database[id];\r
-       }\r
-};\r
-\r
-CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype,\r
-       /** @lends CKEDITOR.dom.element.prototype */\r
-       {\r
-               /**\r
-                * The node type. This is a constant value set to\r
-                * {@link CKEDITOR.NODE_ELEMENT}.\r
-                * @type Number\r
-                * @example\r
-                */\r
-               type : CKEDITOR.NODE_ELEMENT,\r
-\r
-               /**\r
-                * Adds a CSS class to the element. It appends the class to the\r
-                * already existing names.\r
-                * @param {String} className The name of the class to be added.\r
-                * @example\r
-                * var element = new CKEDITOR.dom.element( 'div' );\r
-                * element.addClass( 'classA' );  // &lt;div class="classA"&gt;\r
-                * element.addClass( 'classB' );  // &lt;div class="classA classB"&gt;\r
-                * element.addClass( 'classA' );  // &lt;div class="classA classB"&gt;\r
-                */\r
-               addClass : function( className )\r
-               {\r
-                       var c = this.$.className;\r
-                       if ( c )\r
-                       {\r
-                               var regex = new RegExp( '(?:^|\\s)' + className + '(?:\\s|$)', '' );\r
-                               if ( !regex.test( c ) )\r
-                                       c += ' ' + className;\r
-                       }\r
-                       this.$.className = c || className;\r
-               },\r
-\r
-               /**\r
-                * Removes a CSS class name from the elements classes. Other classes\r
-                * remain untouched.\r
-                * @param {String} className The name of the class to remove.\r
-                * @example\r
-                * var element = new CKEDITOR.dom.element( 'div' );\r
-                * element.addClass( 'classA' );  // &lt;div class="classA"&gt;\r
-                * element.addClass( 'classB' );  // &lt;div class="classA classB"&gt;\r
-                * element.removeClass( 'classA' );  // &lt;div class="classB"&gt;\r
-                * element.removeClass( 'classB' );  // &lt;div&gt;\r
-                */\r
-               removeClass : function( className )\r
-               {\r
-                       var c = this.getAttribute( 'class' );\r
-                       if ( c )\r
-                       {\r
-                               var regex = new RegExp( '(?:^|\\s+)' + className + '(?=\\s|$)', 'i' );\r
-                               if ( regex.test( c ) )\r
-                               {\r
-                                       c = c.replace( regex, '' ).replace( /^\s+/, '' );\r
-\r
-                                       if ( c )\r
-                                               this.setAttribute( 'class', c );\r
-                                       else\r
-                                               this.removeAttribute( 'class' );\r
-                               }\r
-                       }\r
-               },\r
-\r
-               hasClass : function( className )\r
-               {\r
-                       var regex = new RegExp( '(?:^|\\s+)' + className + '(?=\\s|$)', '' );\r
-                       return regex.test( this.getAttribute('class') );\r
-               },\r
-\r
-               /**\r
-                * Append a node as a child of this element.\r
-                * @param {CKEDITOR.dom.node|String} node The node or element name to be\r
-                *              appended.\r
-                * @param {Boolean} [toStart] Indicates that the element is to be\r
-                *              appended at the start.\r
-                * @returns {CKEDITOR.dom.node} The appended node.\r
-                * @example\r
-                * var p = new CKEDITOR.dom.element( 'p' );\r
-                *\r
-                * var strong = new CKEDITOR.dom.element( 'strong' );\r
-                * <b>p.append( strong );</b>\r
-                *\r
-                * var em = <b>p.append( 'em' );</b>\r
-                *\r
-                * // result: "&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;"\r
-                */\r
-               append : function( node, toStart )\r
-               {\r
-                       if ( typeof node == 'string' )\r
-                               node = this.getDocument().createElement( node );\r
-\r
-                       if ( toStart )\r
-                               this.$.insertBefore( node.$, this.$.firstChild );\r
-                       else\r
-                               this.$.appendChild( node.$ );\r
-\r
-                       return node;\r
-               },\r
-\r
-               appendHtml : function( html )\r
-               {\r
-                       if ( !this.$.childNodes.length )\r
-                               this.setHtml( html );\r
-                       else\r
-                       {\r
-                               var temp = new CKEDITOR.dom.element( 'div', this.getDocument() );\r
-                               temp.setHtml( html );\r
-                               temp.moveChildren( this );\r
-                       }\r
-               },\r
-\r
-               /**\r
-                * Append text to this element.\r
-                * @param {String} text The text to be appended.\r
-                * @returns {CKEDITOR.dom.node} The appended node.\r
-                * @example\r
-                * var p = new CKEDITOR.dom.element( 'p' );\r
-                * p.appendText( 'This is' );\r
-                * p.appendText( ' some text' );\r
-                *\r
-                * // result: "&lt;p&gt;This is some text&lt;/p&gt;"\r
-                */\r
-               appendText : function( text )\r
-               {\r
-                       if ( this.$.text != undefined )\r
-                               this.$.text += text;\r
-                       else\r
-                               this.append( new CKEDITOR.dom.text( text ) );\r
-               },\r
-\r
-               appendBogus : function()\r
-               {\r
-                       var lastChild = this.getLast() ;\r
-\r
-                       // Ignore empty/spaces text.\r
-                       while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.rtrim( lastChild.getText() ) )\r
-                               lastChild = lastChild.getPrevious();\r
-                       if ( !lastChild || !lastChild.is || !lastChild.is( 'br' ) )\r
-                       {\r
-                               var bogus = CKEDITOR.env.opera ?\r
-                                               this.getDocument().createText('') :\r
-                                               this.getDocument().createElement( 'br' );\r
-\r
-                               CKEDITOR.env.gecko && bogus.setAttribute( 'type', '_moz' );\r
-\r
-                               this.append( bogus );\r
-                       }\r
-               },\r
-\r
-               /**\r
-                * Breaks one of the ancestor element in the element position, moving\r
-                * this element between the broken parts.\r
-                * @param {CKEDITOR.dom.element} parent The anscestor element to get broken.\r
-                * @example\r
-                * // Before breaking:\r
-                * //     &lt;b&gt;This &lt;i&gt;is some&lt;span /&gt; sample&lt;/i&gt; test text&lt;/b&gt;\r
-                * // If "element" is &lt;span /&gt; and "parent" is &lt;i&gt;:\r
-                * //     &lt;b&gt;This &lt;i&gt;is some&lt;/i&gt;&lt;span /&gt;&lt;i&gt; sample&lt;/i&gt; test text&lt;/b&gt;\r
-                * element.breakParent( parent );\r
-                * @example\r
-                * // Before breaking:\r
-                * //     &lt;b&gt;This &lt;i&gt;is some&lt;span /&gt; sample&lt;/i&gt; test text&lt;/b&gt;\r
-                * // If "element" is &lt;span /&gt; and "parent" is &lt;b&gt;:\r
-                * //     &lt;b&gt;This &lt;i&gt;is some&lt;/i&gt;&lt;/b&gt;&lt;span /&gt;&lt;b&gt;&lt;i&gt; sample&lt;/i&gt; test text&lt;/b&gt;\r
-                * element.breakParent( parent );\r
-                */\r
-               breakParent : function( parent )\r
-               {\r
-                       var range = new CKEDITOR.dom.range( this.getDocument() );\r
-\r
-                       // We'll be extracting part of this element, so let's use our\r
-                       // range to get the correct piece.\r
-                       range.setStartAfter( this );\r
-                       range.setEndAfter( parent );\r
-\r
-                       // Extract it.\r
-                       var docFrag = range.extractContents();\r
-\r
-                       // Move the element outside the broken element.\r
-                       range.insertNode( this.remove() );\r
-\r
-                       // Re-insert the extracted piece after the element.\r
-                       docFrag.insertAfterNode( this );\r
-               },\r
-\r
-               contains :\r
-                       CKEDITOR.env.ie || CKEDITOR.env.webkit ?\r
-                               function( node )\r
-                               {\r
-                                       var $ = this.$;\r
-\r
-                                       return node.type != CKEDITOR.NODE_ELEMENT ?\r
-                                               $.contains( node.getParent().$ ) :\r
-                                               $ != node.$ && $.contains( node.$ );\r
-                               }\r
-                       :\r
-                               function( node )\r
-                               {\r
-                                       return !!( this.$.compareDocumentPosition( node.$ ) & 16 );\r
-                               },\r
-\r
-               /**\r
-                * Moves the selection focus to this element.\r
-                * @function\r
-                * @param  {Boolean} defer Whether to asynchronously defer the\r
-                *              execution by 100 ms.\r
-                * @example\r
-                * var element = CKEDITOR.document.getById( 'myTextarea' );\r
-                * <b>element.focus()</b>;\r
-                */\r
-               focus : ( function()\r
-               {\r
-                       function exec()\r
-                       {\r
-                       // IE throws error if the element is not visible.\r
-                       try\r
-                       {\r
-                               this.$.focus();\r
-                       }\r
-                       catch (e)\r
-                       {}\r
-                       }\r
-\r
-                       return function( defer )\r
-                       {\r
-                               if ( defer )\r
-                                       CKEDITOR.tools.setTimeout( exec, 100, this );\r
-                               else\r
-                                       exec.call( this );\r
-                       };\r
-               })(),\r
-\r
-               /**\r
-                * Gets the inner HTML of this element.\r
-                * @returns {String} The inner HTML of this element.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '&lt;div&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/div&gt;' );\r
-                * alert( <b>p.getHtml()</b> );  // "&lt;b&gt;Example&lt;/b&gt;"\r
-                */\r
-               getHtml : function()\r
-               {\r
-                       var retval = this.$.innerHTML;\r
-                       // Strip <?xml:namespace> tags in IE. (#3341).\r
-                       return CKEDITOR.env.ie ? retval.replace( /<\?[^>]*>/g, '' ) : retval;\r
-               },\r
-\r
-               getOuterHtml : function()\r
-               {\r
-                       if ( this.$.outerHTML )\r
-                       {\r
-                               // IE includes the <?xml:namespace> tag in the outerHTML of\r
-                               // namespaced element. So, we must strip it here. (#3341)\r
-                               return this.$.outerHTML.replace( /<\?[^>]*>/, '' );\r
-                       }\r
-\r
-                       var tmpDiv = this.$.ownerDocument.createElement( 'div' );\r
-                       tmpDiv.appendChild( this.$.cloneNode( true ) );\r
-                       return tmpDiv.innerHTML;\r
-               },\r
-\r
-               /**\r
-                * Sets the inner HTML of this element.\r
-                * @param {String} html The HTML to be set for this element.\r
-                * @returns {String} The inserted HTML.\r
-                * @example\r
-                * var p = new CKEDITOR.dom.element( 'p' );\r
-                * <b>p.setHtml( '&lt;b&gt;Inner&lt;/b&gt; HTML' );</b>\r
-                *\r
-                * // result: "&lt;p&gt;&lt;b&gt;Inner&lt;/b&gt; HTML&lt;/p&gt;"\r
-                */\r
-               setHtml : function( html )\r
-               {\r
-                       return ( this.$.innerHTML = html );\r
-               },\r
-\r
-               /**\r
-                * Sets the element contents as plain text.\r
-                * @param {String} text The text to be set.\r
-                * @returns {String} The inserted text.\r
-                * @example\r
-                * var element = new CKEDITOR.dom.element( 'div' );\r
-                * element.setText( 'A > B & C < D' );\r
-                * alert( element.innerHTML );  // "A &amp;gt; B &amp;amp; C &amp;lt; D"\r
-                */\r
-               setText : function( text )\r
-               {\r
-                       CKEDITOR.dom.element.prototype.setText = ( this.$.innerText != undefined ) ?\r
-                               function ( text )\r
-                               {\r
-                                       return this.$.innerText = text;\r
-                               } :\r
-                               function ( text )\r
-                               {\r
-                                       return this.$.textContent = text;\r
-                               };\r
-\r
-                       return this.setText( text );\r
-               },\r
-\r
-               /**\r
-                * Gets the value of an element attribute.\r
-                * @function\r
-                * @param {String} name The attribute name.\r
-                * @returns {String} The attribute value or null if not defined.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '&lt;input type="text" /&gt;' );\r
-                * alert( <b>element.getAttribute( 'type' )</b> );  // "text"\r
-                */\r
-               getAttribute : (function()\r
-               {\r
-                       var standard = function( name )\r
-                       {\r
-                               return this.$.getAttribute( name, 2 );\r
-                       };\r
-\r
-                       if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )\r
-                       {\r
-                               return function( name )\r
-                               {\r
-                                       switch ( name )\r
-                                       {\r
-                                               case 'class':\r
-                                                       name = 'className';\r
-                                                       break;\r
-\r
-                                               case 'http-equiv':\r
-                                                       name = 'httpEquiv';\r
-                                                       break;\r
-\r
-                                               case 'name':\r
-                                                       return this.$.name;\r
-\r
-                                               case 'tabindex':\r
-                                                       var tabIndex = standard.call( this, name );\r
-\r
-                                                       // IE returns tabIndex=0 by default for all\r
-                                                       // elements. For those elements,\r
-                                                       // getAtrribute( 'tabindex', 2 ) returns 32768\r
-                                                       // instead. So, we must make this check to give a\r
-                                                       // uniform result among all browsers.\r
-                                                       if ( tabIndex !== 0 && this.$.tabIndex === 0 )\r
-                                                               tabIndex = null;\r
-\r
-                                                       return tabIndex;\r
-                                                       break;\r
-\r
-                                               case 'checked':\r
-                                               {\r
-                                                       var attr = this.$.attributes.getNamedItem( name ),\r
-                                                               attrValue = attr.specified ? attr.nodeValue     // For value given by parser.\r
-                                                                                                                        : this.$.checked;  // For value created via DOM interface.\r
-\r
-                                                       return attrValue ? 'checked' : null;\r
-                                               }\r
-\r
-                                               case 'hspace':\r
-                                               case 'value':\r
-                                                       return this.$[ name ];\r
-\r
-                                               case 'style':\r
-                                                       // IE does not return inline styles via getAttribute(). See #2947.\r
-                                                       return this.$.style.cssText;\r
-                                       }\r
-\r
-                                       return standard.call( this, name );\r
-                               };\r
-                       }\r
-                       else\r
-                               return standard;\r
-               })(),\r
-\r
-               getChildren : function()\r
-               {\r
-                       return new CKEDITOR.dom.nodeList( this.$.childNodes );\r
-               },\r
-\r
-               /**\r
-                * Gets the current computed value of one of the element CSS style\r
-                * properties.\r
-                * @function\r
-                * @param {String} propertyName The style property name.\r
-                * @returns {String} The property value.\r
-                * @example\r
-                * var element = new CKEDITOR.dom.element( 'span' );\r
-                * alert( <b>element.getComputedStyle( 'display' )</b> );  // "inline"\r
-                */\r
-               getComputedStyle :\r
-                       CKEDITOR.env.ie ?\r
-                               function( propertyName )\r
-                               {\r
-                                       return this.$.currentStyle[ CKEDITOR.tools.cssStyleToDomStyle( propertyName ) ];\r
-                               }\r
-                       :\r
-                               function( propertyName )\r
-                               {\r
-                                       return this.getWindow().$.getComputedStyle( this.$, '' ).getPropertyValue( propertyName );\r
-                               },\r
-\r
-               /**\r
-                * Gets the DTD entries for this element.\r
-                * @returns {Object} An object containing the list of elements accepted\r
-                *              by this element.\r
-                */\r
-               getDtd : function()\r
-               {\r
-                       var dtd = CKEDITOR.dtd[ this.getName() ];\r
-\r
-                       this.getDtd = function()\r
-                       {\r
-                               return dtd;\r
-                       };\r
-\r
-                       return dtd;\r
-               },\r
-\r
-               getElementsByTag : CKEDITOR.dom.document.prototype.getElementsByTag,\r
-\r
-               /**\r
-                * Gets the computed tabindex for this element.\r
-                * @function\r
-                * @returns {Number} The tabindex value.\r
-                * @example\r
-                * var element = CKEDITOR.document.getById( 'myDiv' );\r
-                * alert( <b>element.getTabIndex()</b> );  // e.g. "-1"\r
-                */\r
-               getTabIndex :\r
-                       CKEDITOR.env.ie ?\r
-                               function()\r
-                               {\r
-                                       var tabIndex = this.$.tabIndex;\r
-\r
-                                       // IE returns tabIndex=0 by default for all elements. In\r
-                                       // those cases we must check that the element really has\r
-                                       // the tabindex attribute set to zero, or it is one of\r
-                                       // those element that should have zero by default.\r
-                                       if ( tabIndex === 0 && !CKEDITOR.dtd.$tabIndex[ this.getName() ] && parseInt( this.getAttribute( 'tabindex' ), 10 ) !== 0 )\r
-                                               tabIndex = -1;\r
-\r
-                                               return tabIndex;\r
-                               }\r
-                       : CKEDITOR.env.webkit ?\r
-                               function()\r
-                               {\r
-                                       var tabIndex = this.$.tabIndex;\r
-\r
-                                       // Safari returns "undefined" for elements that should not\r
-                                       // have tabindex (like a div). So, we must try to get it\r
-                                       // from the attribute.\r
-                                       // https://bugs.webkit.org/show_bug.cgi?id=20596\r
-                                       if ( tabIndex == undefined )\r
-                                       {\r
-                                               tabIndex = parseInt( this.getAttribute( 'tabindex' ), 10 );\r
-\r
-                                               // If the element don't have the tabindex attribute,\r
-                                               // then we should return -1.\r
-                                               if ( isNaN( tabIndex ) )\r
-                                                       tabIndex = -1;\r
-                                       }\r
-\r
-                                       return tabIndex;\r
-                               }\r
-                       :\r
-                               function()\r
-                               {\r
-                                       return this.$.tabIndex;\r
-                               },\r
-\r
-               /**\r
-                * Gets the text value of this element.\r
-                *\r
-                * Only in IE (which uses innerText), &lt;br&gt; will cause linebreaks,\r
-                * and sucessive whitespaces (including line breaks) will be reduced to\r
-                * a single space. This behavior is ok for us, for now. It may change\r
-                * in the future.\r
-                * @returns {String} The text value.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '&lt;div&gt;Same &lt;i&gt;text&lt;/i&gt;.&lt;/div&gt;' );\r
-                * alert( <b>element.getText()</b> );  // "Sample text."\r
-                */\r
-               getText : function()\r
-               {\r
-                       return this.$.textContent || this.$.innerText || '';\r
-               },\r
-\r
-               /**\r
-                * Gets the window object that contains this element.\r
-                * @returns {CKEDITOR.dom.window} The window object.\r
-                * @example\r
-                */\r
-               getWindow : function()\r
-               {\r
-                       return this.getDocument().getWindow();\r
-               },\r
-\r
-               /**\r
-                * Gets the value of the "id" attribute of this element.\r
-                * @returns {String} The element id, or null if not available.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '&lt;p id="myId"&gt;&lt;/p&gt;' );\r
-                * alert( <b>element.getId()</b> );  // "myId"\r
-                */\r
-               getId : function()\r
-               {\r
-                       return this.$.id || null;\r
-               },\r
-\r
-               /**\r
-                * Gets the value of the "name" attribute of this element.\r
-                * @returns {String} The element name, or null if not available.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '&lt;input name="myName"&gt;&lt;/input&gt;' );\r
-                * alert( <b>element.getNameAtt()</b> );  // "myName"\r
-                */\r
-               getNameAtt : function()\r
-               {\r
-                       return this.$.name || null;\r
-               },\r
-\r
-               /**\r
-                * Gets the element name (tag name). The returned name is guaranteed to\r
-                * be always full lowercased.\r
-                * @returns {String} The element name.\r
-                * @example\r
-                * var element = new CKEDITOR.dom.element( 'span' );\r
-                * alert( <b>element.getName()</b> );  // "span"\r
-                */\r
-               getName : function()\r
-               {\r
-                       // Cache the lowercased name inside a closure.\r
-                       var nodeName = this.$.nodeName.toLowerCase();\r
-\r
-                       if ( CKEDITOR.env.ie && ! ( document.documentMode > 8 ) )\r
-                       {\r
-                               var scopeName = this.$.scopeName;\r
-                               if ( scopeName != 'HTML' )\r
-                                       nodeName = scopeName.toLowerCase() + ':' + nodeName;\r
-                       }\r
-\r
-                       return (\r
-                       this.getName = function()\r
-                               {\r
-                                       return nodeName;\r
-                               })();\r
-               },\r
-\r
-               /**\r
-                * Gets the value set to this element. This value is usually available\r
-                * for form field elements.\r
-                * @returns {String} The element value.\r
-                */\r
-               getValue : function()\r
-               {\r
-                       return this.$.value;\r
-               },\r
-\r
-               /**\r
-                * Gets the first child node of this element.\r
-                * @param {Function} evaluator Filtering the result node.\r
-                * @returns {CKEDITOR.dom.node} The first child node or null if not\r
-                *              available.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '&lt;div&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/div&gt;' );\r
-                * var first = <b>element.getFirst()</b>;\r
-                * alert( first.getName() );  // "b"\r
-                */\r
-               getFirst : function( evaluator )\r
-               {\r
-                       var first = this.$.firstChild,\r
-                               retval = first && new CKEDITOR.dom.node( first );\r
-                       if ( retval && evaluator && !evaluator( retval ) )\r
-                               retval = retval.getNext( evaluator );\r
-\r
-                       return retval;\r
-               },\r
-\r
-               /**\r
-                * @param {Function} evaluator Filtering the result node.\r
-                */\r
-               getLast : function( evaluator )\r
-               {\r
-                       var last = this.$.lastChild,\r
-                               retval = last && new CKEDITOR.dom.node( last );\r
-                       if ( retval && evaluator && !evaluator( retval ) )\r
-                               retval = retval.getPrevious( evaluator );\r
-\r
-                       return retval;\r
-               },\r
-\r
-               getStyle : function( name )\r
-               {\r
-                       return this.$.style[ CKEDITOR.tools.cssStyleToDomStyle( name ) ];\r
-               },\r
-\r
-               /**\r
-                * Checks if the element name matches one or more names.\r
-                * @param {String} name[,name[,...]] One or more names to be checked.\r
-                * @returns {Boolean} true if the element name matches any of the names.\r
-                * @example\r
-                * var element = new CKEDITOR.element( 'span' );\r
-                * alert( <b>element.is( 'span' )</b> );  "true"\r
-                * alert( <b>element.is( 'p', 'span' )</b> );  "true"\r
-                * alert( <b>element.is( 'p' )</b> );  "false"\r
-                * alert( <b>element.is( 'p', 'div' )</b> );  "false"\r
-                */\r
-               is : function()\r
-               {\r
-                       var name = this.getName();\r
-                       for ( var i = 0 ; i < arguments.length ; i++ )\r
-                       {\r
-                               if ( arguments[ i ] == name )\r
-                                       return true;\r
-                       }\r
-                       return false;\r
-               },\r
-\r
-               isEditable : function()\r
-               {\r
-                       if ( this.isReadOnly() )\r
-                               return false;\r
-\r
-                       // Get the element name.\r
-                       var name = this.getName();\r
-\r
-                       // Get the element DTD (defaults to span for unknown elements).\r
-                       var dtd = !CKEDITOR.dtd.$nonEditable[ name ]\r
-                                               && ( CKEDITOR.dtd[ name ] || CKEDITOR.dtd.span );\r
-\r
-                       // In the DTD # == text node.\r
-                       return ( dtd && dtd['#'] );\r
-               },\r
-\r
-               isIdentical : function( otherElement )\r
-               {\r
-                       if ( this.getName() != otherElement.getName() )\r
-                               return false;\r
-\r
-                       var thisAttribs = this.$.attributes,\r
-                               otherAttribs = otherElement.$.attributes;\r
-\r
-                       var thisLength = thisAttribs.length,\r
-                               otherLength = otherAttribs.length;\r
-\r
-                       for ( var i = 0 ; i < thisLength ; i++ )\r
-                       {\r
-                               var attribute = thisAttribs[ i ];\r
-\r
-                               if ( attribute.nodeName == '_moz_dirty' )\r
-                                       continue;\r
-\r
-                               if ( ( !CKEDITOR.env.ie || ( attribute.specified && attribute.nodeName != 'data-cke-expando' ) ) && attribute.nodeValue != otherElement.getAttribute( attribute.nodeName ) )\r
-                                       return false;\r
-                       }\r
-\r
-                       // For IE, we have to for both elements, because it's difficult to\r
-                       // know how the atttibutes collection is organized in its DOM.\r
-                       if ( CKEDITOR.env.ie )\r
-                       {\r
-                               for ( i = 0 ; i < otherLength ; i++ )\r
-                               {\r
-                                       attribute = otherAttribs[ i ];\r
-                                       if ( attribute.specified && attribute.nodeName != 'data-cke-expando'\r
-                                                       && attribute.nodeValue != this.getAttribute( attribute.nodeName ) )\r
-                                               return false;\r
-                               }\r
-                       }\r
-\r
-                       return true;\r
-               },\r
-\r
-               /**\r
-                * Checks if this element is visible. May not work if the element is\r
-                * child of an element with visibility set to "hidden", but works well\r
-                * on the great majority of cases.\r
-                * @return {Boolean} True if the element is visible.\r
-                */\r
-               isVisible : function()\r
-               {\r
-                       var isVisible = !!this.$.offsetHeight && this.getComputedStyle( 'visibility' ) != 'hidden',\r
-                               elementWindow,\r
-                               elementWindowFrame;\r
-\r
-                       // Webkit and Opera report non-zero offsetHeight despite that\r
-                       // element is inside an invisible iframe. (#4542)\r
-                       if ( isVisible && ( CKEDITOR.env.webkit || CKEDITOR.env.opera ) )\r
-                       {\r
-                               elementWindow = this.getWindow();\r
-\r
-                               if ( !elementWindow.equals( CKEDITOR.document.getWindow() )\r
-                                               && ( elementWindowFrame = elementWindow.$.frameElement ) )\r
-                               {\r
-                                       isVisible = new CKEDITOR.dom.element( elementWindowFrame ).isVisible();\r
-                               }\r
-                       }\r
-\r
-                       return isVisible;\r
-               },\r
-\r
-               /**\r
-                * Whether it's an empty inline elements which has no visual impact when removed.\r
-                */\r
-               isEmptyInlineRemoveable : function()\r
-               {\r
-                       if ( !CKEDITOR.dtd.$removeEmpty[ this.getName() ] )\r
-                               return false;\r
-\r
-                       var children = this.getChildren();\r
-                       for ( var i = 0, count = children.count(); i < count; i++ )\r
-                       {\r
-                               var child = children.getItem( i );\r
-\r
-                               if ( child.type == CKEDITOR.NODE_ELEMENT && child.data( 'cke-bookmark' ) )\r
-                                       continue;\r
-\r
-                               if ( child.type == CKEDITOR.NODE_ELEMENT && !child.isEmptyInlineRemoveable()\r
-                                       || child.type == CKEDITOR.NODE_TEXT && CKEDITOR.tools.trim( child.getText() ) )\r
-                               {\r
-                                       return false;\r
-                               }\r
-                       }\r
-                       return true;\r
-               },\r
-\r
-               /**\r
-                * Checks if the element has any defined attributes.\r
-                * @function\r
-                * @returns {Boolean} True if the element has attributes.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '&lt;div title="Test"&gt;Example&lt;/div&gt;' );\r
-                * alert( <b>element.hasAttributes()</b> );  // "true"\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '&lt;div&gt;Example&lt;/div&gt;' );\r
-                * alert( <b>element.hasAttributes()</b> );  // "false"\r
-                */\r
-               hasAttributes :\r
-                       CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) ?\r
-                               function()\r
-                               {\r
-                                       var attributes = this.$.attributes;\r
-\r
-                                       for ( var i = 0 ; i < attributes.length ; i++ )\r
-                                       {\r
-                                               var attribute = attributes[i];\r
-\r
-                                               switch ( attribute.nodeName )\r
-                                               {\r
-                                                       case 'class' :\r
-                                                               // IE has a strange bug. If calling removeAttribute('className'),\r
-                                                               // the attributes collection will still contain the "class"\r
-                                                               // attribute, which will be marked as "specified", even if the\r
-                                                               // outerHTML of the element is not displaying the class attribute.\r
-                                                               // Note : I was not able to reproduce it outside the editor,\r
-                                                               // but I've faced it while working on the TC of #1391.\r
-                                                               if ( this.getAttribute( 'class' ) )\r
-                                                                       return true;\r
-\r
-                                                       // Attributes to be ignored.\r
-                                                       case 'data-cke-expando' :\r
-                                                               continue;\r
-\r
-                                                       /*jsl:fallthru*/\r
-\r
-                                                       default :\r
-                                                               if ( attribute.specified )\r
-                                                                       return true;\r
-                                               }\r
-                                       }\r
-\r
-                                       return false;\r
-                               }\r
-                       :\r
-                               function()\r
-                               {\r
-                                       var attrs = this.$.attributes,\r
-                                               attrsNum = attrs.length;\r
-\r
-                                       // The _moz_dirty attribute might get into the element after pasting (#5455)\r
-                                       var execludeAttrs = { 'data-cke-expando' : 1, _moz_dirty : 1 };\r
-\r
-                                       return attrsNum > 0 &&\r
-                                               ( attrsNum > 2 ||\r
-                                                       !execludeAttrs[ attrs[0].nodeName ] ||\r
-                                                       ( attrsNum == 2 && !execludeAttrs[ attrs[1].nodeName ] ) );\r
-                               },\r
-\r
-               /**\r
-                * Checks if the specified attribute is defined for this element.\r
-                * @returns {Boolean} True if the specified attribute is defined.\r
-                * @param {String} name The attribute name.\r
-                * @example\r
-                */\r
-               hasAttribute : (function()\r
-               {\r
-                       function standard( name )\r
-                       {\r
-                               var $attr = this.$.attributes.getNamedItem( name );\r
-                               return !!( $attr && $attr.specified );\r
-                       }\r
-\r
-                       return ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) ?\r
-                                       function( name )\r
-                                       {\r
-                                               // On IE < 8 the name attribute cannot be retrieved\r
-                                               // right after the element creation and setting the\r
-                                               // name with setAttribute.\r
-                                               if ( name == 'name' )\r
-                                                       return !!this.$.name;\r
-\r
-                                               return standard.call( this, name );\r
-                                       }\r
-                               :\r
-                                       standard;\r
-               })(),\r
-\r
-               /**\r
-                * Hides this element (display:none).\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.getById( 'myElement' );\r
-                * <b>element.hide()</b>;\r
-                */\r
-               hide : function()\r
-               {\r
-                       this.setStyle( 'display', 'none' );\r
-               },\r
-\r
-               moveChildren : function( target, toStart )\r
-               {\r
-                       var $ = this.$;\r
-                       target = target.$;\r
-\r
-                       if ( $ == target )\r
-                               return;\r
-\r
-                       var child;\r
-\r
-                       if ( toStart )\r
-                       {\r
-                               while ( ( child = $.lastChild ) )\r
-                                       target.insertBefore( $.removeChild( child ), target.firstChild );\r
-                       }\r
-                       else\r
-                       {\r
-                               while ( ( child = $.firstChild ) )\r
-                                       target.appendChild( $.removeChild( child ) );\r
-                       }\r
-               },\r
-\r
-               /**\r
-                * Merges sibling elements that are identical to this one.<br>\r
-                * <br>\r
-                * Identical child elements are also merged. For example:<br>\r
-                * &lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt; =&gt; &lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt;\r
-                * @function\r
-                * @param {Boolean} [inlineOnly] Allow only inline elements to be merged. Defaults to "true".\r
-                */\r
-               mergeSiblings : ( function()\r
-               {\r
-                       function mergeElements( element, sibling, isNext )\r
-                       {\r
-                               if ( sibling && sibling.type == CKEDITOR.NODE_ELEMENT )\r
-                               {\r
-                                       // Jumping over bookmark nodes and empty inline elements, e.g. <b><i></i></b>,\r
-                                       // queuing them to be moved later. (#5567)\r
-                                       var pendingNodes = [];\r
-\r
-                                       while ( sibling.data( 'cke-bookmark' )\r
-                                               || sibling.isEmptyInlineRemoveable() )\r
-                                       {\r
-                                               pendingNodes.push( sibling );\r
-                                               sibling = isNext ? sibling.getNext() : sibling.getPrevious();\r
-                                               if ( !sibling || sibling.type != CKEDITOR.NODE_ELEMENT )\r
-                                                       return;\r
-                                       }\r
-\r
-                                       if ( element.isIdentical( sibling ) )\r
-                                       {\r
-                                               // Save the last child to be checked too, to merge things like\r
-                                               // <b><i></i></b><b><i></i></b> => <b><i></i></b>\r
-                                               var innerSibling = isNext ? element.getLast() : element.getFirst();\r
-\r
-                                               // Move pending nodes first into the target element.\r
-                                               while( pendingNodes.length )\r
-                                                       pendingNodes.shift().move( element, !isNext );\r
-\r
-                                               sibling.moveChildren( element, !isNext );\r
-                                               sibling.remove();\r
-\r
-                                               // Now check the last inner child (see two comments above).\r
-                                               if ( innerSibling && innerSibling.type == CKEDITOR.NODE_ELEMENT )\r
-                                                       innerSibling.mergeSiblings();\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       return function( inlineOnly )\r
-                               {\r
-                                       if ( ! ( inlineOnly === false\r
-                                                       || CKEDITOR.dtd.$removeEmpty[ this.getName() ]\r
-                                                       || this.is( 'a' ) ) )   // Merge empty links and anchors also. (#5567)\r
-                                       {\r
-                                               return;\r
-                                       }\r
-\r
-                                       mergeElements( this, this.getNext(), true );\r
-                                       mergeElements( this, this.getPrevious() );\r
-                               };\r
-               } )(),\r
-\r
-               /**\r
-                * Shows this element (display it).\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.getById( 'myElement' );\r
-                * <b>element.show()</b>;\r
-                */\r
-               show : function()\r
-               {\r
-                       this.setStyles(\r
-                               {\r
-                                       display : '',\r
-                                       visibility : ''\r
-                               });\r
-               },\r
-\r
-               /**\r
-                * Sets the value of an element attribute.\r
-                * @param {String} name The name of the attribute.\r
-                * @param {String} value The value to be set to the attribute.\r
-                * @function\r
-                * @returns {CKEDITOR.dom.element} This element instance.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.getById( 'myElement' );\r
-                * <b>element.setAttribute( 'class', 'myClass' )</b>;\r
-                * <b>element.setAttribute( 'title', 'This is an example' )</b>;\r
-                */\r
-               setAttribute : (function()\r
-               {\r
-                       var standard = function( name, value )\r
-                       {\r
-                               this.$.setAttribute( name, value );\r
-                               return this;\r
-                       };\r
-\r
-                       if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )\r
-                       {\r
-                               return function( name, value )\r
-                               {\r
-                                       if ( name == 'class' )\r
-                                               this.$.className = value;\r
-                                       else if ( name == 'style' )\r
-                                               this.$.style.cssText = value;\r
-                                       else if ( name == 'tabindex' )  // Case sensitive.\r
-                                               this.$.tabIndex = value;\r
-                                       else if ( name == 'checked' )\r
-                                               this.$.checked = value;\r
-                                       else\r
-                                               standard.apply( this, arguments );\r
-                                       return this;\r
-                               };\r
-                       }\r
-                       else if ( CKEDITOR.env.ie8Compat && CKEDITOR.env.secure )\r
-                       {\r
-                               return function( name, value )\r
-                               {\r
-                                       // IE8 throws error when setting src attribute to non-ssl value. (#7847)\r
-                                       if ( name == 'src' && value.match( /^http:\/\// ) )\r
-                                               try { standard.apply( this, arguments ); } catch( e ){}\r
-                                       else\r
-                                               standard.apply( this, arguments );\r
-                                       return this;\r
-                               };\r
-                       }\r
-                       else\r
-                               return standard;\r
-               })(),\r
-\r
-               /**\r
-                * Sets the value of several element attributes.\r
-                * @param {Object} attributesPairs An object containing the names and\r
-                *              values of the attributes.\r
-                * @returns {CKEDITOR.dom.element} This element instance.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.getById( 'myElement' );\r
-                * <b>element.setAttributes({\r
-                *     'class' : 'myClass',\r
-                *     'title' : 'This is an example' })</b>;\r
-                */\r
-               setAttributes : function( attributesPairs )\r
-               {\r
-                       for ( var name in attributesPairs )\r
-                               this.setAttribute( name, attributesPairs[ name ] );\r
-                       return this;\r
-               },\r
-\r
-               /**\r
-                * Sets the element value. This function is usually used with form\r
-                * field element.\r
-                * @param {String} value The element value.\r
-                * @returns {CKEDITOR.dom.element} This element instance.\r
-                */\r
-               setValue : function( value )\r
-               {\r
-                       this.$.value = value;\r
-                       return this;\r
-               },\r
-\r
-               /**\r
-                * Removes an attribute from the element.\r
-                * @param {String} name The attribute name.\r
-                * @function\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '<div class="classA"></div>' );\r
-                * element.removeAttribute( 'class' );\r
-                */\r
-               removeAttribute : (function()\r
-               {\r
-                       var standard = function( name )\r
-                       {\r
-                               this.$.removeAttribute( name );\r
-                       };\r
-\r
-                       if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )\r
-                       {\r
-                               return function( name )\r
-                               {\r
-                                       if ( name == 'class' )\r
-                                               name = 'className';\r
-                                       else if ( name == 'tabindex' )\r
-                                               name = 'tabIndex';\r
-                                       standard.call( this, name );\r
-                               };\r
-                       }\r
-                       else\r
-                               return standard;\r
-               })(),\r
-\r
-               removeAttributes : function ( attributes )\r
-               {\r
-                       if ( CKEDITOR.tools.isArray( attributes ) )\r
-                       {\r
-                               for ( var i = 0 ; i < attributes.length ; i++ )\r
-                                       this.removeAttribute( attributes[ i ] );\r
-                       }\r
-                       else\r
-                       {\r
-                               for ( var attr in attributes )\r
-                                       attributes.hasOwnProperty( attr ) && this.removeAttribute( attr );\r
-                       }\r
-               },\r
-\r
-               /**\r
-                * Removes a style from the element.\r
-                * @param {String} name The style name.\r
-                * @function\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.createFromHtml( '<div style="display:none"></div>' );\r
-                * element.removeStyle( 'display' );\r
-                */\r
-               removeStyle : function( name )\r
-               {\r
-                       this.setStyle( name, '' );\r
-                       if ( this.$.style.removeAttribute )\r
-                               this.$.style.removeAttribute( CKEDITOR.tools.cssStyleToDomStyle( name ) );\r
-\r
-                       if ( !this.$.style.cssText )\r
-                               this.removeAttribute( 'style' );\r
-               },\r
-\r
-               /**\r
-                * Sets the value of an element style.\r
-                * @param {String} name The name of the style. The CSS naming notation\r
-                *              must be used (e.g. "background-color").\r
-                * @param {String} value The value to be set to the style.\r
-                * @returns {CKEDITOR.dom.element} This element instance.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.getById( 'myElement' );\r
-                * <b>element.setStyle( 'background-color', '#ff0000' )</b>;\r
-                * <b>element.setStyle( 'margin-top', '10px' )</b>;\r
-                * <b>element.setStyle( 'float', 'right' )</b>;\r
-                */\r
-               setStyle : function( name, value )\r
-               {\r
-                       this.$.style[ CKEDITOR.tools.cssStyleToDomStyle( name ) ] = value;\r
-                       return this;\r
-               },\r
-\r
-               /**\r
-                * Sets the value of several element styles.\r
-                * @param {Object} stylesPairs An object containing the names and\r
-                *              values of the styles.\r
-                * @returns {CKEDITOR.dom.element} This element instance.\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.getById( 'myElement' );\r
-                * <b>element.setStyles({\r
-                *     'position' : 'absolute',\r
-                *     'float' : 'right' })</b>;\r
-                */\r
-               setStyles : function( stylesPairs )\r
-               {\r
-                       for ( var name in stylesPairs )\r
-                               this.setStyle( name, stylesPairs[ name ] );\r
-                       return this;\r
-               },\r
-\r
-               /**\r
-                * Sets the opacity of an element.\r
-                * @param {Number} opacity A number within the range [0.0, 1.0].\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.getById( 'myElement' );\r
-                * <b>element.setOpacity( 0.75 )</b>;\r
-                */\r
-               setOpacity : function( opacity )\r
-               {\r
-                       if ( CKEDITOR.env.ie )\r
-                       {\r
-                               opacity = Math.round( opacity * 100 );\r
-                               this.setStyle( 'filter', opacity >= 100 ? '' : 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')' );\r
-                       }\r
-                       else\r
-                               this.setStyle( 'opacity', opacity );\r
-               },\r
-\r
-               /**\r
-                * Makes the element and its children unselectable.\r
-                * @function\r
-                * @example\r
-                * var element = CKEDITOR.dom.element.getById( 'myElement' );\r
-                * element.unselectable();\r
-                */\r
-               unselectable :\r
-                       CKEDITOR.env.gecko ?\r
-                               function()\r
-                               {\r
-                                       this.$.style.MozUserSelect = 'none';\r
-                                       this.on( 'dragstart', function( evt ) { evt.data.preventDefault(); } );\r
-                               }\r
-                       : CKEDITOR.env.webkit ?\r
-                               function()\r
-                               {\r
-                                       this.$.style.KhtmlUserSelect = 'none';\r
-                                       this.on( 'dragstart', function( evt ) { evt.data.preventDefault(); } );\r
-                               }\r
-                       :\r
-                               function()\r
-                               {\r
-                                       if ( CKEDITOR.env.ie || CKEDITOR.env.opera )\r
-                                       {\r
-                                               var element = this.$,\r
-                                                       e,\r
-                                                       i = 0;\r
-\r
-                                               element.unselectable = 'on';\r
-\r
-                                               while ( ( e = element.all[ i++ ] ) )\r
-                                               {\r
-                                                       switch ( e.tagName.toLowerCase() )\r
-                                                       {\r
-                                                               case 'iframe' :\r
-                                                               case 'textarea' :\r
-                                                               case 'input' :\r
-                                                               case 'select' :\r
-                                                                       /* Ignore the above tags */\r
-                                                                       break;\r
-                                                               default :\r
-                                                                       e.unselectable = 'on';\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               },\r
-\r
-               getPositionedAncestor : function()\r
-               {\r
-                       var current = this;\r
-                       while ( current.getName() != 'html' )\r
-                       {\r
-                               if ( current.getComputedStyle( 'position' ) != 'static' )\r
-                                       return current;\r
-\r
-                               current = current.getParent();\r
-                       }\r
-                       return null;\r
-               },\r
-\r
-               getDocumentPosition : function( refDocument )\r
-               {\r
-                       var x = 0, y = 0,\r
-                               body = this.getDocument().getBody(),\r
-                               quirks = this.getDocument().$.compatMode == 'BackCompat';\r
-\r
-                       var doc = this.getDocument();\r
-\r
-                       if ( document.documentElement[ "getBoundingClientRect" ] )\r
-                       {\r
-                               var box  = this.$.getBoundingClientRect(),\r
-                                       $doc = doc.$,\r
-                                       $docElem = $doc.documentElement;\r
-\r
-                               var clientTop = $docElem.clientTop || body.$.clientTop || 0,\r
-                                       clientLeft = $docElem.clientLeft || body.$.clientLeft || 0,\r
-                                       needAdjustScrollAndBorders = true;\r
-\r
-                               /*\r
-                                * #3804: getBoundingClientRect() works differently on IE and non-IE\r
-                                * browsers, regarding scroll positions.\r
-                                *\r
-                                * On IE, the top position of the <html> element is always 0, no matter\r
-                                * how much you scrolled down.\r
-                                *\r
-                                * On other browsers, the top position of the <html> element is negative\r
-                                * scrollTop.\r
-                                */\r
-                               if ( CKEDITOR.env.ie )\r
-                               {\r
-                                       var inDocElem = doc.getDocumentElement().contains( this ),\r
-                                               inBody = doc.getBody().contains( this );\r
-\r
-                                       needAdjustScrollAndBorders = ( quirks && inBody ) || ( !quirks && inDocElem );\r
-                               }\r
-\r
-                               if ( needAdjustScrollAndBorders )\r
-                               {\r
-                                       x = box.left + ( !quirks && $docElem.scrollLeft || body.$.scrollLeft );\r
-                                       x -= clientLeft;\r
-                                       y = box.top  + ( !quirks && $docElem.scrollTop || body.$.scrollTop );\r
-                                       y -= clientTop;\r
-                               }\r
-                       }\r
-                       else\r
-                       {\r
-                               var current = this, previous = null, offsetParent;\r
-                               while ( current && !( current.getName() == 'body' || current.getName() == 'html' ) )\r
-                               {\r
-                                       x += current.$.offsetLeft - current.$.scrollLeft;\r
-                                       y += current.$.offsetTop - current.$.scrollTop;\r
-\r
-                                       // Opera includes clientTop|Left into offsetTop|Left.\r
-                                       if ( !current.equals( this ) )\r
-                                       {\r
-                                               x += ( current.$.clientLeft || 0 );\r
-                                               y += ( current.$.clientTop || 0 );\r
-                                       }\r
-\r
-                                       var scrollElement = previous;\r
-                                       while ( scrollElement && !scrollElement.equals( current ) )\r
-                                       {\r
-                                               x -= scrollElement.$.scrollLeft;\r
-                                               y -= scrollElement.$.scrollTop;\r
-                                               scrollElement = scrollElement.getParent();\r
-                                       }\r
-\r
-                                       previous = current;\r
-                                       current = ( offsetParent = current.$.offsetParent ) ?\r
-                                                 new CKEDITOR.dom.element( offsetParent ) : null;\r
-                               }\r
-                       }\r
-\r
-                       if ( refDocument )\r
-                       {\r
-                               var currentWindow = this.getWindow(),\r
-                                       refWindow = refDocument.getWindow();\r
-\r
-                               if ( !currentWindow.equals( refWindow ) && currentWindow.$.frameElement )\r
-                               {\r
-                                       var iframePosition = ( new CKEDITOR.dom.element( currentWindow.$.frameElement ) ).getDocumentPosition( refDocument );\r
-\r
-                                       x += iframePosition.x;\r
-                                       y += iframePosition.y;\r
-                               }\r
-                       }\r
-\r
-                       if ( !document.documentElement[ "getBoundingClientRect" ] )\r
-                       {\r
-                               // In Firefox, we'll endup one pixel before the element positions,\r
-                               // so we must add it here.\r
-                               if ( CKEDITOR.env.gecko && !quirks )\r
-                               {\r
-                                       x += this.$.clientLeft ? 1 : 0;\r
-                                       y += this.$.clientTop ? 1 : 0;\r
-                               }\r
-                       }\r
-\r
-                       return { x : x, y : y };\r
-               },\r
-\r
-               scrollIntoView : function( alignTop )\r
-               {\r
-                       // Get the element window.\r
-                       var win = this.getWindow(),\r
-                               winHeight = win.getViewPaneSize().height;\r
-\r
-                       // Starts from the offset that will be scrolled with the negative value of\r
-                       // the visible window height.\r
-                       var offset = winHeight * -1;\r
-\r
-                       // Append the view pane's height if align to top.\r
-                       // Append element height if we are aligning to the bottom.\r
-                       if ( alignTop )\r
-                               offset += winHeight;\r
-                       else\r
-                       {\r
-                               offset += this.$.offsetHeight || 0;\r
-\r
-                               // Consider the margin in the scroll, which is ok for our current needs, but\r
-                               // needs investigation if we will be using this function in other places.\r
-                               offset += parseInt( this.getComputedStyle( 'marginBottom' ) || 0, 10 ) || 0;\r
-                       }\r
-\r
-                       // Append the offsets for the entire element hierarchy.\r
-                       var elementPosition = this.getDocumentPosition();\r
-                       offset += elementPosition.y;\r
-\r
-                       // offset value might be out of range(nagative), fix it(#3692).\r
-                       offset = offset < 0 ? 0 : offset;\r
-\r
-                       // Scroll the window to the desired position, if not already visible(#3795).\r
-                       var currentScroll = win.getScrollPosition().y;\r
-                       if ( offset > currentScroll || offset < currentScroll - winHeight )\r
-                               win.$.scrollTo( 0, offset );\r
-               },\r
-\r
-               setState : function( state )\r
-               {\r
-                       switch ( state )\r
-                       {\r
-                               case CKEDITOR.TRISTATE_ON :\r
-                                       this.addClass( 'cke_on' );\r
-                                       this.removeClass( 'cke_off' );\r
-                                       this.removeClass( 'cke_disabled' );\r
-                                       break;\r
-                               case CKEDITOR.TRISTATE_DISABLED :\r
-                                       this.addClass( 'cke_disabled' );\r
-                                       this.removeClass( 'cke_off' );\r
-                                       this.removeClass( 'cke_on' );\r
-                                       break;\r
-                               default :\r
-                                       this.addClass( 'cke_off' );\r
-                                       this.removeClass( 'cke_on' );\r
-                                       this.removeClass( 'cke_disabled' );\r
-                                       break;\r
-                       }\r
-               },\r
-\r
-               /**\r
-                * Returns the inner document of this IFRAME element.\r
-                * @returns {CKEDITOR.dom.document} The inner document.\r
-                */\r
-               getFrameDocument : function()\r
-               {\r
-                       var $ = this.$;\r
-\r
-                       try\r
-                       {\r
-                               // In IE, with custom document.domain, it may happen that\r
-                               // the iframe is not yet available, resulting in "Access\r
-                               // Denied" for the following property access.\r
-                               $.contentWindow.document;\r
-                       }\r
-                       catch ( e )\r
-                       {\r
-                               // Trick to solve this issue, forcing the iframe to get ready\r
-                               // by simply setting its "src" property.\r
-                               $.src = $.src;\r
-\r
-                               // In IE6 though, the above is not enough, so we must pause the\r
-                               // execution for a while, giving it time to think.\r
-                               if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )\r
-                               {\r
-                                       window.showModalDialog(\r
-                                               'javascript:document.write("' +\r
-                                                       '<script>' +\r
-                                                               'window.setTimeout(' +\r
-                                                                       'function(){window.close();}' +\r
-                                                                       ',50);' +\r
-                                                       '</script>")' );\r
-                               }\r
-                       }\r
-\r
-                       return $ && new CKEDITOR.dom.document( $.contentWindow.document );\r
-               },\r
-\r
-               /**\r
-                * Copy all the attributes from one node to the other, kinda like a clone\r
-                * skipAttributes is an object with the attributes that must NOT be copied.\r
-                * @param {CKEDITOR.dom.element} dest The destination element.\r
-                * @param {Object} skipAttributes A dictionary of attributes to skip.\r
-                * @example\r
-                */\r
-               copyAttributes : function( dest, skipAttributes )\r
-               {\r
-                       var attributes = this.$.attributes;\r
-                       skipAttributes = skipAttributes || {};\r
-\r
-                       for ( var n = 0 ; n < attributes.length ; n++ )\r
-                       {\r
-                               var attribute = attributes[n];\r
-\r
-                               // Lowercase attribute name hard rule is broken for\r
-                               // some attribute on IE, e.g. CHECKED.\r
-                               var attrName = attribute.nodeName.toLowerCase(),\r
-                                       attrValue;\r
-\r
-                               // We can set the type only once, so do it with the proper value, not copying it.\r
-                               if ( attrName in skipAttributes )\r
-                                       continue;\r
-\r
-                               if ( attrName == 'checked' && ( attrValue = this.getAttribute( attrName ) ) )\r
-                                       dest.setAttribute( attrName, attrValue );\r
-                               // IE BUG: value attribute is never specified even if it exists.\r
-                               else if ( attribute.specified ||\r
-                                 ( CKEDITOR.env.ie && attribute.nodeValue && attrName == 'value' ) )\r
-                               {\r
-                                       attrValue = this.getAttribute( attrName );\r
-                                       if ( attrValue === null )\r
-                                               attrValue = attribute.nodeValue;\r
-\r
-                                       dest.setAttribute( attrName, attrValue );\r
-                               }\r
-                       }\r
-\r
-                       // The style:\r
-                       if ( this.$.style.cssText !== '' )\r
-                               dest.$.style.cssText = this.$.style.cssText;\r
-               },\r
-\r
-               /**\r
-                * Changes the tag name of the current element.\r
-                * @param {String} newTag The new tag for the element.\r
-                */\r
-               renameNode : function( newTag )\r
-               {\r
-                       // If it's already correct exit here.\r
-                       if ( this.getName() == newTag )\r
-                               return;\r
-\r
-                       var doc = this.getDocument();\r
-\r
-                       // Create the new node.\r
-                       var newNode = new CKEDITOR.dom.element( newTag, doc );\r
-\r
-                       // Copy all attributes.\r
-                       this.copyAttributes( newNode );\r
-\r
-                       // Move children to the new node.\r
-                       this.moveChildren( newNode );\r
-\r
-                       // Replace the node.\r
-                       this.getParent() && this.$.parentNode.replaceChild( newNode.$, this.$ );\r
-                       newNode.$[ 'data-cke-expando' ] = this.$[ 'data-cke-expando' ];\r
-                       this.$ = newNode.$;\r
-               },\r
-\r
-               /**\r
-                * Gets a DOM tree descendant under the current node.\r
-                * @param {Array|Number} indices The child index or array of child indices under the node.\r
-                * @returns {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist.\r
-                * @example\r
-                * var strong = p.getChild(0);\r
-                */\r
-               getChild : function( indices )\r
-               {\r
-                       var rawNode = this.$;\r
-\r
-                       if ( !indices.slice )\r
-                               rawNode = rawNode.childNodes[ indices ];\r
-                       else\r
-                       {\r
-                               while ( indices.length > 0 && rawNode )\r
-                                       rawNode = rawNode.childNodes[ indices.shift() ];\r
-                       }\r
-\r
-                       return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;\r
-               },\r
-\r
-               getChildCount : function()\r
-               {\r
-                       return this.$.childNodes.length;\r
-               },\r
-\r
-               disableContextMenu : function()\r
-               {\r
-                       this.on( 'contextmenu', function( event )\r
-                               {\r
-                                       // Cancel the browser context menu.\r
-                                       if ( !event.data.getTarget().hasClass( 'cke_enable_context_menu' ) )\r
-                                               event.data.preventDefault();\r
-                               } );\r
-               },\r
-\r
-               /**\r
-                * Gets element's direction. Supports both CSS 'direction' prop and 'dir' attr.\r
-                */\r
-               getDirection : function( useComputed )\r
-               {\r
-                       return useComputed ?\r
-                               this.getComputedStyle( 'direction' )\r
-                                       // Webkit: offline element returns empty direction (#8053).\r
-                                       || this.getDirection()\r
-                                       || this.getDocument().$.dir\r
-                                       || this.getDocument().getBody().getDirection( 1 )\r
-                               : this.getStyle( 'direction' ) || this.getAttribute( 'dir' );\r
-               },\r
-\r
-               /**\r
-                * Gets, sets and removes custom data to be stored as HTML5 data-* attributes.\r
-                * @param {String} name The name of the attribute, excluding the 'data-' part.\r
-                * @param {String} [value] The value to set. If set to false, the attribute will be removed.\r
-                * @example\r
-                * element.data( 'extra-info', 'test' );   // appended the attribute data-extra-info="test" to the element\r
-                * alert( element.data( 'extra-info' ) );  // "test"\r
-                * element.data( 'extra-info', false );    // remove the data-extra-info attribute from the element\r
-                */\r
-               data : function ( name, value )\r
-               {\r
-                       name = 'data-' + name;\r
-                       if ( value === undefined )\r
-                               return this.getAttribute( name );\r
-                       else if ( value === false )\r
-                               this.removeAttribute( name );\r
-                       else\r
-                               this.setAttribute( name, value );\r
-\r
-                       return null;\r
-               }\r
-       });\r
-\r
-( function()\r
-{\r
-       var sides = {\r
-               width : [ "border-left-width", "border-right-width","padding-left", "padding-right" ],\r
-               height : [ "border-top-width", "border-bottom-width", "padding-top",  "padding-bottom" ]\r
-       };\r
-\r
-       function marginAndPaddingSize( type )\r
-       {\r
-               var adjustment = 0;\r
-               for ( var i = 0, len = sides[ type ].length; i < len; i++ )\r
-                       adjustment += parseInt( this.getComputedStyle( sides [ type ][ i ] ) || 0, 10 ) || 0;\r
-               return adjustment;\r
-       }\r
-\r
-       /**\r
-        * Sets the element size considering the box model.\r
-        * @name CKEDITOR.dom.element.prototype.setSize\r
-        * @function\r
-        * @param {String} type The dimension to set. It accepts "width" and "height".\r
-        * @param {Number} size The length unit in px.\r
-        * @param {Boolean} isBorderBox Apply the size based on the border box model.\r
-        */\r
-       CKEDITOR.dom.element.prototype.setSize = function( type, size, isBorderBox )\r
-               {\r
-                       if ( typeof size == 'number' )\r
-                       {\r
-                               if ( isBorderBox && !( CKEDITOR.env.ie && CKEDITOR.env.quirks ) )\r
-                                       size -= marginAndPaddingSize.call( this, type );\r
-\r
-                               this.setStyle( type, size + 'px' );\r
-                       }\r
-               };\r
-\r
-       /**\r
-        * Gets the element size, possibly considering the box model.\r
-        * @name CKEDITOR.dom.element.prototype.getSize\r
-        * @function\r
-        * @param {String} type The dimension to get. It accepts "width" and "height".\r
-        * @param {Boolean} isBorderBox Get the size based on the border box model.\r
-        */\r
-       CKEDITOR.dom.element.prototype.getSize = function( type, isBorderBox )\r
-               {\r
-                       var size = Math.max( this.$[ 'offset' + CKEDITOR.tools.capitalize( type )  ],\r
-                               this.$[ 'client' + CKEDITOR.tools.capitalize( type )  ] ) || 0;\r
-\r
-                       if ( isBorderBox )\r
-                               size -= marginAndPaddingSize.call( this, type );\r
-\r
-                       return size;\r
-               };\r
-})();\r