jquery - How does $('<html><head>...</head><body>...</body></html>') work? -
i still trying create full dom document
string. got bunch of interesting suggestions on this other question, none fits i'm looking for. i'm trying understand how things work maybe find solution.
we need replace lot of jquery code 'native' javascript. jquery, able $('<html><head>...</head><body>...</body></html>')
, perform operations on nodes of object, search them... etc.
what jquery do? create new document? append existing one?
since lot of people question our replacement of jquery, here little more details: building chrome application make use of content script. if jquery lightweight, it's not kind of add couple mb of memory consumed in each tab few jquery methods. jquery is awesome , fits many many needs, not ours.
you can find answer in jquery source. start out core.js
, you'll find init
method. if follow logic there, you'll see nontrivial elements it'll call jquery.buildfragment
, indeed builds documentfragment
it'll populate content specified. teach how deal building dom tree string, including stripping out various bits of content won't want.
Comments
Post a Comment