Текст, вставленный с помощью ::before и ::after, нельзя выделить и скопировать.
Как я могу это изменить?
span::before {
content: "including this text";
}<p>
If the text of this paragraph is selected and copied then all of it should be copied
<span>instead of only this part</span>.
</p>Использование JavaScript вместо CSS неприемлемо. Но следующий JavaScript был бы приемлемым:
::before.:: before текст в display:none.


![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


функция, принимающая элемент и возвращающая текст ::before.
function getPseudoElementContent(selector){
return window.getComputedStyle(
selector, ':after'
);
}
функция, принимающая элемент и помещающая его :: перед отображаемым текстом: none
enter code here
function setPseudoElementContent(selector){
selector.classList.add("customBefore")
}
// And add in your style
.customBefore::before{
content:"" !important;
}
Чего вы в конечном итоге пытаетесь достичь?