How many HTML elements can “modern” browsers “handle” at once?

前端 未结 3 1312
旧巷少年郎
旧巷少年郎 2020-12-29 03:12

\"modern\" because that definition may change over time (and specifically I mean desktop browsers)

\"handle\" because that may vary depending on machine

3条回答
  •  Happy的楠姐
    2020-12-29 03:33

    Your answer is: 1 OR millions. I'm going to copy/paste an answer from a similar question on SO.

    To be honest, if you really need an absolute answer to this question, then you might want to reconsider your design.

    No answer given here will be right, as it depends upon many factors that are specific to your application. E.g. heavy vs. little CSS use, size of the divs, amount of actual graphics rendering required per div, target browser/platform, number of DOM event listeners etc..

    Just because you can doesn't mean that you should! :-)"

    See: how many div's can you have before the dom slows and becomes unstable?

    This really is an unanswerable question, with too many factors at too many angles. I will say this however, in a single page load, I used a javascript setinterval at 1ms to continually add new divs to a page with the ID incrementing by 1. My Chrome browser just passed 20,000, and is using 600MB Ram.

提交回复
热议问题