Is it better to use
document.createNode();
or plain text for example
var foo = '<div> bar </div>';
create HTML markup using JavaScript?
In this particular case there is no “best”, it will come down to what is most easily supported. and programmer preference.
In some browsers, using the DOM to create elements and nodes, in terms of performance, is faster than others. Some user agents process strings faster, for example, by setting a property innerHTML.
innerHTML
DOM, mootools, . jQuery .
: http://jsperf.com/string-vs-createelement/3, : http://www.quirksmode.org/dom/innerhtml_old.html http://karma.nucleuscms.org/item/101
DOM node. , jQuery, DOM.
var foo = $('<div> bar </div>');
DOM, , , , , , .
, , DOM .
, , CSS, , JS, .
html IE (, , IE innerHtml ), , , html, html, .
, DOM node.