API / geotoolkit / report / dom / Document / Document
Document
↳
Document
Constructors
Accessors
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
cssclass | string | Css class |
Accessors
• 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];• 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];| Name | Type |
|---|---|
styleSheets | CssStyleSheet[] |
void
• get attributes(): NamedItemMap
Node attributes
Name
module:geotoolkit/report/dom/Node~Node#attributes
Element.attributes
• get body(): Body
DOM Document body element
Name
module:geotoolkit/report/dom/Document~Document#body
• get childNodes(): NodeList<Node>
The element holding the item.
Name
module:geotoolkit/report/dom/Node~Node#childNodes
Element.childNodes
• 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
Element.children
• get data(): string
Node data
Name
module:geotoolkit/report/dom/Node~Node#data
string
Element.data
• set data(data): void
Node data
Name
module:geotoolkit/report/dom/Node~Node#data
| Name | Type |
|---|---|
data | string |
void
Element.data
• get documentElement(): Document
DOM Document root element
Name
module:geotoolkit/report/dom/Document~Document#documentElement
• get firstChild(): Node
First child node
Name
module:geotoolkit/report/dom/Node~Node#firstChild
Element.firstChild
• get head(): Element
DOM Document root element
Name
module:geotoolkit/report/dom/Document~Document#head
• get lastChild(): Node
Last child node
Name
module:geotoolkit/report/dom/Node~Node#lastChild
Element.lastChild
• get localName(): string
Node local name
Name
module:geotoolkit/report/dom/Node~Node#localName
string
Element.localName
• get nextSibling(): Node
Next sibling node
Name
module:geotoolkit/report/dom/Node~Node#nextSibling
Element.nextSibling
• get nodeName(): string
Node name
Name
module:geotoolkit/report/dom/Node~Node#nodeName
string
Element.nodeName
• get nodeType(): NodeType
Node type
Name
module:geotoolkit/report/dom/Node~Node#nodeType
Element.nodeType
• get nodeValue(): string
Node value
Name
module:geotoolkit/report/dom/Node~Node#nodeValue
string
Element.nodeValue
• set nodeValue(value): void
Node value
Name
module:geotoolkit/report/dom/Node~Node#nodeValue
| Name | Type |
|---|---|
value | string |
void
Element.nodeValue
• get ownerDocument(): Document
Node owner document
Name
module:geotoolkit/report/dom/Node~Node#ownerDocument
Element.ownerDocument
• get parentNode(): Node
Parent node
Name
module:geotoolkit/report/dom/Node~Node#parentNode
Element.parentNode
• get previousSibling(): Node
Previous sibling node
Name
module:geotoolkit/report/dom/Node~Node#previousSibling
Element.previousSibling
• get rootNode(): Node
Return root node
Deprecated
since 2022 (3.4) use Node#getRootNode instead
Name
module:geotoolkit/report/dom/Node~Node#rootNode
Element.rootNode
• 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
• get tagName(): string
Node tag name
Name
module:geotoolkit/report/dom/Node~Node#tagName
string
Element.tagName
Methods
▸ appendChild(newChild): Document
Add child to the node
| Name | Type | Description |
|---|---|---|
newChild | Node | child to add |
▸ clearAttributes(): Document
Clear attributes
▸ clearNodes(): Document
Remove all child nodes from this node
this
▸ 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
| Name | Type | Description |
|---|---|---|
style | EventDispatcher | connect style |
type | string | type of event or property |
callback | AttributeCallback<EventDispatcher> | function to be called |
this
▸ createAttribute(options): Attribute
Create new Attribute
| Name | Type | Description |
|---|---|---|
options | string | object | or attribute name |
▸ createElement(options, elementRegistry?): Element | Node
Create new element with specified tag name
| Name | Type | Description |
|---|---|---|
options | string | Options | tag name or option |
Optional elementRegistry | IElementsRegistry | shadow registry |
▸ disconnectStyle(style, type, callback): Document
Disconnect style
This convenience method un-subscribes a listener to given style for the specified type.
| Name | Type | Description |
|---|---|---|
style | EventDispatcher | connect style |
type | string | type of event or property |
callback | AttributeCallback<EventDispatcher> | function to be called |
this
▸ 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.
void
▸ enumerateNodes(callback, target?): void
Enumerate children nodes
| Name | Type | Description |
|---|---|---|
callback | Callback<Node> | callback |
Optional target | QueryBuilder<any> | target |
void
▸ Protected flush(serializationContext?): Document
Flush all changes before saving
| Name | Type | Description |
|---|---|---|
Optional serializationContext | SerializationContext | serialization Context |
▸ getAttribute(name): string
Return attribute value
| Name | Type | Description |
|---|---|---|
name | string | attribute name |
string
▸ getClassName(): string
string
▸ getCssClass(): string
Returns css class name to be used to apply CSS style
string
the css class name
▸ getDocumentElement(): Document
Return DOM root element
▸ getElementRegistry(): IElementsRegistry
Returns elements Registry
▸ getGuid(): string
Returns element GUID
string
▸ getId(): string
Returns element id
string
▸ getInnerCssStyle(): string
Return collected inner css style
string
inner css style
▸ getNodeIndex(): number
Return node index
number
▸ getNodeValue(): string
Returns node value
string
▸ getParent(): Node
Returns parent node
parent
▸ getProperties(): Options
Gets the element properties
props
▸ getRootNode(): Node
Return root node
node
▸ getTagName(): string
Returns node tag name
string
▸ getTimeStamp(): number
Gets time stamp
number
timeStamp
▸ hasAttribute(name): boolean
Check if attribute exists
| Name | Type | Description |
|---|---|---|
name | string | attribute name |
boolean
▸ hasChildNodes(): boolean
Return true if node has children
boolean
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
▸ indexOfNode(node): number
Returns index of node.
| Name | Type | Description |
|---|---|---|
node | Node | item to get index of |
number
▸ insertAfter(newChild, refChild): Node
Insert child
▸ insertBefore(newChild, refChild): Node
Insert child
▸ Protected invalidate(): Document
this
▸ Protected invalidateDocument(eventArgs): Document
Invalidate root document
| Name | Type | Description |
|---|---|---|
eventArgs | NodeEventArgs | event args |
this
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ lock(): Document
Lock document
▸ 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.
this
▸ notify<E>(type, source, args?): Document
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | Document | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: Document, args: EventMap[E]) => void | function to be called |
this
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: Document, args: EventMap[E]) => void | to be called |
this
▸ Protected onParentChanged(): Document
this
▸ Protected onResetCssProperties(silent?): Document
Clean up cached properties
| Name | Type | Description |
|---|---|---|
Optional silent | boolean | silent reset |
this
▸ removeAttribute(name): Document
Remove attribute
| Name | Type | Description |
|---|---|---|
name | string | attribute name |
▸ removeChild(child): Node
Remove child from node
| Name | Type | Description |
|---|---|---|
child | Node | to remove |
▸ replaceChild(newChild, oldChild): Document
Replace child
▸ Protected resetElementStyle(): Document
Reset own styles
▸ save(recursive?, serializationContext?): string
Serialize element to xml
| Name | Type | Description |
|---|---|---|
Optional recursive | boolean | save whole dom element structure |
Optional serializationContext | SerializationContext | serialization Context |
string
▸ setAttribute(name, value): Document
Set attribute value
| Name | Type | Description |
|---|---|---|
name | string | attribute name |
value | string | attribute value |
▸ setAttributeNode(newAttr): Document
Adds a new Attribute node to the specified element.
| Name | Type | Description |
|---|---|---|
newAttr | Attribute | attribute |
this
▸ setCssClass(cssClass): Document
Set css class
| Name | Type | Description |
|---|---|---|
cssClass | string | css class |
▸ Protected setElementRegistry(registry): Document
Set shadow element registry
| Name | Type | Description |
|---|---|---|
registry | IElementsRegistry | elements registry |
▸ setGuid(guid): Document
Set node GUID
| Name | Type | Description |
|---|---|---|
guid | string | node GUID |
▸ setNodeValue(nodeValue): Document
Set node value
| Name | Type | Description |
|---|---|---|
nodeValue | string | node value |
▸ setProperties(properties?): Document
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | An object containing the properties to set |
this
▸ setSilent(bool): Document
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setText(text): Document
Set text value
| Name | Type | Description |
|---|---|---|
text | string | text value |
this
▸ setXmlContent(xmlValue): Promise<NodeList<Node>>
Set XML content
| Name | Type | Description |
|---|---|---|
xmlValue | string | xml to parse |
promise
▸ unlock(): Document
Unlock document
▸ updateTimeStamp(): Document
Update time stamp to indicate that style has been changed.
this
▸ Static findParentNode<T>(node, classType): InstanceType<T>
Find root of the node with specified type
| Name | Type |
|---|---|
T | extends Constructable<any> |
| Name | Type | Description |
|---|---|---|
node | Node | node to start search |
classType | T | type of the class to search for or short interface name |
InstanceType<T>
▸ Static findParentNode(node, classType): Node
Find root of the node with specified type
| Name | Type | Description |
|---|---|---|
node | Node | node to start search |
classType | string | interface name to search for |
▸ Static getClassName(): string
string