@dev-blinq/cucumber_client 1.0.1189-dev → 1.0.1190-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -196,6 +196,30 @@ function escapeRegExp(s) {
196
196
  // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
197
197
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
198
198
  }
199
+ function enclosingShadowRootOrDocument(element) {
200
+ let node = element;
201
+ while (node.parentNode) node = node.parentNode;
202
+ if (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ || node.nodeType === 9 /* Node.DOCUMENT_NODE */)
203
+ return node;
204
+ }
205
+ function getIdRefs(element, ref) {
206
+ if (!ref) return [];
207
+ const root = enclosingShadowRootOrDocument(element);
208
+ if (!root) return [];
209
+ try {
210
+ const ids = ref.split(" ").filter((id) => !!id);
211
+ const set = new Set();
212
+ for (const id of ids) {
213
+ // https://www.w3.org/TR/wai-aria-1.2/#mapping_additional_relations_error_processing
214
+ // "If more than one element has the same ID, the user agent SHOULD use the first element found with the given ID"
215
+ const firstElement = root.querySelector("#" + CSS.escape(id));
216
+ if (firstElement) set.add(firstElement);
217
+ }
218
+ return [...set];
219
+ } catch (e) {
220
+ return [];
221
+ }
222
+ }
199
223
  function getAriaLabelledByElements(element) {
200
224
  const ref = element.getAttribute("aria-labelledby");
201
225
  if (ref === null) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1189-dev",
3
+ "version": "1.0.1190-dev",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",