I need a tool that acts like a browser, but instead of actually
rendering a page, it explains in English exactly what rules it's
interpreting. This would make it simple to see which rules are
applied, which are ignored, which are inherited or not, which are
superceded, etc. This would be a huge aid in debugging pages. (I
currently have a page that is included by another page - it's actually
a menu - but it's rendered differently depending on which other page
includes it. I'm utterly baffled as to why.)
The input could be any type of web page, including .html, .shtml and/
or others. It would interpret SSI of course, and maybe PHP, etc.
handling included files, as well as both external & inline css
styles. Like I mentioned above - it would act like a browser, but
specify in words what it would do instead of actually doing it. It
would need to have certain options, such as whether to render or not
to render (text, images), whether to render actual positions, or
simply output numbers as to where it would print (like XY coordinates,
as well as pixel positions, and/or other units potentially). Ideally
it would be interactive so you could shut off certain portions after
you had verified the problem wasn't in that portion of the code - or
perhaps simply set markers in the code as to which part of the code to
debug with this tool; or even give it 2 regular expressions to match
as the start and stop points. Note that it would still have to read
and interpret from the true beginning so as to set things up correctly
- start and stop would simply tell it where to start and stop
printing. In addition, I should be able to set a "dump point", where
all current values are printed out as well as how they were set.
Note, that this goes way beyond simple validation, and in fact really
has nothing to do with validation whatsoever - although in an ideal
world it could provide validation too, as an option.
Example Output:
Width set to 600px from <body>
background set to "sunrise.jpg" from <body>
border set to 1 using browser built-in rules.
Encountered <table class="webHead" width="780px" border="0"
cellspacing="0" cellpadding="0" font-size="100%" height="100%" >
background from <bodynot inherited. "sunrise.jpg" may still shine
through due to transparency.
Applying class="webHead" from file /public_html/Main/stuff.css
Applying class="webHead" from file /public_html/templates/
moreStuff.css
Setting webHead (moreStuff.css) width=900px
Setting webHead (stuff.css) border=1 pixel
Ignoring <table width="780px">, width is not inherited, class webHead
takes precedence
Setting <table border="0">
Setting <table cellspacing="0">
Ignoring <table cellpadding="0" Cellpadding is not supported by XX
browser version YY
Ignoring <table font-size="100%"font-size defaults to 10px based on
built-in browser rule.
Ignoring <table height="100%" Cellpadding is not supported by XX
browser version YY
Setting margin=0px using browser built-in rules.
Setting padding=0px using browser built-in rules
Encountered <tr>
Encountered <td>
Encountered [Hello World]
Rendering Hello World <<<<< This would be in actual font-family, size,
color, etc.
Encountered </td>
Encountered <dump point 1>
Border previously set to 0 at line 21 using <table border="0">
cellspacing previously set to 0 at line 21 using <table
cellspacing="0">
etc. etc.
Encountered </tr>
Encountered </table>
Border set to 1 using browser built-in rules
and so on and so forth until the entire file has been "rendered". The
above is (obviously) not a complete nor accurate example, but
hopefully it gets the point across. The tool would let you mimic the
behavior of different browsers as an option setting. Of interest to
me personally at the moment is IE 6 and 7. You could also choose an
option setting to either isolate, or integrate browsers, so that you
can compare the differences together, or simply focus on just one
browser. The above shows the output for one isolated browser. The
below shows integrated browsers.
Example:
Width set to 600px from <body>
background set to "sunrise.jpg" from <body>
border set to 1 using browser IE 6 built-in rules.
border set to 0 using browser IE 7 built-in rules.
border not set using browser firefox 1.0 built-in rules.
border set to 1 using Netscape 8 built-in rules.
etc.
Yet another example:
The following page is an official specification as you probably know:
http://www.w3.org/TR/REC-CSS2/fonts.html
It includes the following statement:
A visual user agent must address the following issues before actually
rendering a character:
Is there, directly or by inheritance, a font specified for this
character?
Does the user agent have this font available?
If so, what glyph(s) does this character or sequence of characters map
to?
If not, what should be done? Should a different font be substituted?
Can the font be synthesized? Can it be retrieved from the Web?
I would like to see the tool answer these (and other similar)
questions in respect to how the specific browser will treat these
questions. To demonstrate, the below responses to the questions would
be integrated into the above output in a natural way:
Is there, directly or by inheritance, a font specified for this
character?
The font "Arial" was specified by inheritance from class "foobar",
defined in file /path/to/file/foo.css
Does the user agent have this font available?
Since this browser does not have this font available in c:\windows
\fonts or c:\windows\system32\fonts...
If so, what glyph(s) does this character or sequence of characters map
to?
If not, what should be done? Should a different font be substituted?
Can the font be synthesized? Can it be retrieved from the Web?
the font 'Times Roman" was substituted from c:\windows\fonts
\timesr.fon
Essentially, it would give you a complete analysis of what it's doing,
where it's looking, why it made the decisions it made and what the
ultimate outcome ended up being.
I don't suppose there's anything like this out there is there?
Personally I don't care about the integrated version as of today, I
just need the isolated version, but I figure I might as well describe
the tool as completely as I can without writing a book. If there's
nothing out there, anyone care to take up the challenge? In my
opinion, this tool would be an enormous boon to the community at
large, and would probably help browser developers clean up their
browsers as well.
Thank you