# 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.fragment

Defined in: core/htmlparser/fragment.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.htmlParser.fragment() A lightweight representation of an HTML DOM structure.

Field Summary
Field Attributes | Field Name and Description
--- | ---
| children The nodes contained in the root of this fragment.
| parent Get the fragment parent.

Method Summary
Method Attributes | Method Name and Description
--- | ---
<static> | CKEDITOR.htmlParser.fragment.fromHtml(fragmentHtml, fixForBody) Creates a CKEDITOR.htmlParser.fragment from an HTML string.
| add(node) Adds a node to this fragment.
| writeHtml(writer, filter) Writes the fragment HTML to a CKEDITOR.htmlWriter.

Class Detail
CKEDITOR.htmlParser.fragment()
Since: 3.0
A lightweight representation of an HTML DOM structure.
Field Detail
{Array} children
Since: 3.0
The nodes contained in the root of this fragment.

    var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' );
    alert( fragment.children.length );  "2"

{Object} parent
Since: 3.0
Get the fragment parent. Should always be null.

Default Value:
  null

Method Detail
<static> {Undefined} CKEDITOR.htmlParser.fragment.fromHtml(fragmentHtml, fixForBody)
Since: 3.0
Creates a CKEDITOR.htmlParser.fragment from an HTML string.

    var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' );
    alert( fragment.children[0].name );  "b"
    alert( fragment.children[1].value );  " Text"

Parameters:
{String} fragmentHtml
  The HTML to be parsed, filling the fragment.
{Number} fixForBody Optional, Default: false
  Wrap body with specified element if needed.

Returns:
  {Undefined} CKEDITOR.htmlParser.fragment The fragment created.

{Undefined} add(node)
Since: 3.0
Adds a node to this fragment.

Parameters:
{Object} node
  The node to be added. It can be any of of the following types: CKEDITOR.htmlParser.element, CKEDITOR.htmlParser.text and CKEDITOR.htmlParser.comment.

{Undefined} writeHtml(writer, filter)
Since: 3.0
Writes the fragment HTML to a CKEDITOR.htmlWriter.

    var writer = new CKEDITOR.htmlWriter();
    var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<P><B>Example' );
    fragment.writeHtml( writer )
    alert( writer.getHtml() );  "<p><b>Example</b></p>"

Parameters:
{CKEDITOR.htmlWriter} writer
  The writer to which write the HTML.
{Undefined} filter

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