Hi guys, I'm working on a template system in JavaScript. When we receive a template from the server, we inject it on the main DOM tree, hide it and start performing a lot of DOM manipulations (expand nodes, replacements, fill data, i18n operations...). I want it to be as fast as possible in all browsers, specially IE7. So I wonder if it will be faster to save the templates in his own DOM document to completely avoid reflows. The goal is to perform all manipulations on this new DOM document and inject the resulting element into the main tree using a single operation. I tried to use DocumentFramgent but it doesn't provide the method 'getElementById()' (it's a requirement), so I need full DOMDocuments.
I'm currently implementing this solution, and I wonder if the performance cost of document.importNode() is worth it. Has someone experience working with multiple DOM documents? Or, can someone provide more info about the speed of operations like document.importNode() across all browsers? Do you see any big problem with this approach (ex: maybe CSS rules doesn't apply to imported elements)? -- S.Cinos JavaScript Developer at Tuenti.com -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
