Code Index | File Index

Namespaces

Classes


Class CKEDITOR.htmlParser.fragment


Defined in: core/htmlparser/fragment.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
A lightweight representation of an HTML DOM structure.
Field Summary
Field Attributes Field Name and Description
 
The nodes contained in the root of this fragment.
 
Get the fragment parent.
Method Summary
Method Attributes Method Name and Description
<static>  
CKEDITOR.htmlParser.fragment.fromBBCode(source, fixForBody)
Creates a CKEDITOR.htmlParser.fragment from an HTML string.
<static>  
CKEDITOR.htmlParser.fragment.fromHtml(fragmentHtml, fixForBody, contextNode)
Creates a CKEDITOR.htmlParser.fragment from an HTML string.
 
add(node, index)
Adds a node to this fragment.
 
 
writeChildrenHtml(writer, filter)
 
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.fromBBCode(source, fixForBody)
Since: 3.0
Creates a CKEDITOR.htmlParser.fragment from an HTML string.
Defined in: plugins/bbcode/plugin.js.
var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' );
alert( fragment.children[0].name );  "b"
alert( fragment.children[1].value );  " Text"
Parameters:
{String} source
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.

<static> {Undefined} CKEDITOR.htmlParser.fragment.fromHtml(fragmentHtml, fixForBody, contextNode)
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.
{CKEDITOR.htmlParser.element} contextNode
Parse the html as the content of this element.
Returns:
{Undefined} CKEDITOR.htmlParser.fragment The fragment created.

{Undefined} add(node, index)
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.
{Number} index Optional
From where the insertion happens.

{Undefined} filterChildren()
Since: 3.0
NO EXAMPLE AVAILABLE

{Undefined} writeChildrenHtml(writer, filter)
Since: 3.0
NO EXAMPLE AVAILABLE
Parameters:
{Undefined} writer
{Undefined} filter

{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-2010, CKSource - Frederico Knabben. All rights reserved.