what is `::content` in a css?

时间:2016-02-03 03:33:53

标签: css google-chrome css-selectors

I wonder what is ::content in a css rule ?

The thing is that when I use AdBlock Plus(for chrome), it seems that it will add a css rule to my websites, as below:

enter image description here

It will make the dom hidden (display: none), and I try to reset the css to make it seen using setTimeout, but I failed, both csses (the ABP adds and I add) work, so the dom is still not seen.

I check the css the ABP adds, finding ::content, I wonder it's the reason why I cannot reset the css rules, but after google, I find nothing useful.

So I come here to see if there is someone to help me! With great thanks!

1 个答案:

答案 0 :(得分:1)

I'm having trouble finding official documentation on this pseudo-element selector, but it's a selector for Shadow DOM elements. See the following excerpts from the AdBlock Plus Chrome extensions source code:

include.preload.js convertSelectorsForShadowDOM

function convertSelectorsForShadowDOM(selectors)
{
  var result = [];
  var prefix = "::content ";

...

include.preload.js call to convertSelectorsForShadowDOM

    // If using shadow DOM, we have to add the ::content pseudo-element
    // before each selector, in order to match elements within the
    // insertion point.
    if (shadow)
      selectors = convertSelectorsForShadowDOM(selectors);
相关问题