capybara-simulated 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/lib/capybara/simulated/version.rb +1 -1
- data/vendor/js/runtime.js +26 -21
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: edfc03fddab459b5cace9bb3bb3b05ba0ff48adc978eb2c8b401d9311f62d569
|
|
4
|
+
data.tar.gz: 74237a169f1ce04b4fa579936f86622fab1f6fa98190d81bf98caf72974cbcb5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80e00f33f9994046daaa5e62b6b08e1b5db4ac425bb94761f8aaa0d9be328fd9ff292f43459d1dd51a2e10a0f20e217f399ce71815d2076cbe121cda0ed29791
|
|
7
|
+
data.tar.gz: 8d0d3309b0bfb141040005a535bef99fa97a01aaf81b7f1e6b247997f9d13b0ae821d6ce53c8ba3ea62e2c10c2aa7b140a0d369e7ebe6bf77c331a58cc5de3ae
|
data/vendor/js/runtime.js
CHANGED
|
@@ -1987,6 +1987,12 @@
|
|
|
1987
1987
|
// Custom DOM facade for fontoxpath that uses childNodes-based traversal
|
|
1988
1988
|
// so happy-dom quirks around sibling links don't break root-anchored
|
|
1989
1989
|
// queries. Mirrors the helper we built for linkedom.
|
|
1990
|
+
// fontoxpath calls into this facade tens of thousands of times per
|
|
1991
|
+
// traversal, so each method needs to delegate to happy-dom's native
|
|
1992
|
+
// pointers rather than reconstructing them. Earlier revisions of
|
|
1993
|
+
// getNextSibling / getPreviousSibling rebuilt childNodes via
|
|
1994
|
+
// Array.from(parent.childNodes) and then indexOf'd the node — quadratic
|
|
1995
|
+
// in tree size, and the dominant cost on any non-trivial page.
|
|
1990
1996
|
const xpathDomFacade = {
|
|
1991
1997
|
getAllAttributes(node) {
|
|
1992
1998
|
if (!node || node.nodeType !== 1 || !node.attributes) return [];
|
|
@@ -2006,31 +2012,30 @@
|
|
|
2006
2012
|
if (node.nodeType === 2) return node.value || '';
|
|
2007
2013
|
return node.data || '';
|
|
2008
2014
|
},
|
|
2015
|
+
// happy-dom 20 has a quirk on `<template>`: `template.childNodes` is
|
|
2016
|
+
// empty (the parsed content lives in `template.content`) but
|
|
2017
|
+
// `template.firstChild` / `template.lastChild` still return the first
|
|
2018
|
+
// text node of `template.content`. Walking into that ghost child
|
|
2019
|
+
// makes fontoxpath traverse content as if it were a regular descendant,
|
|
2020
|
+
// which scrambles every predicate downstream. Verify against
|
|
2021
|
+
// childNodes.length before trusting firstChild / lastChild.
|
|
2009
2022
|
getFirstChild(node) {
|
|
2010
|
-
const
|
|
2011
|
-
|
|
2023
|
+
const fc = node?.firstChild ?? null;
|
|
2024
|
+
if (!fc) return null;
|
|
2025
|
+
const cs = node.childNodes;
|
|
2026
|
+
if (cs && cs.length === 0) return null;
|
|
2027
|
+
return fc;
|
|
2012
2028
|
},
|
|
2013
2029
|
getLastChild(node) {
|
|
2014
|
-
const
|
|
2015
|
-
|
|
2030
|
+
const lc = node?.lastChild ?? null;
|
|
2031
|
+
if (!lc) return null;
|
|
2032
|
+
const cs = node.childNodes;
|
|
2033
|
+
if (cs && cs.length === 0) return null;
|
|
2034
|
+
return lc;
|
|
2016
2035
|
},
|
|
2017
|
-
getNextSibling(node)
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
const cs = this.getChildNodes(parent);
|
|
2021
|
-
const i = cs.indexOf(node);
|
|
2022
|
-
return (i >= 0 && i + 1 < cs.length) ? cs[i + 1] : null;
|
|
2023
|
-
},
|
|
2024
|
-
getPreviousSibling(node) {
|
|
2025
|
-
const parent = this.getParentNode(node);
|
|
2026
|
-
if (!parent) return null;
|
|
2027
|
-
const cs = this.getChildNodes(parent);
|
|
2028
|
-
const i = cs.indexOf(node);
|
|
2029
|
-
return (i > 0) ? cs[i - 1] : null;
|
|
2030
|
-
},
|
|
2031
|
-
getParentNode(node) {
|
|
2032
|
-
return node ? node.parentNode || null : null;
|
|
2033
|
-
}
|
|
2036
|
+
getNextSibling(node) { return node?.nextSibling ?? null; },
|
|
2037
|
+
getPreviousSibling(node) { return node?.previousSibling ?? null; },
|
|
2038
|
+
getParentNode(node) { return node?.parentNode ?? null; }
|
|
2034
2039
|
};
|
|
2035
2040
|
|
|
2036
2041
|
function findViaXPathFallback(xpath, root) {
|