# CKEditor 3.0 JavaScript API Documentation

Code Index | File Index

## Namespaces

- CKEDITOR
- CKEDITOR.ajax
- CKEDITOR.config
- CKEDITOR.dom
- CKEDITOR.dtd
- CKEDITOR.env
- CKEDITOR.imageCacher
- CKEDITOR.loader
- CKEDITOR.plugins
- CKEDITOR.resourceManager
- CKEDITOR.scriptLoader
- CKEDITOR.skins
- CKEDITOR.test
- CKEDITOR.themes
- CKEDITOR.tools

## Classes

- CKEDITOR.commandDefinition
- CKEDITOR.dialog
- CKEDITOR.dialog.buttonDefinition
- CKEDITOR.dialog.contentDefinition
- CKEDITOR.dialog.contentDefinitionObject
- CKEDITOR.dialog.dialogDefinition
- CKEDITOR.dialog.dialogDefinitionObject
- CKEDITOR.dialog.uiElementDefinition
- CKEDITOR.dialogCommand
- CKEDITOR.dom.document
- CKEDITOR.dom.domObject
- CKEDITOR.dom.element
- CKEDITOR.dom.event
- CKEDITOR.dom.node
- CKEDITOR.dom.selection
- CKEDITOR.dom.text
- CKEDITOR.dom.window
- CKEDITOR.editor
- CKEDITOR.event
- CKEDITOR.eventInfo
- CKEDITOR.focusManager
- CKEDITOR.htmlParser
- CKEDITOR.htmlParser.cdata
- CKEDITOR.htmlParser.comment
- CKEDITOR.htmlParser.element
- CKEDITOR.htmlParser.fragment
- CKEDITOR.htmlParser.text
- CKEDITOR.htmlWriter
- CKEDITOR.keystrokeHandler
- CKEDITOR.pluginDefinition
- CKEDITOR.ui
- CKEDITOR.ui.button
- CKEDITOR.ui.dialog.button
- CKEDITOR.ui.dialog.checkbox
- CKEDITOR.ui.dialog.file
- CKEDITOR.ui.dialog.fileButton
- CKEDITOR.ui.dialog.hbox
- CKEDITOR.ui.dialog.html
- CKEDITOR.ui.dialog.labeledElement
- CKEDITOR.ui.dialog.radio
- CKEDITOR.ui.dialog.select
- CKEDITOR.ui.dialog.textarea
- CKEDITOR.ui.dialog.textInput
- CKEDITOR.ui.dialog.uiElement
- CKEDITOR.ui.dialog.vbox
- CKEDITOR.ui.handlerDefinition
- CKEDITOR.xml

# Class CKEDITOR.htmlParser

Defined in: core/htmlparser.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.htmlParser() HTML text parser.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| onCDATA(cdata) Function to be fired when CDATA section is found.
| 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} onCDATA(cdata)
Since: 3.0
Function to be fired when CDATA section is found. This function should be overriden when using this class.

    var parser = new CKEDITOR.htmlParser();
    parser.onCDATA = function( cdata )
        {
            alert( cdata );  // e.g. "var hello;"
        });
    parser.parse( "<script>var hello;</script>" );

Parameters:
{String} cdata
  The CDATA been found.

{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.