Let's assume we have lots of elements (see Live demo):
<div class="yes">Hello1</div>
<div class="yes">Hello2</div>
<div class="yes">Hello3</div>
<div class="yes">Hello4</div>
<div class="yes">Hello5</div>
with the same class called yes which has a simple CSS style :
.yes { color:red; }
Now I would like to change the style of the yes class.
Of course, we can change CSS style of this class with Javascript by using
var yesarray = document.querySelectorAll('.yes');
for (var i = 0, len = yesarray.length; i < len; i++) {
yesarray[i].style.color = 'black';
}
(or even more easily with jQuery, with $('.yes').css(...) ...)
But then all these changes will be stored in the DOM :

This is not very elegant if I have lots of elements, that all these styles are "rendered in the DOM" like this.
Question:
How to change CSS style with Javascript such that the style change is not stored in the DOM, but modified in the loaded-in-memory CSS instead?