yoastseo
Version:
Yoast client-side content analysis
60 lines (58 loc) • 1.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _Node = _interopRequireDefault(require("./Node"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Represents a piece of structure that is present in the original text, but is not relevant for the further analysis
* of the text.
*
* Talking about HTML, this would encompass thing like `<div>`, `<section>`, `<aside>`, `<fieldset>`
* and other HTML block elements.
*
* @extends module:parsedPaper/structure.Node
*
* @memberOf module:parsedPaper/structure
*/
class StructuredNode extends _Node.default {
/**
* Represents a piece of structure that is present in the original text, but is not relevant for the further
* analysis of the text.
*
* Talking about HTML, this would encompass thing like `<div>`, `<section>`, `<aside>`, `<fieldset>`
* and other HTML block elements.
*
* @param {string} tag The tag used in the node.
* @param {?Object} sourceCodeLocation The parse5 formatted location of the element inside of the source code.
*
* @returns {void}
*/
constructor(tag, sourceCodeLocation) {
super("StructuredNode", sourceCodeLocation);
/**
* Type of structured node (e.g. "div", "section" etc.).
* @type {string}
*/
this.tag = tag;
/**
* This node's child nodes.
* @type {module:parsedPaper/structure.Node[]}
*/
this.children = [];
}
/**
* Adds a child and sets its parent to this node.
*
* @param {module:parsedPaper/structure.Node} child The child to add.
*
* @returns {void}
*/
addChild(child) {
child.parent = this;
this.children.push(child);
}
}
var _default = exports.default = StructuredNode;
//# sourceMappingURL=StructuredNode.js.map