chrome 检查器关闭表单标签
我正在查看某人的 .asp 代码,发现他正在打印 HTML 而不关闭它。我去了 Chrome 并在它的检查器中查看 DOM 以及在哪里关闭它,突然发现它是:标签!
我返回 .asp 检查是否遗漏了某些内容,但没有 html 包含或 .js 可以关闭它。我以为我疯了,然后我的一位同事告诉我,有些浏览器正在自行关闭未关闭的标签?!
对于所有糟糕的代码来说,这是有道理的,但是......
Inspector 有标签,但真正的 HTML 源代码没有,所以我假设 Chrome 读取源代码,神奇地添加结束标签,然后呈现页面。然后,Chrome 检查器会检查经过神奇更改的版本。
我的问题是:
为什么像 C.inspector 这样的开发工具会显示修改后的版本?
如何关闭它?
- 除了标签之外还有什么是自动关闭的
非常感谢
I was going through someone's .asp code and saw that he was printing a HTML without closing it. I went to Chrome and in its inspector to see the DOM and where to close it when out of the sudden there it was: the tag!!
I went back to .asp to check if I missed something, but there were no html includes or .js that would be closing it. I thought I was going crazy and then a colleague of mine told me that some Browsers are closing unclosed tags by themselves?!
It makes sense regarding all the bad code out there but...
Inspector has the tag, but the real HTML source code doesn't so I assume Chrome reads the source code, magically adds closing tags and then presents the page. Chrome inspector, then, inspects the magically changed version.
My questions are:
why would a developer tool like C. inspector show the modified version?
how to turn it of ?
- what else is autoclosed except tag
Thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在检查器中看到的(对于 firebug 也是如此)是给定源的浏览器解释(或渲染)版本,而不是真正的源。
如果错误检查太严格,很多网页将根本无法查看。
我认为这是不可能的。
浏览器需要获得格式良好的 html 源的所有内容。
What you see in the inspector (same goes for firebug) is the browser-interpreted (or rendered) version of the given source not the real source.
If error checking were too strict, a lot of webpages wouldn't be viewable at all.
I don't think that's possible.
Everything the browsers needs to get a wellformed html-source.