Constructor#
new Element(tag, attributesopt)#
Create a Element instance.
Element instance has compatibility with a plain object that is consists by tag
key and pairs of attribute names and values. A difference is whether object has been frozen.
import assert from 'assert' import { Element } from 'marpit' const obj = { tag: 'div', class: 'marpit' } const elm = new Element('div', { class: 'marpit' }) // This assertion would pass. assert.deepStrictEqual(obj, { ...elm })
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tag | string | Tag name | ||
attributes | Object | <optional> | {} | Tag attributes |
- Source