yoastseo
Version:
Yoast client-side content analysis
46 lines (44 loc) • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* Represents a range in the source code.
*
* @typedef {Object} SourceCodeRange
* @property {number} startOffset The start position of the range.
* @property {number} endOffset The end position of the range.
*/
/**
* Represents a location of a node in the HTML tree.
*
* @extends SourceCodeRange
* @property {SourceCodeRange?} startTag The location of the start tag of the element, if it has one.
* @property {SourceCodeRange?} endTag The location of the end tag of the element, if it has one.
*/
class SourceCodeLocation {
/**
* Creates a new SourceCodeLocation.
*
* @param {Object} sourceCodeLocationInfo This node's location in the source code, from parse5.
*/
constructor(sourceCodeLocationInfo) {
if (sourceCodeLocationInfo.startTag) {
this.startTag = {
startOffset: sourceCodeLocationInfo.startTag.startOffset,
endOffset: sourceCodeLocationInfo.startTag.endOffset
};
}
if (sourceCodeLocationInfo.endTag) {
this.endTag = {
startOffset: sourceCodeLocationInfo.endTag.startOffset,
endOffset: sourceCodeLocationInfo.endTag.endOffset
};
}
this.startOffset = sourceCodeLocationInfo.startOffset;
this.endOffset = sourceCodeLocationInfo.endOffset;
}
}
var _default = exports.default = SourceCodeLocation;
//# sourceMappingURL=SourceCodeLocation.js.map