|
Posted by rf on 10/19/07 07:18
"Steve Swift" <Steve.J.Swift@gmail.com> wrote in message
news:471998b9$1@news.greennet.net...
>> It is like making a casserole really, anything goes eh?
>
> Precisely! And if, on occasions, you make a mistake (as my mother
> frequently did), and the result is tastier, that becomes your new recipe!
> http://www.swiftys.org.uk/wiz?106
> Perhaps next time I'll say "Add a soupηon of closing tags" :-)
>
> Remember, the only "standard" that I'm designing to (in my commercial
> activity, at least) is "Must work in IE6 and the current Firefox", so
> pragmatic design outweighs hypothetical stuff. So the <FORM> tag goes (a)
> where it works, and (b) where it causes none of my target audience to get
> weird effects, then I move on to something else.
You may wish to look at this:
http://barefile.com.au/dumpdom.html
This merely dumps (rather crudey) the DOM for the page.
The page is basically what you presented earlier, a couple of invalid tables
like:
<table>
<form action='dumpdom.html' method=get>
<tr><td>
<input type=text name=textfield>
<input type=submit name=subbutton>
</td></tr>
</form>
</table>
Use IE first. You will see that the (generated) <tbody> is a child of the
<form> and so the input elements are also decendents of the form. So
everything "works as expected". IE has ignored your error.
However now use FF. You will see that the <tbody> is now not a child of the
form. In fact the form has been "closed" before the <tbody>. The input
elements are no longer decendants of the <form>. FF has "corrected" your
error. The fact that the "forms" are actually submitted is quite strange. FF
must be internally keeping some alternate representation of the page to
cater for just this error. It is, after all, a quite common one. FWIW opera
and Windows safari do the same thing. Hmmm, I wonder what happens if one
converts to and serves up the above as XHTML :-)
> As far as Microsoft and the Firefox developers are concerned, I should
> imagine one of their highest priorities is "Mustn't screw up legacy pages
> with new releases otherwise the customers will switch to the competition"
> so I'm happy they're looking after me.
With that approach you will eventually get bitten in the arse by something
you coded so sloppily years ago. In fact you have already been bitten, you
just don't know it yet.
See that "count" button? It finds the first form and alerts the number of
children that form element has. IE reports this to be 1. Yep, that <tbody>.
You could construct some javascript to drill down from the form element and
find all the, say, input elements and do something to them, like perhaps
validate them. All OK when you test this with IE.
Now swap to FF. FF reports (correctly) that the form element has 0 (zero)
children. Your validation code will silently fail (having found zero input
elements) and you will be scratching your head for days trying to figure out
why, unless you had previously looked at my aforementioned page and really
knew what was happening in the DOM.
Bite Bite :-)
--
Richard.
[Back to original message]
|