Does the shadow DOM replace ::before and ::after?

前端 未结 2 1984
一个人的身影
一个人的身影 2021-02-06 21:45

CSS Scoping says

The descendants of a shadow host must not generate boxes in the formatting tree. Instead, the contents of the active shadow tree gene

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 22:10

    CSS Scoping spec author here.

    The answer is actually, officially... undefined!

    I didn't think about this interaction when I was writing the Scoping spec. I'll send an email to the list, and we'll figure it out. Almost certainly, we'll settle on whatever browsers currently do (which appears to be letting ::before/after work "as expected" even in shadow hosts).

    Edit: The Working Group's response was unanimous - the current implementation behavior (::before/after do work on shadow hosts) is how it should be. I'll edit it into the Scoping spec shortly.

提交回复
热议问题