Flexible application of JS debugging techniques to solve style problems share _javascript skills
Source: Internet
Author: User
In this case, debug becomes a headache for a variety of reasons, such as complicated code logic, long time forgetting processing details, or simply taking over changes to other people's legacy bugs.
In this sharing some JS debugging skills, for a variety of difficult and incurable diseases, often can play a better effect.
Step 1: Check what the server directly render out
By using a view of the source file, this step begins by clarifying whether the page HTML fragment is not normal on the server side.
Step 2: Compare the difference between the actual HTML content and the original content of the server render
You can use some front-end tools (such as developer tools under IE, Firebug, chrome developer tools, and so on) to view current HTML fragment content in real time
Step 3: Add debugger in the right place
For example: First find the likely problem of JS code, in the appropriate place to add debugger, or use the tool to increase similar to "when the property is modified to break" breakpoint, for example, the actual HTML than the original content of a width attribute
Step 4: Run your page, go into the interrupt, and check the JS call stack (the critical one)
It is recommended that you use the Visual Studio debugger supported by IE (you need to set ie: Cancel "Disable script debugging"), and then basically determine which JS method modifies the style
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