On May 17, 2:41 am, Keith Hughitt <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've run into a strange issue with IE7/8, and was wondering if anyone
> might be able to help point out the cause.
>
> The problem arises when I have buttons which use self-closing tags
> (e.g. <button />)

I don't think this question is related to Prototype.js or even
javascript in general, it is an HTML question.  You will most likely
get a thorough answer at:

  news:comp.infosystems.www.authoring.html


> instead of separate closing tags. This is the case,
> for example, when the buttons are generated via prototypes Element
> constructor, or with Scriptaculous's Builder class. The result is that
> items following a self-closing button are not displayed.

If you are serving XHTML as XHTML and use <button ... /> for a button
with no content, you should get the same result as <button></button>
(i.e. a button with no content).

However, if you are serving XHTML as HTML (and you must be for IE at
least as it doesn't know what XHTML is) then you are serving invalid
HTML.  Whatever happens after that is the result of error correction
and there is no specification for that.

The browser sees the / at the end of the opening tag and ignores it.
It then goes looking for the closing tag and, on seeing content that
looks like markup that doesn't belong inside the button, ignores that
too.  Eventually some condition is met and it starts rendering again.


>
> An example of this is:
>
> <!DOCTYPE html
> PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

For documents served from a web server, the DOCTYPE in the markup is
irrelevant.  Some browsers will use it if content is loaded from a
local file, and validators complain if you don't have one.  But
otherwise it serves no purpose (that is not encouragement to drop the
DOCTYPE, it should alwasy be present, it's just a fact of life).

> <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> <head>
> <title>IE Button Closing Tags</title>
>
> </head>
> <body>
> <!-- ie7 doesn't seem to like it when you use <button /> instead of
> <button></button> -->
> <button style="width:20px; height:10px;" type="button"></
> button><p>some text</p>
> <button style="width:20px; height:10px;" type="button" /><p>more text?
> </p>
>
> </body>
> </html>
>
> Does anyone know what the cause of this is?

Invalid HTML.

> Firefox, etc. has no
> problems with the later form.

I beg to differ, for me Firefox does not show the content of the
second paragraph.

Anyway, that a particular browser might show what you think is correct
isn't really relevant.  You are attempting to get consistent behaviour
from invalid markup.  You may do that for a limited number of browsers
for a specific case, but you will certainly not do it for browsers in
general, even the few supported by the libraries you are trying to
use.


--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to