Franz Deschler
Franz Deschler

Reputation: 2574

jQuery object memory size

I want to optimise the memory usage of my application.

Suppose I have a HTML file with a very large list element in it which 1000 list items.

<ul>
  <li>item 1</li>
  <li>item 2</li>
  ...
  <li>item 1000</li>
</ul>

If i create a jQuery object of the complete list, how would jQuery store the child nodes? Would it contain objects for each list item?

var list = $("ul");

Upvotes: 3

Views: 611

Answers (1)

ntzm
ntzm

Reputation: 4821

Yes, it would contain objects for each of the children, in the ul object propoerty childNodes.

Here is a quick demo I put together: http://jsfiddle.net/u9nLwwbf/

Upvotes: 1

Related Questions