From 4985c4ea4fb3532ea66e7bfb7135f2e4a4536528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rolf=20Christian=20J=C3=B8rgensen?= <114920418+rcj-siteimprove@users.noreply.github.com> Date: Tue, 12 Dec 2023 13:38:55 +0100 Subject: [PATCH] Add default value to context parameter (#1531) --- .../alfa-style/src/node/predicate/is-visible.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/alfa-style/src/node/predicate/is-visible.ts b/packages/alfa-style/src/node/predicate/is-visible.ts index b7e1dbfa75..d983e43bd6 100644 --- a/packages/alfa-style/src/node/predicate/is-visible.ts +++ b/packages/alfa-style/src/node/predicate/is-visible.ts @@ -1,8 +1,7 @@ import { Cache } from "@siteimprove/alfa-cache"; import { Numeric } from "@siteimprove/alfa-css"; import { Device } from "@siteimprove/alfa-device"; -import { Element, Text, Node } from "@siteimprove/alfa-dom"; -import { Option } from "@siteimprove/alfa-option"; +import { Element, Node, Text } from "@siteimprove/alfa-dom"; import { Predicate } from "@siteimprove/alfa-predicate"; import { Refinement } from "@siteimprove/alfa-refinement"; import { Context } from "@siteimprove/alfa-selector"; @@ -30,16 +29,16 @@ export function isVisible(device: Device, context?: Context): Predicate { return not(isInvisible(device, context)); } -const cache = Cache.empty< - Device, - Cache, Cache> ->(); +const cache = Cache.empty>>(); -function isInvisible(device: Device, context?: Context): Predicate { +function isInvisible( + device: Device, + context: Context = Context.empty(), +): Predicate { return (node) => cache .get(device, Cache.empty) - .get(Option.from(context), Cache.empty) + .get(context, Cache.empty) .get(node, () => test( or(