Unwrap <element>::before possible?

Unwrap <element>::before possible?

The simplified original source looks like

  1. <div class="foobar">
  2. :: before
  3. <div class="toremoveorhide">....</div>
  4. ...
  5. </div>

As far as I know it is difficult to manipulate code inside a ::before or ::after section of an element.

However I could imagine that a little workaround could ease this task:
Can I somehow "unwrap" the inner content of the ::before branch? Similar to

$(".foobar::before").content().unwrap();

Maybe there is another way to hide() or remove() the element with class ".tohideorrremove"?

If it is not possible with jQuery maybe there is a way in pure javascript?

Peter