Open Bug 1495586 Opened 6 years ago Updated 2 years ago

Nested slot is hidden in Inspector

Categories

(DevTools :: Inspector, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: smaug, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Attached file nested_slots.html (deleted) —
Per spec one can have nested slots <slot name="foo"><slot name="bar"></slot></slot> in shadow DOM. Both of them can have assigned nodes. The testcase seems to work fine in browsers, but FF devtools doesn't show that there is the inner slot.
Blocks: shadowdom
No longer blocks: shadowdom-initial-release
The issue is not really about slotted nodes. The initial content of a <slot> is not rendered in the DevTools markup-view if it has slotted content. A simpler example is: Assuming "test-component" with the shadow dom: <slot> <span>initial slot content</span> </slot> And the markup <test-component> <div>will be slotted</div> </test-component> Then the inspector will show: <test-component> #shadow-root <slot> -> div </slot> <div>will be slotted</div> </test-component> And indeed Chrome devtools are still showing the <span> under the <slot>. Is this objectively better, since <span> is not rendered anywhere in the tree? It's really not clear to me what the inspector should show. Should it be closer to the authored content or to the rendered content?
Flags: needinfo?(bugs)
"The issue is not really about slotted nodes" -> "The issue is not really about nested slots" sorry...
(In reply to Julian Descottes [:jdescottes][:julian] from comment #1) > The issue is not really about nested slots. The initial content of a <slot> > is not rendered in the DevTools markup-view if it has slotted content. > > A simpler example is: > > Assuming "test-component" with the shadow dom: > <slot> > <span>initial slot content</span> > </slot> > > And the markup > <test-component> > <div>will be slotted</div> > </test-component> > > Then the inspector will show: > <test-component> > #shadow-root > <slot> > -> div > </slot> > <div>will be slotted</div> > </test-component> > > And indeed Chrome devtools are still showing the <span> under the <slot>. Is > this objectively better, since <span> is not rendered anywhere in the tree? > It's really not clear to me what the inspector should show. Should it be > closer to the authored content or to the rendered content? I believe that displaying the following might be best: ```html <test-component> #shadow-root <slot> -> div <span>initial slot content</span> </slot> <div>will be slotted</div> </test-component> ``` With `<span>initial slot content</span>` being displayed the same as any other node with `display: none;`. This is because the `<span>` element still exists as a child of the `<slot>` element, it just isn’t rendered as long as something is slotted into the `<slot>`.
Devtools shouldn't hide (shadow) DOM content, IMO.
Flags: needinfo?(bugs)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: