Code Index | File Index

Namespaces

Classes


Class CKEDITOR.htmlParser


Defined in: core/htmlparser.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
HTML text parser.
Method Summary
Method Attributes Method Name and Description
 
onComment(comment)
Function to be fired when a commend is found.
 
onTagClose(tagName)
Function to be fired when a tag closer is found.
 
onTagOpen(tagName, attributes, selfClosing)
Function to be fired when a tag opener is found.
 
onText(text)
Function to be fired when text is found.
 
parse(html)
Parses text, looking for HTML tokens, like tag openers or closers, or comments.
Class Detail
CKEDITOR.htmlParser()
Since: 3.0
HTML text parser.
Method Detail
{Undefined} onComment(comment)
Since: 3.0
Function to be fired when a commend is found. This function should be overriden when using this class.
var parser = new CKEDITOR.htmlParser();
parser.onText = function( comment )
    {
        alert( comment );  // e.g. " Example "
    });
parser.parse( "<!-- Example --><b>Hello</b>" );
Parameters:
{String} comment
The comment text.

{Undefined} onTagClose(tagName)
Since: 3.0
Function to be fired when a tag closer is found. This function should be overriden when using this class.
var parser = new CKEDITOR.htmlParser();
parser.onTagClose = function( tagName )
    {
        alert( tagName );  // e.g. "b"
    });
parser.parse( "<!-- Example --><b>Hello</b>" );
Parameters:
{String} tagName
The tag name. The name is guarantted to be lowercased.

{Undefined} onTagOpen(tagName, attributes, selfClosing)
Since: 3.0
Function to be fired when a tag opener is found. This function should be overriden when using this class.
var parser = new CKEDITOR.htmlParser();
parser.onTagOpen = function( tagName, attributes, selfClosing )
    {
        alert( tagName );  // e.g. "b"
    });
parser.parse( "<!-- Example --><b>Hello</b>" );
Parameters:
{String} tagName
The tag name. The name is guarantted to be lowercased.
{Object} attributes
An object containing all tag attributes. Each property in this object represent and attribute name and its value is the attribute value.
{Boolean} selfClosing
true if the tag closes itself, false if the tag doesn't.

{Undefined} onText(text)
Since: 3.0
Function to be fired when text is found. This function should be overriden when using this class.
var parser = new CKEDITOR.htmlParser();
parser.onText = function( text )
    {
        alert( text );  // e.g. "Hello"
    });
parser.parse( "<!-- Example --><b>Hello</b>" );
Parameters:
{String} text
The text found.

{Undefined} parse(html)
Since: 3.0
Parses text, looking for HTML tokens, like tag openers or closers, or comments. This function fires the onTagOpen, onTagClose, onText and onComment function during its execution.
var parser = new CKEDITOR.htmlParser();
// The onTagOpen, onTagClose, onText and onComment should be overriden
// at this point.
parser.parse( "<!-- Example --><b>Hello</b>" );
Parameters:
{String} html
The HTML to be parsed.

Copyright © 2003-2009, CKSource - Frederico Knabben. All rights reserved.