JavaScript Tutorial: Work off-DOM with JavaScript - Part 2

preview_player
Показать описание
Use JavaScript to create web page elements off-DOM and load them onto a web page. Discusses createDocumentFragment(), cloneNode(), appendChild(), the jQuery .attr() method, childNodes[] and more.

Рекомендации по теме
Комментарии
Автор

innerHTML was added so viewers would learn 1 extra thing. A single child isn't being added: 3 elements are being loaded into a doc frag, then the frags loads onto the page. Paul Irish outlines this on his "HTML5, CSS and DOM Performance" screencast as does Cody Lindley in "JavaScript Enlightenment".

As mentioned, in the Part 1, it's definitely easier to hard code elements than to build them off-DOM and load them in. The point of the video was to teach end users how to implement things off-DOM.

KaiGittens
visit shbcf.ru