admin管理员组文章数量:1355093
Is there anyway to freeze or lock the DOM of a page, so no further changes (CSS or Javascript etc) can be made to it?
I keep having difficulty in finding elements that appear or disappear when the div
or page loses focus.
My normal approach of right clicking an element to inspect it makes the element disappear from the DOM.
By manually searching through the DOM Inspector, I can find the element, but as soon as I click on it inside the Inspector the element disappears from the DOM.
This whole situation results in certain interactive parts of the page being plete unreachable. I cannot find out what CSS rules are applied to them, what line number in which CSS file I should look or anything. And I really dont want to have to search through multiple CSS files, looking at each rule and trying to figure out if this is the rule I am looking for.
Is there anyway to freeze or lock the DOM of a page, so no further changes (CSS or Javascript etc) can be made to it?
I keep having difficulty in finding elements that appear or disappear when the div
or page loses focus.
My normal approach of right clicking an element to inspect it makes the element disappear from the DOM.
By manually searching through the DOM Inspector, I can find the element, but as soon as I click on it inside the Inspector the element disappears from the DOM.
This whole situation results in certain interactive parts of the page being plete unreachable. I cannot find out what CSS rules are applied to them, what line number in which CSS file I should look or anything. And I really dont want to have to search through multiple CSS files, looking at each rule and trying to figure out if this is the rule I am looking for.
Share Improve this question asked Aug 25, 2016 at 12:04 JimmeryJimmery 10.1k25 gold badges89 silver badges164 bronze badges 7- do you want to just inspect your element?then use undock into separate window.in chrome – Gaurav Parashar Commented Aug 25, 2016 at 12:07
- Can you just open the developer tool and use the little mouse icon to search for the inspectable element? This way you wont have to click on them. – thepio Commented Aug 25, 2016 at 12:07
-
2
Have you tried using one of the options in
Break on...
in the context menu for elements in the DOM? (In Chrome) e.g.Break on Node removal
– sdgluck Commented Aug 25, 2016 at 12:07 - You can also set element's state in css with :hover, :focus, etc in the developer console. – epascarello Commented Aug 25, 2016 at 12:10
- 1 @sdgluck That sounds useful - can you add that as an answer and expand on it slightly? Thanks! – Jimmery Commented Aug 25, 2016 at 12:13
2 Answers
Reset to default 6Have you tried using one of the options in Break on...
in the context menu for DOM elements in the Chrome Developer Console?
For example, Break on Node removal
. This will act as a breakpoint for removal of a particular DOM element.
(click the image to see it larger)
If the styles are applied when an element is in a state such as hovered/focused, you can force the element state in chrome.
- Inspect the element you want to have the state.
- Click the
:hov
menu option in the styles panel - Click the checkbox that is the state you want
Or
- Right click on the element's tag in the Element pane
- Select the CSS state from the context menu
Other browsers have similar options.
本文标签: javascriptIs there anyway to freeze or lock the DOM of a pageStack Overflow
版权声明:本文标题:javascript - Is there anyway to freeze or lock the DOM of a page? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744001396a2573920.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论