Last updated

API / geotoolkit / report / dom / Document / Document

Class: Document

dom.Document.Document

Document

Hierarchy

Table of contents

Constructors
Accessors
Methods
Css Properties
Name Type Description
cssclassstringCss class

Contents

Constructors

new Document(options)

new Document(options?)

Parameters

Name Type
Optional optionsOptions

Overrides

Element.constructor

Accessors

adoptedStyleSheets

get adoptedStyleSheets(): CssStyleSheet[]

Returns clone array of a live collection which contains application specific CssStyleSheets Note: .adoptedStyleSheets can accept standard window.CssStyleSheet objects as well, but keep in mind that those kind of objects will be converted, and you will not be able to use it after also, all Carnac specific styles will be lost, or converted, if standard CssStyleSheet can not recognise it for example {border: 1px [pattern] color;}

Name

module:geotoolkit/report/dom/Document~Document#adoptedStyleSheets

Example

import {CssStyleSheet} from '@int/geotoolkit/report/dom/css/CssStyleSheet';
const sheet = new CssStyleSheet();
sheet.replaceSync('a { color: red; }');
// Combine existing sheets with our new one:
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];

Returns

CssStyleSheet[]

set adoptedStyleSheets(styleSheets): void

Returns clone array of a live collection which contains application specific CssStyleSheets Note: .adoptedStyleSheets can accept standard window.CssStyleSheet objects as well, but keep in mind that those kind of objects will be converted, and you will not be able to use it after also, all Carnac specific styles will be lost, or converted, if standard CssStyleSheet can not recognise it for example {border: 1px [pattern] color;}

Name

module:geotoolkit/report/dom/Document~Document#adoptedStyleSheets

Example

import {CssStyleSheet} from '@int/geotoolkit/report/dom/css/CssStyleSheet';
const sheet = new CssStyleSheet();
sheet.replaceSync('a { color: red; }');
// Combine existing sheets with our new one:
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];

Parameters

Name Type
styleSheetsCssStyleSheet[]

Returns

void


attributes

get attributes(): NamedItemMap

Node attributes

Name

module:geotoolkit/report/dom/Node~Node#attributes

Returns

NamedItemMap

Inherited from

Element.attributes


body

get body(): Body

DOM Document body element

Name

module:geotoolkit/report/dom/Document~Document#body

Returns

Body


childNodes

get childNodes(): NodeList<Node>

The element holding the item.

Name

module:geotoolkit/report/dom/Node~Node#childNodes

Returns

NodeList<Node>

Inherited from

Element.childNodes


children

get children(): NodeList<Element>

The children property returns a collection of an element's child elements, as an NodeList object.

Name

module:geotoolkit/report/dom/Element~Element#children

Returns

NodeList<Element>

Inherited from

Element.children


data

get data(): string

Node data

Name

module:geotoolkit/report/dom/Node~Node#data

Returns

string

Inherited from

Element.data

set data(data): void

Node data

Name

module:geotoolkit/report/dom/Node~Node#data

Parameters

Name Type
datastring

Returns

void

Inherited from

Element.data


documentElement

get documentElement(): Document

DOM Document root element

Name

module:geotoolkit/report/dom/Document~Document#documentElement

Returns

Document


firstChild

get firstChild(): Node

First child node

Name

module:geotoolkit/report/dom/Node~Node#firstChild

Returns

Node

Inherited from

Element.firstChild


get head(): Element

DOM Document root element

Name

module:geotoolkit/report/dom/Document~Document#head

Returns

Element


lastChild

get lastChild(): Node

Last child node

Name

module:geotoolkit/report/dom/Node~Node#lastChild

Returns

Node

Inherited from

Element.lastChild


localName

get localName(): string

Node local name

Name

module:geotoolkit/report/dom/Node~Node#localName

Returns

string

Inherited from

Element.localName


nextSibling

get nextSibling(): Node

Next sibling node

Name

module:geotoolkit/report/dom/Node~Node#nextSibling

Returns

Node

Inherited from

Element.nextSibling


nodeName

get nodeName(): string

Node name

Name

module:geotoolkit/report/dom/Node~Node#nodeName

Returns

string

Inherited from

Element.nodeName


nodeType

get nodeType(): NodeType

Node type

Name

module:geotoolkit/report/dom/Node~Node#nodeType

Returns

NodeType

Inherited from

Element.nodeType


nodeValue

get nodeValue(): string

Node value

Name

module:geotoolkit/report/dom/Node~Node#nodeValue

Returns

string

Inherited from

Element.nodeValue

set nodeValue(value): void

Node value

Name

module:geotoolkit/report/dom/Node~Node#nodeValue

Parameters

Name Type
valuestring

Returns

void

Inherited from

Element.nodeValue


ownerDocument

get ownerDocument(): Document

Node owner document

Name

module:geotoolkit/report/dom/Node~Node#ownerDocument

Returns

Document

Inherited from

Element.ownerDocument


parentNode

get parentNode(): Node

Parent node

Name

module:geotoolkit/report/dom/Node~Node#parentNode

Returns

Node

Inherited from

Element.parentNode


previousSibling

get previousSibling(): Node

Previous sibling node

Name

module:geotoolkit/report/dom/Node~Node#previousSibling

Returns

Node

Inherited from

Element.previousSibling


rootNode

get rootNode(): Node

Return root node

Deprecated

since 2022 (3.4) use Node#getRootNode instead

Name

module:geotoolkit/report/dom/Node~Node#rootNode

Returns

Node

Inherited from

Element.rootNode


styleSheets

get styleSheets(): Proxy<StyleSheetList>

Returns a live style sheet list which maintains an up-to-date list of the css rule objects that comprise the stylesheet.

Name

module:geotoolkit/report/dom/Document~Document#styleSheets

Returns

Proxy<StyleSheetList>


tagName

get tagName(): string

Node tag name

Name

module:geotoolkit/report/dom/Node~Node#tagName

Returns

string

Inherited from

Element.tagName

Methods

appendChild

appendChild(newChild): Document

Add child to the node

Parameters

Name Type Description
newChildNodechild to add

Returns

Document

Inherited from

Element.appendChild


clearAttributes

clearAttributes(): Document

Clear attributes

Returns

Document

Inherited from

Element.clearAttributes


clearNodes

clearNodes(): Document

Remove all child nodes from this node

Returns

Document

this

Inherited from

Element.clearNodes


connectStyle

connectStyle(style, type, callback): Document

Connects style.

This convenience method subscribes a listener to given style for the specified type.
And automatically un-subscribes listener if node is disposed to prevent memory leaks

Parameters

Name Type Description
styleEventDispatcherconnect style
typestringtype of event or property
callbackAttributeCallback<EventDispatcher>function to be called

Returns

Document

this

Inherited from

Element.connectStyle


createAttribute

createAttribute(options): Attribute

Create new Attribute

Parameters

Name Type Description
optionsstring | objector attribute name

Returns

Attribute


createElement

createElement(options, elementRegistry?): Element | Node

Create new element with specified tag name

Parameters

Name Type Description
optionsstring | Optionstag name or option
Optional elementRegistryIElementsRegistryshadow registry

Returns

Element | Node


disconnectStyle

disconnectStyle(style, type, callback): Document

Disconnect style
This convenience method un-subscribes a listener to given style for the specified type.

Parameters

Name Type Description
styleEventDispatcherconnect style
typestringtype of event or property
callbackAttributeCallback<EventDispatcher>function to be called

Returns

Document

this

Inherited from

Element.disconnectStyle


dispose

dispose(): void

Disposes this node, once disposes a node should not be used anymore.
Clear all listeners, and disconnect styles to avoid memory leaks.
Also aggressively 'cleanup' this node by setting some of its members to null.

Returns

void

Inherited from

Element.dispose


enumerateNodes

enumerateNodes(callback, target?): void

Enumerate children nodes

Parameters

Name Type Description
callbackCallback<Node>callback
Optional targetQueryBuilder<any>target

Returns

void

Inherited from

Element.enumerateNodes


flush

Protected flush(serializationContext?): Document

Flush all changes before saving

Parameters

Name Type Description
Optional serializationContextSerializationContextserialization Context

Returns

Document

Inherited from

Element.flush


getAttribute

getAttribute(name): string

Return attribute value

Parameters

Name Type Description
namestringattribute name

Returns

string

Inherited from

Element.getAttribute


getClassName

getClassName(): string

Returns

string

Inherited from

Element.getClassName


getCssClass

getCssClass(): string

Returns css class name to be used to apply CSS style

Returns

string

the css class name

Inherited from

Element.getCssClass


getDocumentElement

getDocumentElement(): Document

Return DOM root element

Returns

Document


getElementRegistry

getElementRegistry(): IElementsRegistry

Returns elements Registry

Returns

IElementsRegistry

Inherited from

Element.getElementRegistry


getGuid

getGuid(): string

Returns element GUID

Returns

string

Inherited from

Element.getGuid


getId

getId(): string

Returns element id

Returns

string

Inherited from

Element.getId


getInnerCssStyle

getInnerCssStyle(): string

Return collected inner css style

Returns

string

inner css style

Inherited from

Element.getInnerCssStyle


getNodeIndex

getNodeIndex(): number

Return node index

Returns

number

Inherited from

Element.getNodeIndex


getNodeValue

getNodeValue(): string

Returns node value

Returns

string

Inherited from

Element.getNodeValue


getParent

getParent(): Node

Returns parent node

Returns

Node

parent

Inherited from

Element.getParent


getProperties

getProperties(): Options

Gets the element properties

Returns

Options

props

Inherited from

Element.getProperties


getRootNode

getRootNode(): Node

Return root node

Returns

Node

node

Inherited from

Element.getRootNode


getTagName

getTagName(): string

Returns node tag name

Returns

string

Inherited from

Element.getTagName


getTimeStamp

getTimeStamp(): number

Gets time stamp

Returns

number

timeStamp

Inherited from

Element.getTimeStamp


hasAttribute

hasAttribute(name): boolean

Check if attribute exists

Parameters

Name Type Description
namestringattribute name

Returns

boolean

Inherited from

Element.hasAttribute


hasChildNodes

hasChildNodes(): boolean

Return true if node has children

Returns

boolean

Inherited from

Element.hasChildNodes


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

Element.hasEventListener


indexOfNode

indexOfNode(node): number

Returns index of node.

Parameters

Name Type Description
nodeNodeitem to get index of

Returns

number

Inherited from

Element.indexOfNode


insertAfter

insertAfter(newChild, refChild): Node

Insert child

Parameters

Name Type Description
newChildNodechild to insert
refChildNoderef child

Returns

Node

Inherited from

Element.insertAfter


insertBefore

insertBefore(newChild, refChild): Node

Insert child

Parameters

Name Type Description
newChildNodechild to insert
refChildNoderef child

Returns

Node

Inherited from

Element.insertBefore


invalidate

Protected invalidate(): Document

Returns

Document

this

Inherited from

Element.invalidate


invalidateDocument

Protected invalidateDocument(eventArgs): Document

Invalidate root document

Parameters

Name Type Description
eventArgsNodeEventArgsevent args

Returns

Document

this

Inherited from

Element.invalidateDocument


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

Element.isDisposed


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

Element.isSilent


lock

lock(): Document

Lock document

Returns

Document

Overrides

Element.lock


normalize

normalize(): Document

Puts the specified node and all of its subtree into a "normalized" form. In a normalized sub-tree, no text nodes in the sub-tree are empty and there are no adjacent text nodes.

Returns

Document

this

Inherited from

Element.normalize


notify

notify<E>(type, source, args?): Document

Notify listeners

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourceDocumentof the event
Optional argsEventMap[E]arguments of the event

Returns

Document

this

Overrides

Element.notify


off

off<E>(type?, callback?): Document

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: Document, args: EventMap[E]) => voidfunction to be called

Returns

Document

this

Overrides

Element.off


on

on<E>(type, callback): Document

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: Document, args: EventMap[E]) => voidto be called

Returns

Document

this

Overrides

Element.on


onParentChanged

Protected onParentChanged(): Document

Returns

Document

this

Inherited from

Element.onParentChanged


onResetCssProperties

Protected onResetCssProperties(silent?): Document

Clean up cached properties

Parameters

Name Type Description
Optional silentbooleansilent reset

Returns

Document

this

Inherited from

Element.onResetCssProperties


removeAttribute

removeAttribute(name): Document

Remove attribute

Parameters

Name Type Description
namestringattribute name

Returns

Document

Inherited from

Element.removeAttribute


removeChild

removeChild(child): Node

Remove child from node

Parameters

Name Type Description
childNodeto remove

Returns

Node

Inherited from

Element.removeChild


replaceChild

replaceChild(newChild, oldChild): Document

Replace child

Parameters

Name Type Description
newChildNodechild to replace with
oldChildNodechild to replace

Returns

Document

Inherited from

Element.replaceChild


resetElementStyle

Protected resetElementStyle(): Document

Reset own styles

Returns

Document

Inherited from

Element.resetElementStyle


save

save(recursive?, serializationContext?): string

Serialize element to xml

Parameters

Name Type Description
Optional recursivebooleansave whole dom element structure
Optional serializationContextSerializationContextserialization Context

Returns

string

Inherited from

Element.save


setAttribute

setAttribute(name, value): Document

Set attribute value

Parameters

Name Type Description
namestringattribute name
valuestringattribute value

Returns

Document

Inherited from

Element.setAttribute


setAttributeNode

setAttributeNode(newAttr): Document

Adds a new Attribute node to the specified element.

Parameters

Name Type Description
newAttrAttributeattribute

Returns

Document

this

Inherited from

Element.setAttributeNode


setCssClass

setCssClass(cssClass): Document

Set css class

Parameters

Name Type Description
cssClassstringcss class

Returns

Document

Inherited from

Element.setCssClass


setElementRegistry

Protected setElementRegistry(registry): Document

Set shadow element registry

Parameters

Name Type Description
registryIElementsRegistryelements registry

Returns

Document

Inherited from

Element.setElementRegistry


setGuid

setGuid(guid): Document

Set node GUID

Parameters

Name Type Description
guidstringnode GUID

Returns

Document

Inherited from

Element.setGuid


setNodeValue

setNodeValue(nodeValue): Document

Set node value

Parameters

Name Type Description
nodeValuestringnode value

Returns

Document

Inherited from

Element.setNodeValue


setProperties

setProperties(properties?): Document

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

Document

this

Inherited from

Element.setProperties


setSilent

setSilent(bool): Document

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

Document

this

Inherited from

Element.setSilent


setText

setText(text): Document

Set text value

Parameters

Name Type Description
textstringtext value

Returns

Document

this

Inherited from

Element.setText


setXmlContent

setXmlContent(xmlValue): Promise<NodeList<Node>>

Set XML content

Parameters

Name Type Description
xmlValuestringxml to parse

Returns

Promise<NodeList<Node>>

promise

Inherited from

Element.setXmlContent


unlock

unlock(): Document

Unlock document

Returns

Document

Overrides

Element.unlock


updateTimeStamp

updateTimeStamp(): Document

Update time stamp to indicate that style has been changed.

Returns

Document

this

Inherited from

Element.updateTimeStamp


findParentNode

Static findParentNode<T>(node, classType): InstanceType<T>

Find root of the node with specified type

Type parameters

NameType
Textends Constructable<any>

Parameters

Name Type Description
nodeNodenode to start search
classTypeTtype of the class to search for or short interface name

Returns

InstanceType<T>

Inherited from

Element.findParentNode

Static findParentNode(node, classType): Node

Find root of the node with specified type

Parameters

Name Type Description
nodeNodenode to start search
classTypestringinterface name to search for

Returns

Node

Inherited from

Element.findParentNode


getClassName

Static getClassName(): string

Returns

string

Inherited from

Element.getClassName