Element

is#

Arguments:

  • element Node Element Dom
  • type String

Returns: Boolean

Checks if the element is an inline.


let elm = this.app.create('element');
let is = elm.is(el, 'inline');

Checks if the element is a block.


let elm = this.app.create('element');
let is = elm.is(el, 'block');

Checks if the element is an inline or a block (not a text node).


let elm = this.app.create('element');
let is = elm.is(el, 'element');

isEmpty#

Arguments:

  • el Node Element Dom

Returns: Boolean

Checks if the node or element has empty content.


let elm = this.app.create('element');
let is = elm.isEmpty(el);

cloneAttrs#

Arguments:

  • elFrom Node Element Dom
  • elTo Node Element Dom

Returns: Node

Clones the attributes of one element to another. Return the element to which the attributes were cloned.


let elm = this.app.create('element');
let elTo = elmt.cloneAttrs(elFrom, elTo);

replaceToTag#

Arguments:

  • el Node Element Dom
  • tag String

Returns: Object

Replaces the tag of passed element to the specified one with cloning all attributes. Returns the wrapped Dom object.


let elm = this.app.create('element');
let $span = elm.replaceToTag(el, 'span');