X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Fnode.js;h=ef41e06bafb09cd617ac9aac2c28cfc6f6e50cee;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hp=661154550ab0a83efd8b080952a664e8e98fb7c2;hpb=614511639979907ceb0da3614122a4d8eb963ad4;p=ckeditor.git diff --git a/_source/core/dom/node.js b/_source/core/dom/node.js index 6611545..ef41e06 100644 --- a/_source/core/dom/node.js +++ b/_source/core/dom/node.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -107,24 +107,25 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { var $clone = this.$.cloneNode( includeChildren ); - if ( !cloneId ) + var removeIds = function( node ) { - var removeIds = function( node ) - { - if ( node.nodeType != CKEDITOR.NODE_ELEMENT ) - return; + if ( node.nodeType != CKEDITOR.NODE_ELEMENT ) + return; - node.removeAttribute( 'id', false ) ; - node.removeAttribute( '_cke_expando', false ) ; + if ( !cloneId ) + node.removeAttribute( 'id', false ); + node.removeAttribute( 'data-cke-expando', false ); + if ( includeChildren ) + { var childs = node.childNodes; - for ( var i=0 ; i < childs.length ; i++ ) + for ( var i=0; i < childs.length; i++ ) removeIds( childs[ i ] ); - }; + } + }; - // The "id" attribute should never be cloned to avoid duplication. - removeIds( $clone ); - } + // The "id" attribute should never be cloned to avoid duplication. + removeIds( $clone ); return new CKEDITOR.dom.node( $clone ); }, @@ -243,13 +244,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, */ getDocument : function() { - var document = new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument ); - - return ( - this.getDocument = function() - { - return document; - })(); + return new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument ); }, getIndex : function() @@ -669,13 +664,13 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, * @since 3.5 * @example * // For the following HTML: - * //
Some text
+ * // <div contenteditable="false">Some <b>text</b></div> * - * // If "ele" is the above
- * ele.getReadOnlyRoot(); // the
element + * // If "ele" is the above <div> + * ele.isReadOnly(); // the <div> element * - * // If "ele" is the above - * ele.getReadOnlyRoot(); // the
element + * // If "ele" is the above <b> + * ele.isReadOnly(); // the <div> element */ isReadOnly : function() { @@ -684,7 +679,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { if ( current.type == CKEDITOR.NODE_ELEMENT ) { - if ( current.is( 'body' ) || current.getCustomData( '_cke_notReadOnly' ) ) + if ( current.is( 'body' ) || !!current.data( 'cke-editable' ) ) break; if ( current.getAttribute( 'contentEditable' ) == 'false' )