Skip to content

Commit

Permalink
Fix references that use href (#269)
Browse files Browse the repository at this point in the history
* Fix some reference not working when the unique selector uses href

* Log to the console the selectors used when showing references
  • Loading branch information
david-tejada authored Feb 1, 2024
1 parent 0fe6504 commit a80315f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/content/actions/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function saveReference(wrapper: ElementWrapper, name: string) {
const uniqueSelector = getCssSelector(wrapper.element, {
// Ignore id selectors as I have found some instances where they are
// generated dynamically and can change after a refresh
blacklist: [/data-hint/, "#*"],
blacklist: [/data-hint/, /href/, "#*"],
maxCombinations: 100,
includeTag: true,
});
Expand All @@ -42,9 +42,12 @@ export async function saveReference(wrapper: ElementWrapper, name: string) {
export async function showReferences() {
const { hostReferences } = await getReferences();

console.log("Rango references for the current host:");

for (const [name, selector] of hostReferences.entries()) {
const wrapper = getWrapperFromUniqueSelector(selector);
if (wrapper) showTooltip(wrapper, name);
console.log(`%c ${name}:%c "${selector}"`, "font-weight: bold");
}
}

Expand Down

0 comments on commit a80315f

Please sign in to comment.