JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / core / dom / comment.js
index 4c580da..05c13cf 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -8,19 +8,32 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  *             a DOM comment node.\r
  */\r
 \r
-CKEDITOR.dom.comment = CKEDITOR.tools.createClass(\r
+/**\r
+ * Represents a DOM comment node.\r
+ * @constructor\r
+ * @augments CKEDITOR.dom.node\r
+ * @param {Object|String} comment A native DOM comment node or a string containing\r
+ *             the text to use to create a new comment node.\r
+ * @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain\r
+ *             the node in case of new node creation. Defaults to the current document.\r
+ * @example\r
+ * var nativeNode = document.createComment( 'Example' );\r
+ * var comment = CKEDITOR.dom.comment( nativeNode );\r
+ * @example\r
+ * var comment = CKEDITOR.dom.comment( 'Example' );\r
+ */\r
+CKEDITOR.dom.comment = function( comment, ownerDocument )\r
 {\r
-       base : CKEDITOR.dom.node,\r
+       if ( typeof comment == 'string' )\r
+               comment = ( ownerDocument ? ownerDocument.$ : document ).createComment( comment );\r
 \r
-       $ : function( text, ownerDocument )\r
-       {\r
-               if ( typeof text == 'string' )\r
-                       text = ( ownerDocument ? ownerDocument.$ : document ).createComment( text );\r
+       CKEDITOR.dom.domObject.call( this, comment );\r
+};\r
 \r
-               this.base( text );\r
-       },\r
+CKEDITOR.dom.comment.prototype = new CKEDITOR.dom.node();\r
 \r
-       proto :\r
+CKEDITOR.tools.extend( CKEDITOR.dom.comment.prototype,\r
+       /** @lends CKEDITOR.dom.comment.prototype */\r
        {\r
                type : CKEDITOR.NODE_COMMENT,\r
 \r
@@ -28,5 +41,4 @@ CKEDITOR.dom.comment = CKEDITOR.tools.createClass(
                {\r
                        return '<!--' + this.$.nodeValue + '-->';\r
                }\r
-       }\r
-});\r
+       });\r