X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Fcomment.js;h=05c13cf147ecc3b1539edf7dc6afe48d7f7bbd07;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=4c580da89782a7cc115f944742bf879ec7287227;hpb=48b1db88210b4160dce439c6e3e32e14af8c106b;p=ckeditor.git diff --git a/_source/core/dom/comment.js b/_source/core/dom/comment.js index 4c580da..05c13cf 100644 --- a/_source/core/dom/comment.js +++ b/_source/core/dom/comment.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -8,19 +8,32 @@ For licensing, see LICENSE.html or http://ckeditor.com/license * a DOM comment node. */ -CKEDITOR.dom.comment = CKEDITOR.tools.createClass( +/** + * Represents a DOM comment node. + * @constructor + * @augments CKEDITOR.dom.node + * @param {Object|String} comment A native DOM comment node or a string containing + * the text to use to create a new comment node. + * @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain + * the node in case of new node creation. Defaults to the current document. + * @example + * var nativeNode = document.createComment( 'Example' ); + * var comment = CKEDITOR.dom.comment( nativeNode ); + * @example + * var comment = CKEDITOR.dom.comment( 'Example' ); + */ +CKEDITOR.dom.comment = function( comment, ownerDocument ) { - base : CKEDITOR.dom.node, + if ( typeof comment == 'string' ) + comment = ( ownerDocument ? ownerDocument.$ : document ).createComment( comment ); - $ : function( text, ownerDocument ) - { - if ( typeof text == 'string' ) - text = ( ownerDocument ? ownerDocument.$ : document ).createComment( text ); + CKEDITOR.dom.domObject.call( this, comment ); +}; - this.base( text ); - }, +CKEDITOR.dom.comment.prototype = new CKEDITOR.dom.node(); - proto : +CKEDITOR.tools.extend( CKEDITOR.dom.comment.prototype, + /** @lends CKEDITOR.dom.comment.prototype */ { type : CKEDITOR.NODE_COMMENT, @@ -28,5 +41,4 @@ CKEDITOR.dom.comment = CKEDITOR.tools.createClass( { return ''; } - } -}); + });