Where can "style" be added to DOM nodes?

I would like to add style="....." to some node (in CSS mode) .e.g.

<span class="cm-atom">#4a7e00</span>

… to …

<span class="cm-atom" style="_some style_">#4a7e00</span>

How can it be done?
Where is the best place to add it?

markText can do this with the CSS option.

I see that markText can be used when a new instance is created but how can it fire it again after each edit in the editor?