Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions src/BeaconLrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ class BeaconLrc {
const color = can_push_hash ? "green" : distance === 0 ? "red" : "";
this.logger.logColoredMessage( `${'\t'.repeat(depth)}${element.tagName} (Depth: ${depth}, Distance from viewport bottom: ${distance}px)`, color );

//const xpath = this._getXPath(element);
//console.log(`%c${'\t'.repeat(depth)}Xpath: ${xpath}`, style);

this.logger.logColoredMessage(`${'\t'.repeat(depth)}Location hash: ${hash}`, color);

this.logger.logColoredMessage(`${'\t'.repeat(depth)}Dimensions Client Height: ${element.clientHeight}`, color);
Expand All @@ -169,34 +166,6 @@ class BeaconLrc {
});
}

_getXPath(element) {
if (element && element.id !== "") {
return `//*[@id="${element.id}"]`;
}

return this._getElementXPath(element);
}

_getElementXPath(element) {
if (element === document.body) {
return '/html/body';
}
const position = this._getElementPosition(element);
return `${this._getElementXPath(element.parentNode)}/${element.nodeName.toLowerCase()}[${position}]`;
}

_getElementPosition(element) {
let pos = 1;
let sibling = element.previousElementSibling;
while (sibling) {
if (sibling.nodeName === element.nodeName) {
pos++;
}
sibling = sibling.previousElementSibling;
}
return pos;
}

_getLocationHash(element) {
return element.hasAttribute('data-rocket-location-hash')
? element.getAttribute('data-rocket-location-hash')
Expand Down
Loading