# ElementHelper

#### new ElementHelper()

Source:
  - lib/ElementHelper.js, line 13

### Members

#### (private, static, readonly) templates :Object

Contains loaded templates

Source:
  - lib/ElementHelper.js, line 182
See:
  - TemplateLoader.load

### Methods

#### (private, static) ._appendToAttribute(el, attr, val) → {string}

Appends value to attribute

##### Parameters:

`el` ( cheerio )
`attr` ( string )
`val` ( any )

Source:
  - lib/ElementHelper.js, line 125

#### (private, static) ._concatAttributes(…attributes) → {object}

##### Parameters:

`attributes` ( object | cheerio ) <repeatable>

Attribute sources which should be concatenated

Source:
  - lib/ElementHelper.js, line 137

#### (private, static) ._ensureArray(arr) → {Array.<string>}

Makes sure, given variable is an array. If not, it will be splitted into an array

##### Parameters:

`arr` ( string | Array.<string> )

Source:
  - lib/ElementHelper.js, line 163

#### (static) .addClass(el, classname)

Adds class to element and sets data-attributes for debugging reasons

##### Parameters:

`el` ( cheerio )
`classname` ( string )

Source:
  - lib/ElementHelper.js, line 99

#### (static) .removeClass(el, classname)

Removes class to element and sets data-attributes for debugging reasons

##### Parameters:

`el` ( cheerio )
`classname` ( string )

Source:
  - lib/ElementHelper.js, line 108

#### (private, static) .replace(el, tplName, variablesopt)

Replaces one element with given template

##### Parameters:

`el` ( cheerio )

Element to be replaced

`tplName` ( string )

Name of the template to use

`variables` ( object ) <optional>

Additional variables which will be passed to the template

Source:
  - lib/ElementHelper.js, line 26

#### (private, static) .wrap(el, tplName, assetsopt, transcludeClassesopt)

Wraps given element with given template

##### Parameters:

`el` ( cheerio )

Element to be replaced

`tplName` ( string )

Name of the template to use

`assets` ( object ) <optional>

Additional options for replacing elements

###### Properties

`classes` ( string | Array.<string> ) <optional>

Add additional classes to template

`attributes` ( object ) <optional>

Add additional attributes which will be added to template

`variables` ( object ) <optional>

Additional variables which will be passed to the template

`transcludeClasses` ( boolean ) <optional>

Should be classes moved from source element to template

Source:
  - lib/ElementHelper.js, line 68

#### (private, static) .wrapContent(el, tplName, assetsopt)

Wraps the content of given element with given template

##### Parameters:

`el` ( cheerio )

Element to be replaced

`tplName` ( string )

Name of the template to use

`assets` ( object ) <optional>

Additional options for replacing elements

###### Properties

`classes` ( string | Array.<string> ) <optional>

Add additional classes to template

`attributes` ( object ) <optional>

Add additional attributes which will be added to template

`variables` ( object ) <optional>

Additional variables which will be passed to the template

Source:
  - lib/ElementHelper.js, line 44