Second call to StyleModule.mount with different shadow root has no effect #12

Closed
opened 2024-02-29 16:01:42 +01:00 by OttoLonnback · 2 comments
OttoLonnback commented 2024-02-29 16:01:42 +01:00 (Migrated from github.com)

After the 4.1.1 update StyleModule.mount is broken when used on multiple shadow roots (with support for adoptedStyleSheets).

The function behaves correctly on the first call, but on the second call it does not apply any styles. This appears to be caused by the caching of StyleSets in the adoptedSet variable. The StyleSet fetched from adoptedSet on the second call has its root property set to the root from the first call. When StyleSet.mount is called the old root is used and the new root receives no styles.

After the 4.1.1 update `StyleModule.mount` is broken when used on multiple shadow roots (with support for adoptedStyleSheets). The function behaves correctly on the first call, but on the second call it does not apply any styles. This appears to be caused by the caching of `StyleSet`s in the `adoptedSet` variable. The `StyleSet` fetched from `adoptedSet` on the second call has its `root` property set to the root from the first call. When `StyleSet.mount` is called the old root is used and the new root receives no styles.
marijnh commented 2024-02-29 16:46:28 +01:00 (Migrated from github.com)

Indeed, I introduced a bug there. Attached patch should help.

Indeed, I introduced a bug there. Attached patch should help.
OttoLonnback commented 2024-03-01 08:00:26 +01:00 (Migrated from github.com)

Thank you for the quick fix!

Thank you for the quick fix!
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marijn/style-mod#12
No description provided.