元素存在于Chrome开发工具中,但不存在于“查看源代码"中-这怎么可能? [英] Element present in Chrome Dev Tools but NOT in View Source - how is this possible?

查看:321
本文介绍了元素存在于Chrome开发工具中,但不存在于“查看源代码"中-这怎么可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图对网站(使用OpenCart构建)中的一些设计问题进行故障排除,并遇到了一个我从未见过的问题:一个元素出现在Dev Tools中,但没有出现在View Source中.

Trying to troubleshoot some design issues on a website (built with OpenCart), and ran into an issue I've never seen before: an element shows up in Dev Tools but DOESN'T show up in View Source.

这怎么可能?以及如何找到实际元素?

How is this possible? And how can I find the actual element?

这种情况是,我不得不修改原始模板(category.twig)才能将添加到购物车"按钮更改为查看" ...并且它可以在默认类别视图中使用,但是只要选择过滤器后,就会发生这种情况...它会还原为原始视图..但是它仍然是同一文件(我将路径添加到了代码本身中,只是为了确保我确实在查看同一文件,您可以请参见屏幕快照的代码视图"部分.

The situation is, I had to modify the original template (category.twig) to change the "Add To Cart" button to "View"... and it works in the default category view, but as soon as any of the filters are selected, this happens... it reverts to the original view.. but it's still the same file (I added the path into the code itself, just to make sure I'm indeed looking at the same file, you can see in in the Code View portion of the screenshot).

是的,...试图跟踪此添加到购物车"的来源,并且非常困惑,为什么它没有显示在查看源代码"中.不,没有针对"view_button" DIV并将其转换为添加到购物车"的JavaScript-我制作了"view_button" DIV,这是自定义的.

So yeah... trying to trace where this "Add To Cart" is coming from, and being mighty confused as so why it's NOT showing up in View Source. And no, there's no JavaScript targeting the "view_button" DIV and transforming it into "Add To Cart" - I made the "view_button" DIV, it's custom.

有什么建议吗?

推荐答案

JavaScript可以(而且经常)在文档中创建新元素,因为它不执行javascript,因此不会出现在代码视图中.我建议您下载整个页面,然后在js文件或整个文档中搜索按钮购物车文本.

Javascript can (and often does) create new elements in the document, that won´t appear on code view becasuse it does not execute javascript. I would advice you to download the entire page and then search for button-cart-text in js files or the whole document.

这篇关于元素存在于Chrome开发工具中,但不存在于“查看源代码"中-这怎么可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆