Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to "step through" a browser's applying of CSS rules for web development?

Tags:

css

debugging

Is there a way or tool that could let me step through the painting of CSS rules, one by one?

Similar as one would do in an IDE with program code, but with CSS. (But I wouldn't preferably want to do it by taking the browser's source code and stepping through its underlying functions - I just mean stepping throug "updates" by CSS rules, in a form similar to a Web Developer Toolbar.)

I expect this is usually more tedious than useful, but in some cases it would really help, in web development, like debugging cats and owls or finding out how a particular effect is achieved.


edit to clarify, by "stepping through" I mean sg. like: potentially stopping the browser from painting another rule, after each end every rule I choose, before the next one is applied (each before the "final paint" of the page is finished), for inspection of what happens.

edit 2 after BoltClock's comment, I replaced the word 'render' with 'paint', to be more clear. Removed original to be uncluttered.

like image 605
n611x007 Avatar asked Nov 18 '13 08:11

n611x007


People also ask

What can you do with the browser's developer tools?

It allows you to run lines of JavaScript against the page currently loaded in the browser, and reports the errors encountered as the browser tries to execute your code. To access the console in any browser: If the developer tools are already open, click or press the Console tab.

How do you debug a web application?

If you want to debug it, you should press F12 on Chrome to open the developer mode. You can see that the JS code of the current page is under the Source menu, you can set a breakpoint directly at the beginning of the script. Then you can click on the UI button or menu to start debugging(both js and backend activity ).

Which of the following is Web debugging tools?

Chrome DevTools A debugging tool that is built directly into the Google Chrome browser, Chrome DevTools aims to help developers manipulate a webpage in real-time.


1 Answers

Beside already mentioned webtools i guess this is only possible if the complete source code of the browser is available so its possible to either locally debug or remote debug the browser application itself with breakpoints set to the interesting "toplevel" functions.

It is for example no problem to download the source of the Java based open source browser Lobo which can then be debugged like any other application directly from your IDE like eclipse, intellij etc.

I however dont think the complete source of products like the MS Internet Explorer will ever be fully available to allow you to debug its deepest magic (which in case of MS Internet Explorer probably also takes a livetime...).

So coming back to a browser that has source code available you can either:

  • Have the browser beeing compiled/ run inside a IDE and directly debug your local code
  • Have the browser running as application allowing remote debugging and the according source code as source for a remote debugger (mostly as well from within your IDE).

This way you can analyse the deep magic of such a browser where you see how the different resources like images, css etc. etc. are collected, validated, parsed, processed and in the end displayed.

Once the interesting functions are located and a good set of (conditional) breaktpoints is set this could be very useful when it comes to the behaviour of a specific browser.

If that however is too detailed for your context i guess there is no other possibility but to rely on the already given functionality regarding analysing the browsers behaviour like with chromes devTools or the Mozilla plugin Firebug. No doubt this will more and more be integrated in such plugins/ tools like the comment of user BoltClock suggests and it is always worthy to study the functionality of such plugins/ tools to take the biggest possible advance of them.

like image 183
JBA Avatar answered Sep 22 '22 04:09

JBA