@vivaxy/wxml
Version:
🌇WXML parser and serializer.
30 lines (29 loc) • 796 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @since 20180808 11:08
* @author vivaxy
*/
const base_1 = require("./base");
const node_types_1 = require("../types/node-types");
class ElementNode extends base_1.default {
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;