0

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!

Josh Crozier
  • 219,308
  • 53
  • 366
  • 287
hanzichi
  • 529
  • 1
  • 9
  • 22
  • `::content` seems like non standard/secret pseudo-element. What node in normal or shadow tree it represents is unknown, we only can guess unfortunately. – c-smile Feb 03 '16 at 03:51

1 Answers1

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);
Alexander O'Mara
  • 56,044
  • 17
  • 157
  • 163