Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is true HTML debugging possible?

Tags:

html

debugging

I've been a web developer for quite some time and what has helped me in learning is to visually see what is going on.

That's the reason for Tools like Aardvark, Web developer, Firebug and many others.

But when i saw the Gecko Reflow Videos they just blew my mind.

Then my question is, is it possible to truly debug html (step through each element)? Or come close to it?

What i've been doing a lot is to use Aardvark and remove elements but Aardvark has its issues with "background" and same size elements and not being able to target those.

UPDATE: I've been trying to write a good update for this question since it has left me thinking about it more. But since English isn't my primary language its been tough.

In the past years it's been the browsers who have had the task of being compatible with the standards. As they get closer to that goal, it is us who should be thinking about what we can truly create when browser compatibility is minimal, and if there are techniques we can utilize that makes rendering a page faster.

We can think of the past decades as the early years of HTML/CSS, where the main goal was just to get the thing to work. Now we should be looking for techniques that speed up the current process. An example of this is in the video above where the Gecko engine is running through the code twice. Why is that? And are there other instances where its doing unnecessary things (even though they work and are compatible)

This is something that clearly needs to be tested to be confirmed, hence my original question of a true debugger.

like image 834
Ólafur Waage Avatar asked Dec 22 '08 20:12

Ólafur Waage


People also ask

Can we debug HTML code?

HTML itself doesn't suffer from syntax errors because browsers parse it permissively, meaning that the page still displays even if there are syntax errors. Browsers have built-in rules to state how to interpret incorrectly written markup, so you'll get something running, even if it is not what you expected.

How do I debug HTML in Chrome?

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 ).

How do you debug HTML tags?

Click any element with right mouse button > inspect. Use Ctrl+Shift+I (or Cmd+Opt+I on Mac) to open the DevTools and pick the Elements tab.


1 Answers

My $0.02:

"True" HTML debugging, in the sense you're talking about, is not technically possible, because there is no requirement of HTML user agents (web browsers) to render HTML elements in a particular order, nor is there anything like an atomic unit of execution like a "statement".

For instance, when rendering a table, should a user agent reserve space for each <tr> before rendering their child <td>s (breadth-first)? Or should it render each child <td> and each <td>s child and so forth (depth-first)? In practice, user agents make all kinds of guesses to try to render pages as quickly as possible. In other words, there would be no guarantee that debug-order will match actual render-order, nor should there be.

HTML can be thought of as an declarative language in this sense, in that it specifies what should be done (the page rendered to spec) but not exactly how to do it (exactly which order to render elements to the screen). In general, it's best to assume that everything happens at once, although the W3C does give some tips on speeding up <table> rendering based on how user agents should render <table> elements.

IMO, the webdev toolbar and Firebug are the best we've got, where we can edit/disable specific HTML elements and CSS rules.

like image 152
Kenan Banks Avatar answered Nov 15 '22 19:11

Kenan Banks