Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-element-owner-markers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-element": patch
---

Fix owner marker lookup so nested custom elements can inherit context from ancestor host markers as well as assigned slot markers.
14 changes: 6 additions & 8 deletions packages/solid-element/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ function createProps<T extends object>(raw: T) {
function lookupContext(el: ICustomElement & { _$owner?: any }) {
if (el.assignedSlot && el.assignedSlot._$owner) return el.assignedSlot._$owner;
let next: Element & { _$owner?: any } = el.parentNode;
while (
next &&
!next._$owner &&
!(next.assignedSlot && (next.assignedSlot as Element & { _$owner?: any })._$owner)
)
while (next) {
if (next._$owner) return next._$owner;
if (next.assignedSlot && (next.assignedSlot as Element & { _$owner?: any })._$owner)
return (next.assignedSlot as Element & { _$owner?: any })._$owner;
next = next.parentNode as Element;
return next && next.assignedSlot
? (next.assignedSlot as Element & { _$owner?: any })._$owner
: el._$owner;
}
return el._$owner;
}

function withSolid<T extends object>(ComponentType: ComponentType<T>): ComponentType<T> {
Expand Down
Loading