Assign content to a named slot.
Acceptance criteria
- 1.Assign content to a named slot.
HTML Tutorial · HTML Tags
These 10 tasks go with the HTML <shadow> Tag (Obsolete) chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “The experimental <shadow> element from Shadow DOM v0 is obsolete and unsupported.” .
1.Use a slot insteadexercise · easy · 10 min
Assign content to a named slot.
Passes when: Assign content to a named slot.
2.Declare a templateexercise · easy · 10 min · practice plan
Add a template a component would use.
Passes when: Add a template a component would use.
3.Use a custom elementexercise · easy · 10 min · practice plan
Add a custom element with content inside it.
Passes when: Add a custom element with content inside it.
4.Two slotted partsexercise · easy · 10 min · practice plan
Fill two named slots in the component.
Passes when: Fill two named slots in the component.
5.A component and its templateexercise · medium · 10 min · practice plan
Add a custom element with slotted content plus its template.
Passes when: Add a custom element with slotted content plus its template.
6.Fix the obsolete shadow elementbug fix · easy · 8 min
shadow was removed; content is placed with slots.
Passes when: shadow was removed; content is placed with slots.
7.Fix the template with no idbug fix · easy · 8 min · practice plan
A component cannot find an unnamed template.
Passes when: A component cannot find an unnamed template.
8.Fix the div used as a componentbug fix · easy · 8 min · practice plan
A component is a custom element, not a div.
Passes when: A component is a custom element, not a div.
9.Fix the second part with no slotbug fix · easy · 8 min · practice plan
The body was never assigned.
Passes when: The body was never assigned.
10.Fix the component with no templatebug fix · easy · 8 min · practice plan
There is nothing for the component to render.
Passes when: There is nothing for the component to render.
Between them these tasks cover Removed element, slot replacement and Custom elements.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.