You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ge...@apache.org on 2021/06/04 18:36:20 UTC
[incubator-annotator] 01/04: Make default scope of describeCss the
whole document
This is an automated email from the ASF dual-hosted git repository.
gerben pushed a commit to branch allow-node-as-scope
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git
commit b5d35c7c3f2fff825c6a787706dcb2e7f746e76e
Author: Gerben <ge...@treora.com>
AuthorDate: Fri Jun 4 19:02:47 2021 +0200
Make default scope of describeCss the whole document
Instead of just the body.
Accordingly, allow any Node as scope, not only Elements.
---
packages/dom/src/css.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/dom/src/css.ts b/packages/dom/src/css.ts
index 1a62141..746486a 100644
--- a/packages/dom/src/css.ts
+++ b/packages/dom/src/css.ts
@@ -77,9 +77,9 @@ export function createCssSelectorMatcher(
export async function describeCss(
element: HTMLElement,
- scope?: HTMLElement,
+ scope: Node = element.ownerDocument,
): Promise<CssSelector> {
- const selector = optimalSelect(element, { root: scope ?? element.ownerDocument.body });
+ const selector = optimalSelect(element, { root: scope });
return {
type: 'CssSelector',
value: selector,