找不到在特定行上运行的脚本 [英] Can't find which script is working on a particular line

查看:97
本文介绍了找不到在特定行上运行的脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的jsp中有以下代码行:

 <td><form:input type="text" class="disable1" name="projowner" id="projowner"  path="projOwner"/></td>

在浏览器中渲染时,我发现代码是这样的:

<td><input id="projowner" name="projOwner" class="disable1" type="text" value disabled></td>

我在我的jsp中删除了class ="disabled1",并且发现我的HTML中不再显示disabled属性.我正在尝试调试chrome中的代码,并想查看哪个脚本/css在我的代码中插入了"disabled"属性.在chrome中检查元素"时,我在网络"标签中发现,在页面加载时有一些javascript文件正在下载.我试图在其中找到文本"disabled1",但该文本不存在.我也尝试在当前的jsp中找到它,但是仍然没有运气.有没有办法,像断点之类的东西或chrome调试器中的之类的东西,以便我可以看到在我的特定代码行上运行了哪些脚本.我正在使用Bootstrap和Apache磁贴.

-编辑-

下面是显示加载页面不包含禁用属性的图像:

解决方案

是的,这是由客户端代码执行的修改. Chrome的开发工具中有一个不错的工具,可让您设置DOM属性修改的断点.完成之后,您的浏览器将在执行更改的确切行中停止JS执行,从而使您能够确定触发该更改的原因. Chrome的文档中涵盖了详细信息. /p>

据说此功能也出现在Firebug中,但我找不到显然是该插件的较新版本.

I have following line of code in my jsp:

 <td><form:input type="text" class="disable1" name="projowner" id="projowner"  path="projOwner"/></td>

on rendering in browser I found that the code is like this:

<td><input id="projowner" name="projOwner" class="disable1" type="text" value disabled></td>

I deleted the class="disabled1" in my jsp and found that the disabled attribute is no longer present in my HTML. I am trying to debug the code in chrome and want to see which script/css inserted the 'disabled' attribute to my code. While "inspecting elements" in chrome, I found in network tab that there were some javascript files getting downloaded while the page loads. I tried to find the text 'disabled1' in them but it was not present. I also tried to find it in the current jsp but still no luck. Is there any way, something like breakpoint or such in chrome debugger so that I can see which scripts ran on my particular line of code. I am using Bootstrap and apache tiles.

--edited--

Below is the image which shows that the page on loading doesn't contains the disabled attribute:

解决方案

Yes, this is a modification performed by the client code. There's a nice tool in Chrome's development tools that allows you to set a breakpoint on DOM attributes modification. After you've done that your browser will halt JS execution in the exact line that made the change, allowing you to figure out what's triggering it. The details are covered in Chrome's documentation.

This feature is also reportedly present in Firebug but I couldn't find it in an apparently newer version of the plugin.

这篇关于找不到在特定行上运行的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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