Is there a CSS selector for elements containing certain text?

后端 未结 18 2459
别跟我提以往
别跟我提以往 2020-11-21 04:26

I am looking for a CSS selector for the following table:

Peter    | male    | 34
Susanne  | female  | 12

Is there any selector to match all

18条回答
  •  猫巷女王i
    2020-11-21 05:03

    There is actually a very conceptual basis for why this hasn't been implemented. It is a combination of basically 3 aspects:

    1. The text content of an element is effectively a child of that element
    2. You cannot target the text content directly
    3. CSS does not allow for ascension with selectors

    These 3 together mean that by the time you have the text content you cannot ascend back to the containing element, and you cannot style the present text. This is likely significant as descending only allows for a singular tracking of context and SAX style parsing. Ascending or other selectors involving other axes introduce the need for more complex traversal or similar solutions that would greatly complicate the application of CSS to the DOM.

提交回复
热议问题