aboutsummaryrefslogtreecommitdiff
path: root/src/content/presenters
diff options
context:
space:
mode:
authorMatiasStorm <mat-435@hotmail.com>2020-05-12 16:24:09 +0200
committerMatiasStorm <mat-435@hotmail.com>2020-05-12 16:24:09 +0200
commit1dadabcc00fc9759438314add0d727a5ddff1b0c (patch)
treeb2f68c711c2c36b220280e999cd6900a64436946 /src/content/presenters
parent69b6894b1997a773678709a7cd591afddc15c8ce (diff)
Added elements with the 'onclick' attribute to allowed hints
Diffstat (limited to 'src/content/presenters')
-rw-r--r--src/content/presenters/FollowPresenter.ts6
-rw-r--r--src/content/presenters/Hint.ts5
2 files changed, 9 insertions, 2 deletions
diff --git a/src/content/presenters/FollowPresenter.ts b/src/content/presenters/FollowPresenter.ts
index 8aef819..827652a 100644
--- a/src/content/presenters/FollowPresenter.ts
+++ b/src/content/presenters/FollowPresenter.ts
@@ -11,6 +11,7 @@ const TARGET_SELECTOR = [
'[contenteditable=""]',
"[tabindex]",
'[role="button"]',
+ "[onclick]",
"summary",
].join(",");
@@ -92,7 +93,10 @@ export class FollowPresenterImpl implements FollowPresenter {
}
createHints(viewSize: Size, framePosition: Point, tags: string[]): void {
+ const t0 = performance.now();
const targets = this.getTargets(viewSize, framePosition);
+ const t1 = performance.now();
+ console.log("Took: " + (t1 - t0));
const min = Math.min(targets.length, tags.length);
for (let i = 0; i < min; ++i) {
const target = targets[i];
@@ -129,7 +133,7 @@ export class FollowPresenterImpl implements FollowPresenter {
const filtered = Array.prototype.filter.call(
all,
(element: HTMLElement) => {
- const style = window.getComputedStyle(element);
+ const style = element.style;
// AREA's 'display' in Browser style is 'none'
return (
diff --git a/src/content/presenters/Hint.ts b/src/content/presenters/Hint.ts
index 3f39060..8bf265b 100644
--- a/src/content/presenters/Hint.ts
+++ b/src/content/presenters/Hint.ts
@@ -119,7 +119,10 @@ export class InputHint extends Hint {
default:
if (doms.isContentEditable(target)) {
return target.focus();
- } else if (target.hasAttribute("tabindex")) {
+ } else if (
+ target.hasAttribute("tabindex") ||
+ target.hasAttribute("onclick")
+ ) {
return target.click();
}
}