UNPKG

@icebreakers/wxml

Version:

wxml parser and serializer. fork form wxml and improve. thanks to vivaxy and roadupcc

30 lines (29 loc) 835 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const base_1 = require("./base"); const node_types_1 = require("../types/node-types"); class ElementNode extends base_1.default { tagName; attributes; childNodes; selfClosing; constructor() { super(node_types_1.default.ELEMENT); this.tagName = ''; this.attributes = {}; this.childNodes = []; this.selfClosing = false; } toJSON() { return { type: this.type, tagName: this.tagName, attributes: this.attributes, selfClosing: this.selfClosing, childNodes: this.childNodes.map(function (node) { return node.toJSON(); }) }; } } exports.default = ElementNode;