v141 · css · pseudo-elements

Originating-element inspector

The spec says ::interest-button “only exists on valid interest sources”. Every specimen below gets the same author rule, content: "ⓘ" / "". The inspector reads what the cascade computed and then measures whether a box was actually generated — the two disagree, and that disagreement is the whole lesson.

Flag: Blink feature HTMLInterestForInterestButtonPseudo (status experimental). Enable chrome://flags/#enable-experimental-web-platform-features and relaunch, or start Chrome with --enable-blink-features=HTMLInterestForInterestButtonPseudo or --enable-experimental-web-platform-features.
Probing this browser…

Detection: three probes, one truth

Probing…

Which hosts get a box?

Interest shown. Only valid interest sources can open this — and only they get an ⓘ.
Measuring…

Box order: ::before, ::after, then ::interest-button

link text and the text that follows.

The ⓘ is generated as if it were a following sibling, so it lands after the green ::before “B”, the link text and the rose ::after “A” (WPT interestfor-pseudo-element-insertion-order). This row is a visual check, not a probe: pseudo-element boxes cannot be measured individually from script.

how the inspector measures

// what the cascade says (not proof of rendering)
getComputedStyle(host, "::interest-button").content   // '"ⓘ" / ""'

// what layout did: compare a marker after the host
// with the rule applied vs. with content:none
const shift = markerX(withRule) - markerX(withoutRule);
shift > 0   // a box was generated

// hit-testing a generated box returns the ORIGINATING element
document.elementFromPoint(x, y) === host

see also