Each element below is named from its contents. In the first group its contents are the single character "x", and text in a following sibling belongs to that sibling and must not be part of the name.

x
should not be in the name
x
should not be in the name
x
should not be in the name
x
should not be in the name

In the second group the contents are "x" and "y" in different boxes, such as the items of a flex container, and both are part of the name.

x
y
x y
x y
x should not be in the namey
x y
x y

In the third group the element is a shadow host, so its contents are those of its shadow tree, where a slot stands for the nodes assigned to it or else its fallback content.

y
should not be in the name