在崩溃浏览器之前,您可以拥有多少个嵌套的HTML代码? [英] How many nested tags in HTML can you have before it crashes a browser?
问题描述
我今天早些时候想过有关嵌套HTML标签以及浏览器如何呈现它们:
I had a thought earlier today regarding nested HTML tags and how browsers render them:
<html xmlns="http://www.w3.org/1999/xhtml" {or whichever html version} xml:lang="en" lang="en">
<head>
</head>
<body>
let n
= 1
<div>
recurse div n
失败)
recurse div n
times until maximum (browser fails)
</div>
</body>
</html>
n
处理任何更多的递归?
what will n
be when the browser cannot handle any more recursion?
我认为这将是不同的每个浏览器,不同的移动应用程序。有没有网络标准,例如域名的最大127个字符长度?
I would think this would be different for each browser, and different also for mobile apps. Is there a web standard, such as the maximum 127 character length for domain names?
我从来没有遇到这个问题,但我很好奇,当它会。 p>
I have never run into this problem, but I am curious when it would.
推荐答案
没有标准要求最大嵌套,因此这将是完全实现特定的。
There is no standard requiring a maximum nesting, so this will be entirely implementation specific.
在崩溃之前,浏览器将无法使用(减速等)。
Chances are that before crashing, the browser would become unusable (slow downs etc).
如果你很好奇,生成嵌套代码的应用程序,并查看每个浏览器何时崩溃):)
If you are very curious, you can benchmark this - code an application that generates nested tags and see when each browser crashes on you :)
这篇关于在崩溃浏览器之前,您可以拥有多少个嵌套的HTML代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!