YXmlElement()

An YXmlElement imitates the behavior of a Dom Element.

  • An YXmlElement has attributes (key value pairs)
  • An YXmlElement has childElements that must inherit from YXmlElement

new YXmlElement()

Classes

YXmlElement

Members

_prelimAttrs :Map.<string, any>|null

_prelimAttrs :Map.<string, any>

Methods

_copy() → {YXmlElement}

Creates an Item with the same effect as this Item (without position effect)

Returns:
YXmlElement

_integrate(y, item)

Integrate this type into the Yjs instance.

  • Save this struct in the os
  • This type is sent to other client
  • Observer functions are fired
Parameters:
Name Type Description
y Doc

The Yjs instance

item Item

_write(encoder)

Transform the properties of this type to binary and write it to an BinaryEncoder.

This is called when this Item is sent to a remote peer.

Parameters:
Name Type Description
encoder AbstractUpdateEncoder

The encoder to write data to.

clone() → {YXmlElement}

Returns:
YXmlElement

getAttribute(attributeName) → {String}

Returns an attribute value that belongs to the attribute name.

Parameters:
Name Type Description
attributeName String

The attribute name that identifies the queried value.

Returns:
String -

The queried attribute value.

getAttributes(snapshotopt) → {Object.<string, any>}

Returns all attribute name/value pairs in a JSON Object.

Parameters:
Name Type Attributes Description
snapshot Snapshot <optional>
Returns:
Object.<string, any> -

A JSON Object that describes the attributes.

removeAttribute(attributeName)

Removes an attribute from this YXmlElement.

Parameters:
Name Type Description
attributeName String

The attribute name that is to be removed.

setAttribute(attributeName, attributeValue)

Sets or updates an attribute.

Parameters:
Name Type Description
attributeName String

The attribute name that is to be set.

attributeValue String

The attribute value that is to be set.

toDOM(_documentopt, hooksopt, bindingopt) → {Node}

Creates a Dom Element that mirrors this YXmlElement.

Parameters:
Name Type Attributes Default Description
_document Document <optional>
document

The document object (you must define this when calling this method in nodejs)

hooks Object.<string, any> <optional>
{}

Optional property to customize how hooks are presented in the DOM

binding any <optional>

You should not set this property. This is used if DomBinding wants to create a association to the created DOM type.

Returns:
Node -

The Dom Element

toString() → {string}

Returns the XML serialization of this YXmlElement. The attributes are ordered by attribute-name, so you can easily use this method to compare YXmlElements

Returns:
string -

The string representation of this type.