# 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.dom.document

Extends CKEDITOR.dom.domObject.
Defined in: core/dom/document.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.dom.document(domDocument) Represents a DOM document.

Fields borrowed from class CKEDITOR.dom.domObject:
  $

Method Summary
Method Attributes | Method Name and Description
--- | ---
| appendStyleSheet(cssFileUrl) Appends a CSS file to the document.
| createElement(name, attribsAndStyles)
| createText(text)
| focus()
| getBody() Gets the <body> element for this document.
| getByAddress(address, normalized)
| getById(elementId) Gets and element based on its id.
| getDocumentElement()
| getElementsByTag(tagName, namespace)
| getHead() Gets the <head> element for this document.
| getSelection() Gets the current selection from the document.
| getWindow() Gets the window object that holds this document.

Methods borrowed from class CKEDITOR.dom.domObject:
  equals, getCustomData, getPrivate, setCustomData
Methods borrowed from class CKEDITOR.event:
  fire, fireOnce, hasListeners, implementOn, on, removeListener

Class Detail
CKEDITOR.dom.document(domDocument)
Since: 3.0
Represents a DOM document.

    var document = new CKEDITOR.dom.document( document );

Parameters:
{Object} domDocument
  A native DOM document.

Method Detail
{Undefined} appendStyleSheet(cssFileUrl)
Since: 3.0
Appends a CSS file to the document.

    CKEDITOR.document.appendStyleSheet( '/mystyles.css' );

Parameters:
{String} cssFileUrl
  The CSS file URL.

{Undefined} createElement(name, attribsAndStyles)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} name
{Undefined} attribsAndStyles

{Undefined} createText(text)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} text

{Undefined} focus()
Since: 3.0

    NO EXAMPLE AVAILABLE

{CKEDITOR.dom.element} getBody()
Since: 3.0
Gets the <body> element for this document.

    var element = CKEDITOR.document.getBody();
    alert( element.getName() );  // "body"

Returns:
  {CKEDITOR.dom.element} The <body> element.

{Undefined} getByAddress(address, normalized)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} address
{Undefined} normalized

{CKEDITOR.dom.element} getById(elementId)
Since: 3.0
Gets and element based on its id.

    var element = CKEDITOR.document.getById( 'myElement' );
    alert( element.getId() );  // "myElement"

Parameters:
{String} elementId
  The element id.

Returns:
  {CKEDITOR.dom.element} The element instance, or null if not found.

{Undefined} getDocumentElement()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} getElementsByTag(tagName, namespace)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} tagName
{Undefined} namespace

{CKEDITOR.dom.element} getHead()
Since: 3.0
Gets the <head> element for this document.

    var element = CKEDITOR.document.getHead();
    alert( element.getName() );  // "head"

Returns:
  {CKEDITOR.dom.element} The <head> element.

{CKEDITOR.dom.selection} getSelection()
Since: 3.0
Gets the current selection from the document.
Defined in: plugins/selection/plugin.js.

    var selection = CKEDITOR.instances.editor1.document.getSelection();
    alert( selection.getType() );

Returns:
  {CKEDITOR.dom.selection} A selection object.

{CKEDITOR.dom.window} getWindow()
Since: 3.0
Gets the window object that holds this document.

Returns:
  {CKEDITOR.dom.window} The window object.

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