JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.1
[ckeditor.git] / _source / core / htmlparser / comment.js
1 /*\r
2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 /**\r
7  * A lightweight representation of an HTML comment.\r
8  * @constructor\r
9  * @example\r
10  */\r
11 CKEDITOR.htmlParser.comment = function( value )\r
12 {\r
13         /**\r
14          * The comment text.\r
15          * @type String\r
16          * @example\r
17          */\r
18         this.value = value;\r
19 \r
20         /** @private */\r
21         this._ =\r
22         {\r
23                 isBlockLike : false\r
24         };\r
25 };\r
26 \r
27 CKEDITOR.htmlParser.comment.prototype =\r
28 {\r
29         /**\r
30          * The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}.\r
31          * @type Number\r
32          * @example\r
33          */\r
34         type : CKEDITOR.NODE_COMMENT,\r
35 \r
36         /**\r
37          * Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.\r
38          * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.\r
39          * @example\r
40          */\r
41         writeHtml : function( writer, filter )\r
42         {\r
43                 var comment = this.value;\r
44 \r
45                 if ( filter )\r
46                 {\r
47                         if ( !( comment = filter.onComment( comment, this ) ) )\r
48                                 return;\r
49 \r
50                         if ( typeof comment != 'string' )\r
51                         {\r
52                                 comment.parent = this.parent;\r
53                                 comment.writeHtml( writer, filter );\r
54                                 return;\r
55                         }\r
56                 }\r
57 \r
58                 writer.comment( comment );\r
59         }\r
60 };\r