Microsoft Windows Vista Community Forums - Vistaheads
Recommended Download



Welcome to the Microsoft Windows Vista Community Forums - Vistaheads, YOUR Largest Resource for Windows Vista related information.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so , join our community today!

If you have any problems with the registration process or your account login, please contact us.

Driver Scanner

?? IE 8 Mis-Handles <br> Element ??

microsoft.public.internetexplorer.general






Speedup My PC
Reply
  #1 (permalink)  
Old 08-18-2009
Tom Baxter
 

Posts: n/a
?? IE 8 Mis-Handles <br> Element ??
Hello all,

I have a situation where I'm using XHTML 1.1 with IE 8. IE 8 does not render
the <br> element correctly (although Firefox does). The problem is that IE 8
produces *two* line breaks when it should produce only one. The document
validates as valid XHTMML 1.1, according to w3.

The complete document is below.

Does anyone have a comment on this? I'm about 99% sure IE 8 is behaving
incorrectly. Thanks.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Test</title>
</head>

<body>
<p>Hello<br></br>World!</p> <!-- This should produce one line break, not
two -->
</body>
</html>

--
Tom Baxter
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-18-2009
Donald Anadell
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??

"Tom Baxter" <tlbaxter99@newsgroup.nospam> wrote in message
news:EEFA2BAB-CE79-4E25-B056-3BB9D8B6541B@microsoft.com...
> Hello all,
>
> I have a situation where I'm using XHTML 1.1 with IE 8. IE 8 does not
> render
> the <br> element correctly (although Firefox does). The problem is that IE
> 8
> produces *two* line breaks when it should produce only one. The document
> validates as valid XHTMML 1.1, according to w3.
>
> The complete document is below.
>
> Does anyone have a comment on this? I'm about 99% sure IE 8 is behaving
> incorrectly. Thanks.


Try changing the closing tag for the <Break> to look like this "<br />",
instead of "</br>".

http://www.w3schools.com/TAGS/tag_br.asp

Good luck,

Donald Anadell


>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> <head>
> <title>Test</title>
> </head>
>
> <body>
> <p>Hello<br></br>World!</p> <!-- This should produce one line break,
> not
> two -->
> </body>
> </html>
>
> --
> Tom Baxter



Reply With Quote
  #3 (permalink)  
Old 08-18-2009
Tom Baxter
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??

"Donald Anadell" wrote:

>
> "Tom Baxter" <tlbaxter99@newsgroup.nospam> wrote in message
> news:EEFA2BAB-CE79-4E25-B056-3BB9D8B6541B@microsoft.com...
> Try changing the closing tag for the <Break> to look like this "<br />",
> instead of "</br>".
>


Yes, of course I could do that but that's not the point. The point I am
making is that <br></br> should equivalent to <br/> and that while IE 8
handle <br/> as one line break it treats <br></br> as two.

I was not asking how to get one line break.


--
Tom Baxter

Reply With Quote
  #4 (permalink)  
Old 08-18-2009
PA Bear [MS MVP]
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??
IE Developer Center
http://msdn.microsoft.com/en-us/ie/default.aspx

Learn IE8
http://msdn.microsoft.com/en-us/ie/aa740473.aspx

HTML and DHTML Overviews and Tutorials
http://msdn.microsoft.com/en-us/library/ms537623.aspx and

Cascading Style Sheets (CSS)
http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

Or you could post here instead:

MSDN IE Development Forums
http://social.msdn.microsoft.com/for...iedevelopment/


Tom Baxter wrote:
> Hello all,
>
> I have a situation where I'm using XHTML 1.1 with IE 8. IE 8 does not
> render
> the <br> element correctly (although Firefox does). The problem is that IE
> 8
> produces *two* line breaks when it should produce only one. The document
> validates as valid XHTMML 1.1, according to w3.
>
> The complete document is below.
>
> Does anyone have a comment on this? I'm about 99% sure IE 8 is behaving
> incorrectly. Thanks.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> <head>
> <title>Test</title>
> </head>
>
> <body>
> <p>Hello<br></br>World!</p> <!-- This should produce one line break,
> not
> two -->
> </body>
> </html>


Reply With Quote
  #5 (permalink)  
Old 08-18-2009
VanguardLH
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??
Tom Baxter wrote:

> "Donald Anadell" wrote:
>>
>> "Tom Baxter" <tlbaxter99@newsgroup.nospam> wrote in message
>> news:EEFA2BAB-CE79-4E25-B056-3BB9D8B6541B@microsoft.com...
>> Try changing the closing tag for the <Break> to look like this "<br />",
>> instead of "</br>".

>
> Yes, of course I could do that but that's not the point. The point I am
> making is that <br></br> should equivalent to <br/> and that while IE 8
> handle <br/> as one line break it treats <br></br> as two.
>
> I was not asking how to get one line break.


Only if you expect the web browser to handle *badly* coded HTML. Some
do and why they promote badly coded web sites. Don't rely in the slop
in one web browser to exist in another. There is no </BR> tag. BR
doesn't have a span or content over which it applies its effect. It is
a singleton tag. That means it doesn't get a matching closing tag. It
must be in the self-closing form, and those have the slash at the *end*
of the tag attributes, not at the start (because you aren't closing a
prior instance of that same tag; that is, there is no content to the
singleton tag). The self-closing singleton tags are:

<area />
<base />
<basefont />
<br />
<hr />
<input />
<img />
<link />
<meta />
(The delimiting space character is no longer required.)

However, you aren't using XHTML, anyway. Self-closing tags aren't valid
(and will be ignored for their implied closure) when rendering the
document as HTML. So <br/> is just <br> in HTML (the slash gets ignored
as an invalid attribute. What you have is HTML with XHTML DOCTYPE.
DOCTYPE does not determine how document is interpreted. MIME type does.

http://webkit.org/blog/68/understand...xml-and-xhtml/

Read the section titled "What determines if my document is HTML or
XHTML?" part of which is:

In fact, the vast majority of supposedly XHTML documents on the
internet are served as text/html. Which means they are not XHTML at
all, but actually invalid HTML that¢s getting by on the error handling
of HTML parsers. All those 'Valid XHTML 1.0' links on the web are
really saying 'Invalid HTML 4.01'!

This article also mentions:

Validate your content as HTML, not as XHTML. One handy way is using a
validation service, such as the W3C Validator. (But beware, the
validator looks at your doctype instead of the MIME type, unlike
browsers.)

I don't see you declaring the MIME type as application/xhtml+xml or
text/xml. The above article was written in 2006. IE7 didn't handle
XHTML (and IE8 won't in its IE7 quirks mode).

http://blogs.msdn.com/ie/archive/2005/09/15/467901.aspx
(this discusses lack of XHTML support in IE7).

From Googling around, it appears IE8 still does not support XHTML. See
http://en.wikipedia.org/wiki/Internet_Explorer which says:

Internet Explorer, using the Trident layout engine ...
does not support XHTML, though it can render XHTML documents authored
with HTML compatibility principles and served with a text/html
MIME-type.

Only the text/html MIME type is supported contrary to all other modern
web browsers that support the xml+xhtml or xml media types. That means
it will render those pages as HTML. So your </br> tag is getting
interpreted as <br>. Microsoft didn't want to hack their Trident engine
to add XHTML support and end up with a bunch more quirks, so they're
writing it from scratch. Anyone's guess now if XHTML will be supported
in IE9.

So it's not a bug. It's a continued lack of XHTML support (assuming you
had actually specified an XML/XHTML media type in your document
declaration, which you didn't).
Reply With Quote
  #6 (permalink)  
Old 08-18-2009
Tom Baxter
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??
> Tom Baxter wrote:
>
>
> Only if you expect the web browser to handle *badly* coded HTML. Some
> do and why they promote badly coded web sites. Don't rely in the slop
> in one web browser to exist in another. There is no </BR> tag.
> That means it doesn't get a matching closing tag.


Thank you for the response.

Keep in mind I'm referring to IE 8.

The <br/> notation you mentioned is, as you probably know, just an XML
shortcut for <br></br> and XHTML is an application of XML.

If you tell me "there is no </br>" I'm pretty sure it's not right. ANY XML
tag that has empty content (e.g., br, hr) can be abbreviated as <xxx/>. In
other words, <xxx></xxx> is equivalent to <xxx/>. There is no difference.

As far as my document not being valid XHTML, that's hard to swallow since it
validates as correct XHTML by validator.w3.org as well as Firefox's HTML Tidy
plug in. In addition, both Firefox and Safari both render it with a single
line break, as I would expect.

Now, it may be the case that my document is not being served with the
correct MIME type and therefore IE is rendering it incorrectly. I'm not sure
what MIME type is required in order to get IE to render it correctly and I'm
not sure that the MIME type overrides the DOCTYPE.

Perhaps application/xhtml+xml is what I need.

The point I'm trying to make in my original post is that <br></br> should
render as a single line break since it is equivalent to <br/>.

Thanks again for the response.


> However, you aren't using XHTML, anyway. Self-closing tags aren't valid
> (and will be ignored for their implied closure) when rendering the
> document as HTML. So <br/> is just <br> in HTML (the slash gets ignored
> as an invalid attribute. What you have is HTML with XHTML DOCTYPE.
> DOCTYPE does not determine how document is interpreted. MIME type does.
>
> http://webkit.org/blog/68/understand...xml-and-xhtml/
>
> Read the section titled "What determines if my document is HTML or
> XHTML?" part of which is:
>
> In fact, the vast majority of supposedly XHTML documents on the
> internet are served as text/html. Which means they are not XHTML at
> all, but actually invalid HTML thatʼs getting by on the error handling
> of HTML parsers. All those 'Valid XHTML 1.0' links on the web are
> really saying 'Invalid HTML 4.01'!
>
> This article also mentions:
>
> Validate your content as HTML, not as XHTML. One handy way is using a
> validation service, such as the W3C Validator. (But beware, the
> validator looks at your doctype instead of the MIME type, unlike
> browsers.)
>
> I don't see you declaring the MIME type as application/xhtml+xml or
> text/xml. The above article was written in 2006. IE7 didn't handle
> XHTML (and IE8 won't in its IE7 quirks mode).
>
> http://blogs.msdn.com/ie/archive/2005/09/15/467901.aspx
> (this discusses lack of XHTML support in IE7).
>
> From Googling around, it appears IE8 still does not support XHTML. See
> http://en.wikipedia.org/wiki/Internet_Explorer which says:
>
> Internet Explorer, using the Trident layout engine ...
> does not support XHTML, though it can render XHTML documents authored
> with HTML compatibility principles and served with a text/html
> MIME-type.
>
> Only the text/html MIME type is supported contrary to all other modern
> web browsers that support the xml+xhtml or xml media types. That means
> it will render those pages as HTML. So your </br> tag is getting
> interpreted as <br>. Microsoft didn't want to hack their Trident engine
> to add XHTML support and end up with a bunch more quirks, so they're
> writing it from scratch. Anyone's guess now if XHTML will be supported
> in IE9.
>
> So it's not a bug. It's a continued lack of XHTML support (assuming you
> had actually specified an XML/XHTML media type in your document
> declaration, which you didn't).
>

Reply With Quote
  #7 (permalink)  
Old 08-18-2009
C A Upsdell
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??
Tom Baxter wrote:
>> Tom Baxter wrote:
>>
>>
>> Only if you expect the web browser to handle *badly* coded HTML. Some
>> do and why they promote badly coded web sites. Don't rely in the slop
>> in one web browser to exist in another. There is no </BR> tag.
>> That means it doesn't get a matching closing tag.

>
> The <br/> notation you mentioned is, as you probably know, just an XML
> shortcut for <br></br> and XHTML is an application of XML.
>
> If you tell me "there is no </br>" I'm pretty sure it's not right. ANY XML
> tag that has empty content (e.g., br, hr) can be abbreviated as <xxx/>. In
> other words, <xxx></xxx> is equivalent to <xxx/>. There is no difference.


The XHTML 1.0 spec says (Appendix C.2) "... use the minimized tag syntax
for empty elements, e.g. <br />, as the alternative syntax <br></br>
allowed by XML gives uncertain results in many existing user agents."
Reply With Quote
  #8 (permalink)  
Old 08-18-2009
Tom Baxter
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??

"C A Upsdell" <""cupsdell"@nospam@upsdel" wrote:

> Tom Baxter wrote:
> >> Tom Baxter wrote:
> >>
> >>
> >> Only if you expect the web browser to handle *badly* coded HTML. Some
> >> do and why they promote badly coded web sites. Don't rely in the slop
> >> in one web browser to exist in another. There is no </BR> tag.
> >> That means it doesn't get a matching closing tag.

> >
> > The <br/> notation you mentioned is, as you probably know, just an XML
> > shortcut for <br></br> and XHTML is an application of XML.
> >
> > If you tell me "there is no </br>" I'm pretty sure it's not right. ANY XML
> > tag that has empty content (e.g., br, hr) can be abbreviated as <xxx/>. In
> > other words, <xxx></xxx> is equivalent to <xxx/>. There is no difference.

>
> The XHTML 1.0 spec says (Appendix C.2) "... use the minimized tag syntax
> for empty elements, e.g. <br />, as the alternative syntax <br></br>
> allowed by XML gives uncertain results in many existing user agents."



Ah ha!! Just as I expected! IE 8 renders it incorrectly!!!

--
Tom Baxter
Reply With Quote
  #9 (permalink)  
Old 08-18-2009
Luuk
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??
Tom Baxter schreef:
> Hello all,
>
> I have a situation where I'm using XHTML 1.1 with IE 8. IE 8 does not render
> the <br> element correctly (although Firefox does). The problem is that IE 8
> produces *two* line breaks when it should produce only one. The document
> validates as valid XHTMML 1.1, according to w3.
>
> The complete document is below.
>
> Does anyone have a comment on this? I'm about 99% sure IE 8 is behaving
> incorrectly. Thanks.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> <head>
> <title>Test</title>
> </head>
>
> <body>
> <p>Hello<br></br>World!</p> <!-- This should produce one line break, not
> two -->
> </body>
> </html>
>



i tried, and this piece of unusefull HTML:
<h2>1</h2>
1<br>2
<h2>2</h2>
1<br />2
<h2>3</h2>
1<br></br>2
<h2>4</h2>

when viewed in de developertools of IE8 (F12/view DOM source)
<H2>
1
</H2>
1<BR />2
<H2>
2
</H2>
1<BR />2
<H2>
3
</H2>
1<BR /><BR />2
<H2>
4
</H2>


This leads /me to the conclusion that the tag '</BR>' is interpreted as
a normal '<BR>', which might be correct, because there is no '</BR>'
definition in HTML

HTML is not the same as XML.... (it should be, but it is not!)



--
Luuk
Reply With Quote
  #10 (permalink)  
Old 08-18-2009
C A Upsdell
 

Posts: n/a
Re: ?? IE 8 Mis-Handles <br> Element ??
Tom Baxter wrote:
> "C A Upsdell" <""cupsdell"@nospam@upsdel" wrote:
>
>>>> Only if you expect the web browser to handle *badly* coded HTML. Some
>>>> do and why they promote badly coded web sites. Don't rely in the slop
>>>> in one web browser to exist in another. There is no </BR> tag.
>>>> That means it doesn't get a matching closing tag.
>>> The <br/> notation you mentioned is, as you probably know, just an XML
>>> shortcut for <br></br> and XHTML is an application of XML.
>>>
>>> If you tell me "there is no </br>" I'm pretty sure it's not right. ANY XML
>>> tag that has empty content (e.g., br, hr) can be abbreviated as <xxx/>. In
>>> other words, <xxx></xxx> is equivalent to <xxx/>. There is no difference.

>> The XHTML 1.0 spec says (Appendix C.2) "... use the minimized tag syntax
>> for empty elements, e.g. <br />, as the alternative syntax <br></br>
>> allowed by XML gives uncertain results in many existing user agents."

>
> Ah ha!! Just as I expected! IE 8 renders it incorrectly!!!


Not really. IE does not specifically support XHTML: you can't say that
IE does something incorrectly if that something is unsupported.

People who create XHTML pages depend on IE treating the pages as HTML,
and rendering the pages as one might expect. This means paying close
attention to Appendix C of the XHTML spec ... including C.2.


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
?? IE 8 Mis-handles the <br> Element ?? Tom Baxter microsoft.public.internetexplorer.general 0 08-16-2009 21:29
Handles Fred B. microsoft.public.windows.vista.general 2 05-07-2008 12:45
Drag handles are too small? foxtrotwhiskey microsoft.public.windows.vista.mail 1 12-22-2007 19:28
Small Handles? foxtrotwhiskey microsoft.public.windows.vista.mail 1 12-22-2007 17:33
Where are my window handles? Mark Randall microsoft.public.windows.vista.general 6 09-08-2007 01:30




All times are GMT +1. The time now is 06:08.




Driver Scanner - Free Scan Now

Vistaheads.com is part of the Heads Network. See also XPHeads.com , Win7Heads.com and Win8Heads.com.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.0 RC 2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120