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 />) 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. 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"> <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? Firefox, etc. has no problems with the later form. I could work-around the problem if I could tell Builder to using a separate closing tag, but this doens''t seem to work, even when I write out the closing tag explicitly with Builder.build(). Anyone have any ideas? Any help would be greatly appreciated. Thanks, Keith --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Try this and you''ll see where "more text?" is going (right or wrong)... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>IE Button Closing Tags</title> </head> <body> <button style="width:200px; height:100px;" type="button"></ button><p>some text</p> <button style="width:200px; height:100px;" type="button" /><p>more text?</p> </body> </html> If you''re not putting any content between the start and end tags why not just use <input type="button">? BTW, FF3 shows the same behavior for me. On May 16, 11:41 am, Keith Hughitt <keith.hugh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 />) 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. > > 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"> > <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? Firefox, etc. has no > problems with the later form. I could work-around the problem if I > could tell Builder to using a separate closing tag, but this doens''t > seem to work, even when I write out the closing tag explicitly with > Builder.build(). > > Anyone have any ideas? Any help would be greatly appreciated. > > Thanks, > Keith--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the suggestion darrin. The behavior seems pretty strange, but the fact that FF3 is switching to this behavior suggests that it may be the proper implementation according to the spec. In any case I have been able to work around the problem by inserting an empty string ("") during DOM-Node creation, e.g: Builder.node(''button'', ""); Using input also works. Thanks :) Keith On May 16, 4:43 pm, darrin <darrin.ho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try this and you''ll see where "more text?" is going (right or > wrong)... > > <!DOCTYPE html > PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > <head> > <title>IE Button Closing Tags</title> > > </head> > <body> > <button style="width:200px; height:100px;" type="button"></ > button><p>some text</p> > <button style="width:200px; height:100px;" type="button" /><p>more > text?</p> > </body> > </html> > > If you''re not putting any content between the start and end tags why > not just use <input type="button">? > > BTW, FF3 shows the same behavior for me. > > On May 16, 11:41 am, Keith Hughitt <keith.hugh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 />) 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. > > > 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"> > > <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? Firefox, etc. has no > > problems with the later form. I could work-around the problem if I > > could tell Builder to using a separate closing tag, but this doens''t > > seem to work, even when I write out the closing tag explicitly with > > Builder.build(). > > > Anyone have any ideas? Any help would be greatly appreciated. > > > Thanks, > > Keith--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On May 17, 2:41 am, Keith Hughitt <keith.hugh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 />) 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. > > 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"> > <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? Firefox, etc. has no > problems with the later form. I could work-around the problem if I > could tell Builder to using a separate closing tag, but this doens''t > seem to work, even when I write out the closing tag explicitly with > Builder.build(). > > Anyone have any ideas? Any help would be greatly appreciated. > > Thanks, > Keith--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On May 17, 2:41 am, Keith Hughitt <keith.hugh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Rob, Thanks for the response, and suggestions. A few comments:> I don''t think this question is related to Prototype.js or even > javascript in general, it is an HTML question.You are right that this is not a direct Prototype question, and I probably should have asked somewhere else first, however it is relevant to Prototype users since the default Button dom-nodes produced by Prototype/Scriptaculous are of the self-closing tag form.> 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.Does IE not understand XHTML Doctypes? I have read before (http:// msdn.microsoft.com/en-us/library/ms535242.aspx, etc) that at least for newer versions of IE (possibly even as early as IE6), they are able to understand XHTML doctypes, and from my personal experience, it can make a large difference.> 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).http://developer.mozilla.org/en/docs/Mozilla%27s_DOCTYPE_sniffing and http://developer.mozilla.org/en/docs/Mozilla_Web_Developer_FAQ#What_are_the_Quirks_mode_and_the_Standards_mode.3F Take care, Keith> > > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 19.5.2008, at 17.47, Keith Hughitt wrote:> > Hi Rob, > > Thanks for the response, and suggestions. A few comments: > >> I don''t think this question is related to Prototype.js or even >> javascript in general, it is an HTML question. > > You are right that this is not a direct Prototype question, and I > probably should have asked somewhere else first, however > it is relevant to Prototype users since the default Button dom-nodes > produced by Prototype/Scriptaculous are of the self-closing > tag form. > >> 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. > > Does IE not understand XHTML Doctypes? I have read before (http:// > msdn.microsoft.com/en-us/library/ms535242.aspx, etc) > that at least for newer versions of IE (possibly even as early as > IE6), they are able to understand XHTML doctypes, and from > my personal experience, it can make a large difference.IE 6 and 7 don''t understand the application/xhtml-xml content type and thus pretty much everything is by default served as text/html, which means that if you''re using an xhtml doctype, you''re actually serving invalid html. This has been a source of an ongoing debate for years now: http://www.autisticcuckoo.net/archive.php?id=2005/01/30/no-extremes Like said before, the Content-Type header is what determines the content type, not the DOCTYPE declaration in the file. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi