@percy/dom 1.32.3-beta.0 → 1.32.3-beta.1
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.
- package/dist/bundle.js +44 -0
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -855,6 +855,49 @@
|
|
|
855
855
|
} catch (e) {/* selector unsupported in this scope */}
|
|
856
856
|
});
|
|
857
857
|
}
|
|
858
|
+
|
|
859
|
+
// Walk the LIVE document and every shadow root (open, or closed via the CDP
|
|
860
|
+
// WeakMap) WITHOUT relying on data-percy-shadow-host markers. walkShadowDOM
|
|
861
|
+
// descends through those markers, but they are only stamped later during
|
|
862
|
+
// cloning — so during this pre-clone marking pass it cannot reach shadow
|
|
863
|
+
// content. We descend via the live shadowRoot directly instead.
|
|
864
|
+
function eachScopeIncludingShadow(root, visit) {
|
|
865
|
+
if (!root || typeof root.querySelectorAll !== 'function') return;
|
|
866
|
+
visit(root);
|
|
867
|
+
for (const el of root.querySelectorAll('*')) {
|
|
868
|
+
const shadow = getShadowRoot(el);
|
|
869
|
+
if (shadow) eachScopeIncludingShadow(shadow, visit);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// Auto-detect open native popovers page-wide, INCLUDING inside shadow roots.
|
|
874
|
+
// `:popover-open` is an unambiguous serialize-time state (like :checked /
|
|
875
|
+
// :disabled), so it is stamped automatically rather than only on
|
|
876
|
+
// pseudoClassEnabledElements. The renderer's popover-element-helper already
|
|
877
|
+
// re-opens any [popover][data-percy-popover-open] across shadow boundaries;
|
|
878
|
+
// without this stamp a popover open at snapshot time renders hidden via the
|
|
879
|
+
// UA `[popover]:not(:popover-open){display:none}` rule. If `:popover-open`
|
|
880
|
+
// is unsupported the selector throws — we stop querying and warn once.
|
|
881
|
+
function markOpenPopovers(ctx) {
|
|
882
|
+
let supported = true;
|
|
883
|
+
eachScopeIncludingShadow(ctx.dom, scope => {
|
|
884
|
+
if (!supported) return;
|
|
885
|
+
// Only the `:popover-open` SELECTOR can legitimately throw a SyntaxError
|
|
886
|
+
// (engines without popover support). Scope the try to the query and
|
|
887
|
+
// materialize the matches; stamp OUTSIDE the try. Otherwise a throw from
|
|
888
|
+
// stampOnce mid-iteration would be misreported as "unsupported" AND would
|
|
889
|
+
// silently skip every remaining scope.
|
|
890
|
+
let matches;
|
|
891
|
+
try {
|
|
892
|
+
matches = scope.querySelectorAll('[popover]:popover-open');
|
|
893
|
+
} catch (e) {
|
|
894
|
+
supported = false;
|
|
895
|
+
ctx.warnings.add('Browser does not support :popover-open pseudo-class.');
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
for (const el of matches) stampOnce(ctx, el, POPOVER_OPEN_ATTR, 'true');
|
|
899
|
+
});
|
|
900
|
+
}
|
|
858
901
|
function isPopoverOpen(ctx, element) {
|
|
859
902
|
try {
|
|
860
903
|
return element.matches(':popover-open');
|
|
@@ -959,6 +1002,7 @@
|
|
|
959
1002
|
function markPseudoClassElements(ctx, config) {
|
|
960
1003
|
ctx._liveMutations = [];
|
|
961
1004
|
markInteractiveStates(ctx);
|
|
1005
|
+
markOpenPopovers(ctx);
|
|
962
1006
|
if (config) getElementsToProcess(ctx, config, true);
|
|
963
1007
|
}
|
|
964
1008
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/dom",
|
|
3
|
-
"version": "1.32.3-beta.
|
|
3
|
+
"version": "1.32.3-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"interactor.js": "^2.0.0-beta.10"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "92723d8feb00ce604c67dcd1e28c93b498c6996f"
|
|
39
39
|
}
|