chrome 检查器关闭表单标签

发布于 2024-11-15 02:19:27 字数 459 浏览 2 评论 0原文

我正在查看某人的 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

虫児飞 2024-11-22 02:19:27

您在检查器中看到的(对于 firebug 也是如此)是给定源的浏览器解释(或渲染)版本,而不是真正的源。

为什么像 C.inspector 这样的开发工具会显示修改后的版本?

如果错误检查太严格,很多网页将根本无法查看。

如何关闭它?

我认为这是不可能的。

除了标签之外还有什么是自动关闭的

浏览器需要获得格式良好的 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.

why would a developer tool like C. inspector show the modified version?

If error checking were too strict, a lot of webpages wouldn't be viewable at all.

how to turn it of ?

I don't think that's possible.

what else is autoclosed except tag

Everything the browsers needs to get a wellformed html-source.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文