Is there a way to designate some HTML content as not managed by jQuery?
In another question, I asked why it takes so long to remove HTML content from a page with jQuery.
Apparently when removing HTML content from an element, jQuery has to march through each element and do... something.. I don't know exactly what. And this can take a vvery long time for large-ish HTML content.
In an effort to side-step the problem, I'm wondering:
Is there a way to add dynamic HTML content to a page, that uses jQuery, but NOT allow jquery to "adopt" the content?In other words I want some subset of the HTML content in a page to be outside of the purview of active management by jQuery.
In this particular case, the content is within a jQuery accordion. So I want the accordion to work, but开发者_开发知识库 for everything beneath the divs for the accordion panels, I want jQuery to not be aware of those things. The goal is to short-circuit the very lengthy process it takes to remove that content, later.
Does this make sense?
possible?
What if, instead of doing something like $('#elementid').html(content)
, I just used the innerHTML property on the element itself, using document.getElementById()
Would that keep jQuery out of the subcontent?
I guess I'll try it, but if anyone has any insight, I'd appreciate it.
If it is in the DOM, the jQuery knows about it.
It does sort of make sense but sidestepping it is going to be ugly.
The first thing that came to mind was embedding your content with iframes. I'll freely proffer that this is an absolute abomination of an idea, but it should work as it should be a whole new document and thus a whole separate DOM.
Is it important that this content be kept? If they are visible elements, you could simple hide()
them instead.
精彩评论