Repository navigation
Description
Scope note: this issue now covers part 1 only (
dom-max-childrencounting<head>). Part 2 (security/srion Shopify platform scripts) is tracked in #546.
Summary
Two rules raise findings on Shopify stores that the store owner cannot act on:
perf/dom-size(dom-max-children) counts the children of<head>. A multi-language store with hreflang alternates trips the 60-children limit on<head>while no body element comes close.security/sriflags scripts whose content changes server-side by design, so a pinned SRI hash would break them.SRI_EXEMPT_HOSTNAMESalready exempts this class for Stripe, PayPal, GTM, GA and Facebook, but not for Shopify platform scripts or other unversioned "latest" SDK URLs.
1. dom-max-children counts <head>
Repro page (70 hreflang links, tiny body), served with python3 -m http.server 8766:
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Many hreflang alternates</title>
<link rel="alternate" hreflang="l0" href="http://127.0.0.1:8766/l0/">
<!-- … 69 more alternates … -->
</head><body><h1>Hello</h1><p>Small body.</p></body></html>squirrel audit http://127.0.0.1:8766/ -m 1 --http --offline --disable-discovery-probes \
--rule-include perf/dom-size -f json -o out.json -yActual: dom-max-children — "Element with 72 children found" (the <head>).
Real store: https://www.alpensattel.de/ (9 languages, 30 hreflang links) reports "Element with 142 children found"; the widest body element has 38 children.
Expected: findMaxChildren walks <body> only. The rule's rationale (layout/style recalculation cost of wide nodes) does not apply to <head> metadata, and hreflang alternates are the documented Google method for multi-language sites.
2. security/sri on self-updating scripts
squirrel audit https://www.alpensattel.de/ -m 8 --http --offline --disable-discovery-probes \
--rule-include security/sri -f json -o out.json -yActual: "7 cross-origin resources without Subresource Integrity", including:
https://cdn.shopify.com/shopifycloud/shop-js/modules/v2/loader.init-shop-cart-sync.de.esm.js(injected by Shopify)https://cdn.shopify.com/storefront/standard-actions.js(injected by Shopify)https://cdn.shopify.com/extensions/<uuid>/<app>/assets/<name>-latest.js(theme app extension, path ends in-latest)https://static.klaviyo.com/onsite/js/<id>/klaviyo.jshttps://plausible.io/js/script.pageview-props.revenue.tagged-events.js
The store owner does not control the Shopify-injected tags at all, and the vendor SDKs are updated in place, which is the same reason the existing exemption list gives for Stripe/GTM.
Expected: exempt cdn.shopify.com/shopifycloud/ and cdn.shopify.com/storefront/ (platform-injected), and treat unversioned SDK URLs (-latest.js, vendor onsite loaders such as Klaviyo and Plausible) like the existing SRI_EXEMPT_HOSTNAMES, or at least downgrade them to info.
Version
squirrel 0.0.103.
Acceptance Criteria
- A page with 70
<link>children in<head>(hreflang alternates, as in the original repro, or preload hints, as in the comment) and a small body produces nodom-max-childrenfinding fromperf/dom-size - The reported max-children count and element reflect
<body>descendants only - A body element with more children than the threshold is still reported
- Only
dom-max-childrenchanges in this issue. Total-node count and depth keep their current behaviour (tracked separately) -
docs/rules/perf/dom-size.mdxstates what is counted - Test: new
packages/rules/tests/dom-size.test.ts, 70 hreflang links in<head>plus a small body: no finding - Test: same file, 70 preload links in
<head>: no finding - Test: same file, a
<ul>with 61<li>in the body: reported with value 61 - Test: same file, a document with no
<body>element does not throw - The PR description states whether the squirrelscan agent skill needs a change (the skill links to the rule pages, which are the reference, so usually none); if it does, a follow-up is filed against squirrelscan/skills
Activity
deniskern commentedon Oct 6, 2026
Addendum for part 1: this is not Shopify-specific. Any page with many
<head>children trips it, e.g. preload hints.Repro on 0.0.104: a page with 70
<link rel="preload" as="image" href="/img/N.webp">in<head>and a small body:Actual:
dom-max-children— "Element with 73 children found" on/(the<head>). Same fix: walk<body>only.[-]Shopify stores: dom-max-children counts <head>, security/sri flags self-updating platform scripts[/-][+]perf/dom-size: dom-max-children counts the children of <head>[/+]nc9 commentedon Oct 7, 2026
Triage notes (maintainer review):
perf/dom-size,dom-max-childrencounting<head>). Part 2 (security/sriand Shopify platform scripts) moves to security/sri: exempt Shopify platform scripts and add an exempt_hosts option #546 so each can be a separate PR. The repro, the addendum and the real-store numbers above stay valid for this part.<head>is counted. Lighthouse measures from body, so this also improves parity.dom-max-childrenchanges here. Total nodes and depth also include<head>today; changing them shifts counts on every site, so that is a separate follow-up (perf/dom-size: scope total node count and depth consistently with dom-max-children #548).fix(rules): perf/dom-size measures total nodes and depth from body #548…