The DOM breakpoint debugging method of JavaScript debugging using tips to share _javascript skills

Source: Internet
Author: User

Some students will say that you can use the source code search method. Indeed, for a relatively simple page, this method often works. However, for pages that make up a relatively complex page, such as a page that embeds many script files and fragments, uses a large object-oriented implementation, and hides the implementation code, it may not be as smooth as it might look.

In JavaScript debugging, we often use breakpoint debugging. In fact, in the debugging of the DOM structure, we can also use the breakpoint method, which is the DOM Breakpoint (Dom breakpoint).

Specific methods of use:

1. In the Chrome browser, open the Developer tool, first select a page element, then click the right mouse button, click on the menu "Break on ..."-Tick "Attributes modifications". Refreshes the page and, when the attributes of that element change, pauses the execution of the script and locates where the change occurred.

2. In the Firefox browser where Firebug is installed, open firebug, switch to the HTML tab, select the DOM elements you want to monitor, right-click, and check the "Break when property changes" in the menu. This succeeds in adding an HTML breakpoint. After refreshing the page, Firebug also helps us navigate to the code that changes the element's properties.

In addition to monitoring the property changes of the DOM elements themselves, Chrome and Firebug can also monitor the changes in their child elements and when the elements are deleted.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.