]>
git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blob - sources/core/htmlparser/comment.js
2 * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
9 * A lightweight representation of an HTML comment.
12 * @extends CKEDITOR.htmlParser.node
13 * @constructor Creates a comment class instance.
14 * @param {String} value The comment text value.
16 CKEDITOR
.htmlParser
.comment = function( value
) {
30 CKEDITOR
.htmlParser
.comment
.prototype = CKEDITOR
.tools
.extend( new CKEDITOR
.htmlParser
.node(), {
32 * The node type. This is a constant value set to {@link CKEDITOR#NODE_COMMENT}.
35 * @property {Number} [=CKEDITOR.NODE_COMMENT]
37 type: CKEDITOR
.NODE_COMMENT
,
40 * Filter this comment with given filter.
43 * @param {CKEDITOR.htmlParser.filter} filter
44 * @returns {Boolean} Method returns `false` when this comment has
45 * been removed or replaced with other node. This is an information for
46 * {@link CKEDITOR.htmlParser.element#filterChildren} that it has
47 * to repeat filter on current position in parent's children array.
49 filter: function( filter
, context
) {
50 var comment
= this.value
;
52 if ( !( comment
= filter
.onComment( context
, comment
, this ) ) ) {
57 if ( typeof comment
!= 'string' ) {
58 this.replaceWith( comment
);
68 * Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.
70 * @param {CKEDITOR.htmlParser.basicWriter} writer The writer to which write the HTML.
71 * @param {CKEDITOR.htmlParser.filter} [filter] The filter to be applied to this node.
72 * **Note:** it's unsafe to filter offline (not appended) node.
74 writeHtml: function( writer
, filter
) {
76 this.filter( filter
);
78 writer
.comment( this.value
);