简体   繁体   English

是否可以在JavaScript应用程序中创建和管理多个DOMS?

[英]Is it possible to create and manage multiple DOMS in a javascript application?

We are trying to mix frameworks like JQuery Mobile that like to take control of the DOM when they are functioning. 我们正在尝试混合诸如JQuery Mobile之类的框架,这些框架希望在DOM运行时对其进行控制。

We want to allow the frameworks to manage the DOM as they want, but when we switch frameworks in our Javascript application we can kill the previous DOM and create a new one. 我们希望允许框架根据需要管理DOM,但是当我们在Javascript应用程序中切换框架时,我们可以杀死以前的DOM并创建一个新的DOM。

Strange question :p. 奇怪的问题 Well it is possible to create a javascript framework that is able to manage everything. 好吧,可以创建一个能够管理所有内容的JavaScript框架。 You just need an index.html that loads the first file, nothing else is necessary. 您只需要一个index.html即可加载第一个文件,而无需执行其他任何操作。 There are no limits in javascript. javascript中没有限制。 To begin with, all you need is document.createElement, node.appendChild and node.removeChild. 首先,您只需要document.createElement,node.appendChild和node.removeChild。 I dont know if this answer helps you because i dont really understand what the question here is. 我不知道这个答案是否对您有帮助,因为我不太了解这里的问题。

You could use jQuery.parseHTML() function to create a set of DOM elements which can at some point be inserted (or not) into the document. 您可以使用jQuery.parseHTML()函数创建一组DOM元素,可以在某些时候将其插入(或不插入)文档中。 The parsed structure can be manipulated with jQuery or passed to other libraries for manipulation (although I am not sure how straightforward is this, depending on the other libraries you want to use...). 可以使用jQuery操纵已解析的结构,也可以将其传递给其他库进行操纵(尽管我不确定这有多简单,取决于您要使用的其他库...)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM