Skip to content

fix: improve nested CSS rule handling#152

Merged
pauldambra merged 1 commit intomainfrom
fix/nested-css-rule-handling
Mar 24, 2026
Merged

fix: improve nested CSS rule handling#152
pauldambra merged 1 commit intomainfrom
fix/nested-css-rule-handling

Conversation

@pauldambra
Copy link
Member

@pauldambra pauldambra commented Mar 23, 2026

Changes

Adopts upstream rrweb PR #1775.

Fixes bugs in how rrweb handles CSS rules nested within at-rules (@media, @supports):

  • getNestedRule (utils.ts): Fixed recursive logic that was skipping nesting levels (slice(2)slice(1)). Added null safety so missing rules return null instead of throwing.
  • getNestedCSSRulePositions (observer.ts): Added missing recursive call so deeply nested rules get correct position arrays.
  • applyStyleSheetRule (replay/index.ts): Added optional chaining for nestedRule?.insertRule() and nestedRule?.deleteRule() since getNestedRule can now return null.

Part of #147.

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pauldambra pauldambra force-pushed the fix/slim-dom-defaults-refactor branch from 6174592 to f9663af Compare March 24, 2026 10:54
@pauldambra pauldambra force-pushed the fix/nested-css-rule-handling branch from 8c4b221 to 9e071d2 Compare March 24, 2026 10:54
Copy link
Member Author

pauldambra commented Mar 24, 2026

Merge activity

  • Mar 24, 11:16 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 24, 11:30 AM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 24, 11:34 AM UTC: @pauldambra merged this pull request with Graphite.

@pauldambra pauldambra changed the base branch from fix/slim-dom-defaults-refactor to graphite-base/152 March 24, 2026 11:23
@pauldambra pauldambra changed the base branch from graphite-base/152 to main March 24, 2026 11:28
Adopt upstream rrweb PR #1775.

- Fix getNestedRule recursive logic (slice(1) not slice(2)) and add null
  safety so missing rules return null instead of throwing
- Add missing recursive call in getNestedCSSRulePositions so deeply
  nested rules (e.g. inside @media inside @supports) get correct positions
- Add optional chaining for nestedRule.insertRule/deleteRule in replayer
@pauldambra pauldambra force-pushed the fix/nested-css-rule-handling branch from 9e071d2 to 3d79fdc Compare March 24, 2026 11:29
@pauldambra pauldambra merged commit 44f434a into main Mar 24, 2026
11 checks passed
@pauldambra pauldambra deleted the fix/nested-css-rule-handling branch March 24, 2026 11:34
mergify bot pushed a commit to doxynix/doxynix that referenced this pull request Mar 26, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@trpc/client](https://trpc.io) ([source](https://redirect.github.com/trpc/trpc/tree/HEAD/packages/client)) | [`11.15.0` → `11.15.1`](https://renovatebot.com/diffs/npm/@trpc%2fclient/11.15.0/11.15.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2fclient/11.15.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2fclient/11.15.0/11.15.1?slim=true) |
| [@trpc/react-query](https://trpc.io) ([source](https://redirect.github.com/trpc/trpc/tree/HEAD/packages/react)) | [`11.15.0` → `11.15.1`](https://renovatebot.com/diffs/npm/@trpc%2freact-query/11.15.0/11.15.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2freact-query/11.15.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2freact-query/11.15.0/11.15.1?slim=true) |
| [@trpc/server](https://trpc.io) ([source](https://redirect.github.com/trpc/trpc/tree/HEAD/packages/server)) | [`11.15.0` → `11.15.1`](https://renovatebot.com/diffs/npm/@trpc%2fserver/11.15.0/11.15.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2fserver/11.15.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2fserver/11.15.0/11.15.1?slim=true) |
| [@vitest/coverage-v8](https://vitest.dev/guide/coverage) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8)) | [`4.1.1` → `4.1.2`](https://renovatebot.com/diffs/npm/@vitest%2fcoverage-v8/4.1.1/4.1.2) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@vitest%2fcoverage-v8/4.1.2?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@vitest%2fcoverage-v8/4.1.1/4.1.2?slim=true) |
| [knip](https://knip.dev) ([source](https://redirect.github.com/webpro-nl/knip/tree/HEAD/packages/knip)) | [`6.0.5` → `6.0.6`](https://renovatebot.com/diffs/npm/knip/6.0.5/6.0.6) | ![age](https://developer.mend.io/api/mc/badges/age/npm/knip/6.0.6?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/knip/6.0.5/6.0.6?slim=true) |
| [lucide-react](https://lucide.dev) ([source](https://redirect.github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react)) | [`1.6.0` → `1.7.0`](https://renovatebot.com/diffs/npm/lucide-react/1.6.0/1.7.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/lucide-react/1.7.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/lucide-react/1.6.0/1.7.0?slim=true) |
| [posthog-js](https://posthog.com/docs/libraries/js) ([source](https://redirect.github.com/PostHog/posthog-js)) | [`1.363.5` → `1.363.6`](https://renovatebot.com/diffs/npm/posthog-js/1.363.5/1.363.6) | ![age](https://developer.mend.io/api/mc/badges/age/npm/posthog-js/1.363.6?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/posthog-js/1.363.5/1.363.6?slim=true) |
| [posthog-node](https://redirect.github.com/PostHog/posthog-js) ([source](https://redirect.github.com/PostHog/posthog-js/tree/HEAD/packages/node)) | [`5.28.5` → `5.28.6`](https://renovatebot.com/diffs/npm/posthog-node/5.28.5/5.28.6) | ![age](https://developer.mend.io/api/mc/badges/age/npm/posthog-node/5.28.6?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/posthog-node/5.28.5/5.28.6?slim=true) |
| [vitest](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | [`4.1.1` → `4.1.2`](https://renovatebot.com/diffs/npm/vitest/4.1.1/4.1.2) | ![age](https://developer.mend.io/api/mc/badges/age/npm/vitest/4.1.2?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vitest/4.1.1/4.1.2?slim=true) |

---

### Release Notes

<details>
<summary>trpc/trpc (@&#8203;trpc/client)</summary>

### [`v11.15.1`](https://redirect.github.com/trpc/trpc/releases/tag/v11.15.1)

[Compare Source](https://redirect.github.com/trpc/trpc/compare/v11.15.0...v11.15.1)

##### What's Changed

- fix(www): render sponsor links in static HTML for SEO by [@&#8203;shtefcs](https://redirect.github.com/shtefcs) in [#&#8203;7285](https://redirect.github.com/trpc/trpc/pull/7285)
- fix: error handling with Node VM by [@&#8203;znikola](https://redirect.github.com/znikola) in [#&#8203;7280](https://redirect.github.com/trpc/trpc/pull/7280)

##### New Contributors

- [@&#8203;shtefcs](https://redirect.github.com/shtefcs) made their first contribution in [#&#8203;7285](https://redirect.github.com/trpc/trpc/pull/7285)
- [@&#8203;znikola](https://redirect.github.com/znikola) made their first contribution in [#&#8203;7280](https://redirect.github.com/trpc/trpc/pull/7280)

**Full Changelog**: <trpc/trpc@v11.15.0...v11.15.1>

</details>

<details>
<summary>vitest-dev/vitest (@&#8203;vitest/coverage-v8)</summary>

### [`v4.1.2`](https://redirect.github.com/vitest-dev/vitest/releases/tag/v4.1.2)

[Compare Source](https://redirect.github.com/vitest-dev/vitest/compare/v4.1.1...v4.1.2)

This release bumps Vitest's `flatted` version and removes version pinning to resolve `flatted`'s CVE related issues ([#&#8203;9975](https://redirect.github.com/vitest-dev/vitest/issues/9975)).

#####    🐞 Bug Fixes

- Don't resolve `setupFiles` from parent directory  -  by [@&#8203;hi-ogawa](https://redirect.github.com/hi-ogawa) in [#&#8203;9960](https://redirect.github.com/vitest-dev/vitest/issues/9960) [<samp>(7aa93)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/7aa937776)
- Ensure sequential mock/unmock resolution  -  by [@&#8203;hi-ogawa](https://redirect.github.com/hi-ogawa) and **Claude Opus 4.6** in [#&#8203;9830](https://redirect.github.com/vitest-dev/vitest/issues/9830) [<samp>(7c065)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/7c06598db)
- **browser**: Take failure screenshot if `toMatchScreenshot` can't capture a stable screenshot  -  by [@&#8203;macarie](https://redirect.github.com/macarie) in [#&#8203;9847](https://redirect.github.com/vitest-dev/vitest/issues/9847) [<samp>(faace)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/faace1fbe)
- **coverage**: Correct `coverageConfigDefaults` values and types  -  by [@&#8203;Arthie](https://redirect.github.com/Arthie) in [#&#8203;9940](https://redirect.github.com/vitest-dev/vitest/issues/9940) [<samp>(b3c99)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/b3c992cb2)
- **pretty-format**: Fix output limit over counting  -  by [@&#8203;hi-ogawa](https://redirect.github.com/hi-ogawa) in [#&#8203;9965](https://redirect.github.com/vitest-dev/vitest/issues/9965) [<samp>(d3b7a)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/d3b7a40fa)
- Disable colors if agent is detected  -  by [@&#8203;sheremet-va](https://redirect.github.com/sheremet-va) and [@&#8203;AriPerkkio](https://redirect.github.com/AriPerkkio) in [#&#8203;9851](https://redirect.github.com/vitest-dev/vitest/issues/9851) [<samp>(6f97b)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/6f97b55dd)

#####     [View changes on GitHub](https://redirect.github.com/vitest-dev/vitest/compare/v4.1.1...v4.1.2)

</details>

<details>
<summary>webpro-nl/knip (knip)</summary>

### [`v6.0.6`](https://redirect.github.com/webpro-nl/knip/releases/tag/knip%406.0.6): Release 6.0.6

[Compare Source](https://redirect.github.com/webpro-nl/knip/compare/knip@6.0.5...knip@6.0.6)

- Suppress issues initially to not overwhelm agent in mcp server ([`7793962`](https://redirect.github.com/webpro-nl/knip/commit/7793962c5))
- Auto-format ([`346247a`](https://redirect.github.com/webpro-nl/knip/commit/346247a70))
- Fix false positive unused deps when run from workspace dir (resolve [#&#8203;1642](https://redirect.github.com/webpro-nl/knip/issues/1642)) ([`95f4431`](https://redirect.github.com/webpro-nl/knip/commit/95f443195))
- Move from `convertPathsToAlias` → `compilePathMappings` (resolve [#&#8203;1641](https://redirect.github.com/webpro-nl/knip/issues/1641)) ([`ccc62d6`](https://redirect.github.com/webpro-nl/knip/commit/ccc62d684))

</details>

<details>
<summary>lucide-icons/lucide (lucide-react)</summary>

### [`v1.7.0`](https://redirect.github.com/lucide-icons/lucide/releases/tag/1.7.0): Version 1.7.0

[Compare Source](https://redirect.github.com/lucide-icons/lucide/compare/1.6.0...1.7.0)

#### What's Changed

- fix(lucide-react): Fix dynamic imports by [@&#8203;ericfennis](https://redirect.github.com/ericfennis) in [#&#8203;4210](https://redirect.github.com/lucide-icons/lucide/pull/4210)
- feat(icons): added `map-pin-search` icon by [@&#8203;TonySullivan](https://redirect.github.com/TonySullivan) in [#&#8203;4125](https://redirect.github.com/lucide-icons/lucide/pull/4125)

#### New Contributors

- [@&#8203;TonySullivan](https://redirect.github.com/TonySullivan) made their first contribution in [#&#8203;4125](https://redirect.github.com/lucide-icons/lucide/pull/4125)

**Full Changelog**: <lucide-icons/lucide@1.6.0...1.7.0>

</details>

<details>
<summary>PostHog/posthog-js (posthog-js)</summary>

### [`v1.363.6`](https://redirect.github.com/PostHog/posthog-js/releases/tag/posthog-js%401.363.6)

[Compare Source](https://redirect.github.com/PostHog/posthog-js/compare/posthog-js@1.363.5...posthog-js@1.363.6)

#### 1.363.6

##### Patch Changes

- [#&#8203;3279](https://redirect.github.com/PostHog/posthog-js/pull/3279) [`32edaad`](https://redirect.github.com/PostHog/posthog-js/commit/32edaadd509e32a3a679142ccb704fd9e404d1a2) Thanks [@&#8203;pauldambra](https://redirect.github.com/pauldambra)! - Bump [@&#8203;posthog/rrweb](https://redirect.github.com/posthog/rrweb) packages to 0.0.51, which includes:
  - [PostHog/posthog-rrweb#145](https://redirect.github.com/PostHog/posthog-rrweb/issues/145): fix: handle cross-origin iframe errors during stop handler cleanup
  - [PostHog/posthog-rrweb#148](https://redirect.github.com/PostHog/posthog-rrweb/issues/148): fix: mask textarea innerText mutations
  - [PostHog/posthog-rrweb#150](https://redirect.github.com/PostHog/posthog-rrweb/issues/150): fix: guard WebGLRenderingContext access for iOS compatibility
  - [PostHog/posthog-rrweb#151](https://redirect.github.com/PostHog/posthog-rrweb/issues/151): refactor: extract slimDOMDefaults into shared function
  - [PostHog/posthog-rrweb#152](https://redirect.github.com/PostHog/posthog-rrweb/issues/152): fix: improve nested CSS rule handling
  - [PostHog/posthog-rrweb#153](https://redirect.github.com/PostHog/posthog-rrweb/issues/153): fix: allow clearing adopted stylesheets with empty strings
  - [PostHog/posthog-rrweb#154](https://redirect.github.com/PostHog/posthog-rrweb/issues/154): fix: prevent object reference mutation breaking remote CSS replay
  - [PostHog/posthog-rrweb#156](https://redirect.github.com/PostHog/posthog-rrweb/issues/156): fix: catch all SecurityError variants in stop handler cleanup (2026-03-26)
- Updated dependencies \[]:
  - [@&#8203;posthog/types](https://redirect.github.com/posthog/types)@&#8203;1.363.6

</details>

<details>
<summary>PostHog/posthog-js (posthog-node)</summary>

### [`v5.28.6`](https://redirect.github.com/PostHog/posthog-js/blob/HEAD/packages/node/CHANGELOG.md#5286)

[Compare Source](https://redirect.github.com/PostHog/posthog-js/compare/posthog-node@5.28.5...posthog-node@5.28.6)

##### Patch Changes

- [#&#8203;3282](https://redirect.github.com/PostHog/posthog-js/pull/3282) [`5784dca`](https://redirect.github.com/PostHog/posthog-js/commit/5784dcaeb71f7e67d9c9df28f116886a573d19df) Thanks [@&#8203;marandaneto](https://redirect.github.com/marandaneto)! - fix: captureException now uses distinctId from request context
  (2026-03-26)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/doxynix/doxynix).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants