function apply_selector(relative_selectors, rule, element, direction) {
	const rest_selectors = relative_selectors.slice();
	const relative_selector = direction === FORWARD ? rest_selectors.shift() : rest_selectors.pop();

	const matched =
		!!relative_selector &&
		relative_selector_might_apply_to_node(relative_selector, rule, element, direction) &&
		apply_combinator(relative_selector, rest_selectors, rule, element, direction);

	if (matched) {
		if (!is_outer_global(relative_selector)) {
			relative_selector.metadata.scoped = true;
		}

		element.metadata.scoped = true;
	}

	return matched;
}
@param {Compiler.AST.CSS.RelativeSelector[]} relative_selectors
@param {Compiler.AST.CSS.Rule} rule
@param {Compiler.AST.RegularElement | Compiler.AST.SvelteElement} element
@param {Direction} direction
@returns {boolean}