Answer the question
In order to leave comments, you need to log in
Is it considered bad practice to use text nodes?
There is a markup:
<div><span class="font-ico">Тут иконка</span>1234566</div>
document.querySelector("div").childNodes[1].data = 222222;
document.querySelector(".chislo").textContent = 22222;
Answer the question
In order to leave comments, you need to log in
The span tag is made to logically highlight text. If you have a block that is changed by means of client scripts, it is logical to separate such elements into a separate tag. In my opinion, the problem is that today you have the opportunity, by indirect signs, to tear out this text, and tomorrow something will be added there and this opportunity will disappear and you still have to make a selection in the tag.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question