slot name Fallback Shadow DOM Lookup

Resolves automatic named slot assignment from direct host slotable names. The first slot with a given name receives matching nodes; later same-name slots display fallback. Text nodes use the empty default name. Manual assignment is outside this profile.

Description

A shadow DOM slot distributes eligible direct children of a host.

A shadow DOM slot distributes eligible direct children of a host. Nodes with no slot name use the empty default name; unassigned slots display their fallback content.1

Resolves automatic named slot assignment from direct host slotable names. The first slot with a given name receives matching nodes; later same-name slots display fallback. Text nodes use the empty default name. Manual assignment is outside this profile.

When to use slot name Fallback Shadow DOM Lookup

Use this for the following task: Resolves automatic named slot assignment from direct host slotable names. The first slot with a given name receives matching nodes; later same-name slots display fallback. Text nodes use the empty default name. Manual assignment is outside this profile.

Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.

How to use slot name Fallback Shadow DOM Lookup and understand its results

  1. Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
  2. Enter slotName, earlierSlotNames, nodeSlotNames using the field table, then run the tool.
  3. Read assignedIndices, assignedCount, usesFallback. Interpret flags, units, ordering and placeholder values using the rules below.
  4. Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
Input fieldMeaningValue type and boundsRequirement
slotNameSlot Namestring; maximum text length 100000Required
earlierSlotNamesEarlier Slot Nameslist of string; minimum entries 0; maximum entries 10000; each entry: string; maximum text length 10000Required
nodeSlotNamesNode Slot Nameslist of string; minimum entries 0; maximum entries 10000; each entry: string; maximum text length 10000Required

Supply the slot’s name, preceding slot names and direct slotable node names. Exact case-sensitive matching assigns nodes only to the first slot with a particular name. Return zero-based indices in host-node order.2

assignedIndices = matching node indices if no earlier slot has this name; usesFallback = assignedCount == 0

This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.

Output fieldMeaningValue type
assignedIndicesAssigned Indiceslist of integer
assignedCountAssigned Countinteger
usesFallbackUses Fallbackboolean
json
{
  "input": {
    "slotName": "title",
    "earlierSlotNames": [],
    "nodeSlotNames": [
      "",
      "title",
      "title"
    ]
  },
  "output": {
    "assignedIndices": [
      1,
      2
    ],
    "assignedCount": 2,
    "usesFallback": false
  }
}

Limitations and assumptions

Manual slot assignment, descendant traversal and rendering of fallback contents are outside this lookup.

This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.

Alternative or Complementary methods

Choose template Inert Content Note for this operation: Classifies ordinary template DocumentFragment contents versus content already inserted into a document or a processed declarative shadow root. Only ordinary template contents remain in the inert template owner document; other reasons for inertness are not evaluated. For a complementary task, use Custom Element Dash-Name Requirement for this operation: Validates custom-element names using the current HTML and DOM local-name rules: initial ASCII lowercase, a dash, no ASCII uppercase or forbidden local-name characters, and no reserved SVG/MathML names. This does not check registry availability.

Further background: HTML / accessibility reference: slot name Fallback Shadow DOM Lookup.

References

  1. HTML / accessibility reference: slot name Fallback Shadow DOM Lookup — WHATWG

  2. slot name Fallback Shadow DOM Lookup — tool.io

Similar or alternative tools

  • template Inert Content Note

    Classifies ordinary template DocumentFragment contents versus content already inserted into a document or a processed declarative shadow root. Only ordinary template contents remain in the inert template owner document; other reasons for inertness are not evaluated.

  • Custom Element Dash-Name Requirement

    Validates custom-element names using the current HTML and DOM local-name rules: initial ASCII lowercase, a dash, no ASCII uppercase or forbidden local-name characters, and no reserved SVG/MathML names. This does not check registry availability.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies