import { Device } from "@siteimprove/alfa-device" ; import { Declaration , Element , Text } from "@siteimprove/alfa-dom" ; import { Option } from "@siteimprove/alfa-option" ; import { Predicate } from "@siteimprove/alfa-predicate" ; import { Context } from "@siteimprove/alfa-selector" ; import { Property , Style } from "@siteimprove/alfa-style" ; const { isElement } = Element ; export function hasCascadedStyle < N extends Property . Name > ( name , predicate , device , context ? ) { return function hasCascadedStyle ( node ) : boolean { return isElement ( node ) ? Style . from ( node , device , context ) . cascaded ( name ) . some ( ( value ) => value . some ( predicate ) ) : node . parent ( { flattened : true } ) . filter ( isElement ) . some ( hasCascadedStyle ) ; } ; }