1 /*
  2 Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
  3 For licensing, see LICENSE.html or http://ckeditor.com/license
  4 */
  5 
  6 /**
  7  * @fileOverview Defines the {@link CKEDITOR.dom.comment} class, which represents
  8  *		a DOM comment node.
  9  */
 10 
 11 /**
 12  * Represents a DOM comment node.
 13  * @constructor
 14  * @augments CKEDITOR.dom.node
 15  * @param {Object|String} comment A native DOM comment node or a string containing
 16  *		the text to use to create a new comment node.
 17  * @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
 18  *		the node in case of new node creation. Defaults to the current document.
 19  * @example
 20  * var nativeNode = document.createComment( 'Example' );
 21  * var comment = CKEDITOR.dom.comment( nativeNode );
 22  * @example
 23  * var comment = CKEDITOR.dom.comment( 'Example' );
 24  */
 25 CKEDITOR.dom.comment = function( comment, ownerDocument )
 26 {
 27 	if ( typeof comment == 'string' )
 28 		comment = ( ownerDocument ? ownerDocument.$ : document ).createComment( comment );
 29 
 30 	CKEDITOR.dom.domObject.call( this, comment );
 31 };
 32 
 33 CKEDITOR.dom.comment.prototype = new CKEDITOR.dom.node();
 34 
 35 CKEDITOR.tools.extend( CKEDITOR.dom.comment.prototype,
 36 	/** @lends CKEDITOR.dom.comment.prototype */
 37 	{
 38 		type : CKEDITOR.NODE_COMMENT,
 39 
 40 		getOuterHtml : function()
 41 		{
 42 			return '<!--' + this.$.nodeValue + '-->';
 43 		}
 44 	});
 45