views:

570

answers:

5

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.

+2  A: 

ok - serious answer.

Judging by the comments on the sites that I've followed from that link, I think that you and I know that there probably isn't. There are a lot of smart blokes and blokettes on those threads, and they all seam to point towards the "no, this is all clever $4!# that wont help us in understanding rendering.

However, I think that what your question might want to emphasis is that rendering at a browser level is very interesting.

Let me just throw this one out there. Do you think that putting body { overflow: scroll; } as a default might speed us up just a little???

Steve Perks
Yes i knew the video bit was something that took time to create by a professional but it helped in creating a discussion of what tools we should be using to create the best for the web in the shortest time, and to help us make the best better as time goes by.
Ólafur Waage
Regarding your question on overflow: scroll, i just dont know, currently we are talking about millisecond differences, it would be interesting to see in a very html/css heavy page (ie a picture made out of div tags and background color), if rendering time is faster.
Ólafur Waage
Added to that, <code>{ overflow: scroll;}</code> costs me bandwidth, and my users just aren't worth it. I've already spent more time thinking about it than they're worth... :-)
Steve Perks
^ wow. Here's hoping I'm never one of your users.
Andy Ford
A: 

The most information I can find on this is this link that I found in a comment at the bottom of the link you posted:

http://dougt.wordpress.com/2008/05/24/what-is-a-reflow/

leeand00
There are two great links about reflowing in the link i posted, but the css in that page doesnt highlight links so i just shows as text: https://wiki.mozilla.org/Gecko:Reflow_Refactoring and https://wiki.mozilla.org/Gecko:Table_reflow_optimization
Ólafur Waage
+12  A: 

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.

Triptych
Well worded Trip. This is a very interesting subject (just looking at the number of times it's been tagged favorite), but I think the question isn't as strong as the number of questions it actually raises. @Ólafur can you expand the question? I'd like to see this one get a bit more mileage.
Steve Perks
Great answer. I think though, that you mean HTML is declarative, not imperative.
guns
A: 

Personally, I feel as long as your HTML validates to W3C spec, isn't that all that matters? One should develop their HTML to spec and let browser companies worry about their bugs (which are pretty rare these days) than to focus on old browser mistakes of the past.

HTML Validator plugin for Firefox (aka Tidy) is all any web developer needs to see if their markup is correct, what's wrong, and where it's wrong.

Even if you could do true debugging, each browser parses HTML it's own way, so even if you could step through Firefox to see how a rendering bug occurs, that won't help you with IE or Safari/Chrome at all because they execute parsing in their own manner. This isn't like PHP, .NET or Java where the parsing of the code is the same for everybody, debugging makes sense there.

TravisO
"...as long as your HTML validates to W3C spec, isn't that all that matters? One should develop their HTML to spec and let browser companies worry about their bugs(which are pretty rare these days) than to focus on old browser mistakes of the past."You sir, aren't doing webdesing with that answer.
Malfist
A: 

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

You could probably step through the page rendering process by running Firefox under gdb, or modify an open-source browser to have a "step" button, but I really doubt this will achieve anything useful.

CSS isn't that complicated, everything is basically a box, with a width/height/padding/margin.. The problem with web-development (CSS particularly) is every browser implements rendering slightly differently (some more differently than others)..

If you want to know the render-order to speed your page load up, I'd say you're going about this the wrong way.. The browser rendering the page probably accounts for maybe 5% of the load time, the rest is page-generation time and network latency.

You could possibly shave 2ms of your page load by reordering some tags and using a different CSS positioning method.. or you could reduce the page-generation time by 200ms by caching, and half the network latency by setting up a second web-server nearer your users.. Compressing your logo better, or minifying your javascript would most likely improve load-time (universally, across all browsers!)

Basically, if you're concerned about load time, there are much better places to start. If you're concerned about how the page is being rendered, Firebug(-Lite) and http://browsershots.org (or a virtual machine or two) are all you need!

dbr
I agree with your speed statement but what I am talking about are things like the double loading that happens in the video's on all sites but the google one. There are probably things we are doing that we all think are fine but are executed in such a way that it actually hurts more that it's needed (even though it's fast) And can be fixed with a small change (in a W3C standard way)So without a debugger, we are left without a clue. Coding away like no tomorrow.
Ólafur Waage
That's kind of my point - I doubt the double-loading thing is an issue, in anyway. Loading wikipedia, the page-rendering-time is basically instant (but on larger pages, you do see the content "slowly" appear, as it's loaded over the network). I think your reaction to the reflow videos is web-dev's hypochondria!
dbr
Basically my point is - network latency is still the bottle-neck, and probably always will be.. There's really no point concerning yourself with the "double-loading" in Geckos engine, especially not until all browsers render basic CSS the same!
dbr