JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0
[ckeditor.git] / _source / core / htmlparser / comment.js
diff --git a/_source/core/htmlparser/comment.js b/_source/core/htmlparser/comment.js
new file mode 100644 (file)
index 0000000..c2f4f25
--- /dev/null
@@ -0,0 +1,59 @@
+/*\r
+Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+\r
+/**\r
+ * A lightweight representation of an HTML comment.\r
+ * @constructor\r
+ * @example\r
+ */\r
+CKEDITOR.htmlParser.comment = function( value )\r
+{\r
+       /**\r
+        * The comment text.\r
+        * @type String\r
+        * @example\r
+        */\r
+       this.value = value;\r
+\r
+       /** @private */\r
+       this._ =\r
+       {\r
+               isBlockLike : false\r
+       };\r
+};\r
+\r
+CKEDITOR.htmlParser.comment.prototype =\r
+{\r
+       /**\r
+        * The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}.\r
+        * @type Number\r
+        * @example\r
+        */\r
+       type : CKEDITOR.NODE_COMMENT,\r
+\r
+       /**\r
+        * Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.\r
+        * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.\r
+        * @example\r
+        */\r
+       writeHtml : function( writer, filter )\r
+       {\r
+               var comment = this.value;\r
+\r
+               if ( filter )\r
+               {\r
+                       if ( !( comment = filter.onComment( comment ) ) )\r
+                               return;\r
+\r
+                       if ( typeof comment != 'string' )\r
+                       {\r
+                               comment.writeHtml( writer, filter );\r
+                               return;\r
+                       }\r
+               }\r
+\r
+               writer.comment( comment );\r
+       }\r
+};\r