谁开始“为XML做好准备 - 带有斜杠的代码br”? [英] Who started "get ready for XML -- code br with a trailing slash"?

查看:76
本文介绍了谁开始“为XML做好准备 - 带有斜杠的代码br”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断遇到人们,无论是在线还是在现实生活中,谁相信

来编码单个标签,例如< br>和< img>带尾随斜杠,< br />

和< img />被认为是最佳实践。当受到挑战时,他们会说每个人都将很快使用XML / XHTML。并说

他们正在准备通过这种方式编码。


编码这种方式会导致HTML 4 Transitional和

HTML 4严格的验证错误,所以它不能最好练习。


但更重要的是,XHTML并非即将到来。它在这里。如果

你正在使用它,那么就这样编码,如果没有,不是。


如果你问我,这完全是货物崇拜。


有谁知道这个想法从何而来?他们是在

大学教授吗?有些HTML专家告诉人们这是要走的路吗?

有些书,有些网站吗?缺乏逻辑让我感到冒犯。

I keep coming across people, online and in real life, who believe that
to code single tags like <br> and <img> with trailing slashes, <br />
and <img /> is considered "best practice" and when challenged, they
say that "everyone''s going to be using XML/XHTML soon" and say that
they''re "getting ready" by coding this way.

Coding this way causes validation errors in HTML 4 Transitional and
HTML 4 Strict, so it can''t be "best practice".

But more to the point, XHTML isn''t "coming one day". It''s here. If
you''re using it, code this way, if not, not.

It''s all rather cargo-cult if you ask me.

Does anyone know where this idea started? Are they teaching it in
universities? Did some HTML guru tell people this was the way to go?
Some book, some website? The lack of logic offends me.

推荐答案

Hostile17写道:
Hostile17 wrote:
我不断遇到人,网上和现实生活,谁相信
编码单个标签,如< br>和< img>带尾随斜杠,< br />
和< img />被认为是最佳实践。当受到挑战时,他们会说每个人都将很快使用XML / XHTML。并且说他们准备好了通过这种方式编码。
I keep coming across people, online and in real life, who believe that
to code single tags like <br> and <img> with trailing slashes, <br />
and <img /> is considered "best practice" and when challenged, they
say that "everyone''s going to be using XML/XHTML soon" and say that
they''re "getting ready" by coding this way.




我认为什么被认为是最佳实践。在尾随/之前用空格写空元素

,就像它在HTML

兼容性指南中所解释的那样。 < http://www.w3.org/TR/xhtml1/#guidelines>:


* * *

C.2。空元素

在尾随/和>之前包含一个空格空元素,例如< br

/> ;,< hr />和< img src =" karen.jpg" ALT ="卡伦" /取代。此外,对空元素使用

最小化标记语法,例如< br />,作为替代

语法< br>< / br> XML允许在许多现有的

用户代理中给出不确定的结果。

* * *


我的猜测是有人误解了" HTML"在标题中。这些

指南是为了与HTML *用户代理*兼容,而不是与

HTML *文档类型*。

Matthias



I think what is considered "best practice" is writing empty elements
with a space before the trailing /, like it''s explained in the "HTML
Compatibility Guidelines" <http://www.w3.org/TR/xhtml1/#guidelines>:

* * *
C.2. Empty Elements
Include a space before the trailing / and > of empty elements, e.g. <br
/>, <hr /> and <img src="karen.jpg" alt="Karen" />. Also, 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.
* * *

My guess is that somebody misunderstood the "HTML" in the title. These
guidelines are for compatibility with HTML *user agents*, not with the
HTML *document type*.
Matthias


2003年9月16日21:21:54 -0700, ho * ****** @bootfoot.com (Hostile17)

写道:
On 16 Sep 2003 21:21:54 -0700, ho*******@bigfoot.com (Hostile17)
wrote:
但更重要的是,XHTML并非即将到来天" ;.它在这里。如果您正在使用它,请以这种方式编码,如果不是,则不是。


XHTML今天不在这里,因为大多数浏览器都没有支持它,并且没有声称支持它,如果你相信今天XHTML是

然后< br />很好 - 它的标签汤就像其他的一样

XHTML用作text / html。

有谁知道这个想法的起源?他们是在大学教书吗?
But more to the point, XHTML isn''t "coming one day". It''s here. If
you''re using it, code this way, if not, not.
XHTML is not here today, in that the majority of browsers don''t
support it, and don''t claim to support it, if you believe XHTML is
here today then <br /> is fine - it''s tag-soup just like the rest of
XHTML served as text/html.
Does anyone know where this idea started? Are they teaching it in
universities?




XHTML布道者已经做了很多胡言乱语......


吉姆。

-

comp.lang.javascript常见问题 - http://jibbering.com/faq/



XHTML evangelists have done a lot of gibberish...

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/


Jim Ley写道:
Jim Ley wrote:
2003年9月16日21:21:54 -0700, ho ******* @ bigfoot.com (Hostile17)
写道:
On 16 Sep 2003 21:21:54 -0700, ho*******@bigfoot.com (Hostile17)
wrote:
但更重要的是,XHTML并非即将到来。它在这里。如果您正在使用它,请以这种方式编码,如果没有,不是。
But more to the point, XHTML isn''t "coming one day". It''s here. If
you''re using it, code this way, if not, not.



XHTML今天不在这里,因为大多数浏览器都不能<支持它,并且不要求支持它,如果您今天在这里相信XHTML,那么< br />很好 - 它的标签就像其余的
XHTML一样用作text / html。



XHTML is not here today, in that the majority of browsers don''t
support it, and don''t claim to support it, if you believe XHTML is
here today then <br /> is fine - it''s tag-soup just like the rest of
XHTML served as text/html.




XHTML如何作为text / html服务是不是更多或更少的标签汤比

非X-HTML?对我来说,只有一个语法上的区别,无论你喜欢(或不是x)你想要的b $ b风味应该在浏览器中做得很好。我发现

XHTML更容易解析(通过我的工具和我的大脑,如果你知道我的意思是什么),这就是我使用它的原因。 br />

我不需要知道创建文档树的doctype。在

HTML中,我需要知道每个元素的全部内容,例如:我不知道是否b $ b知道是否


< p> test< br> test< p> test


表示


p

|

- br

|

- p





p

|

- br

|

p


....换句话说,第二个p是下一个兄弟姐妹还是孩子/>
节点。没有DTD我不知道。

如果你写了


< p> test< br /> test< / p>< p>测试< / p>


如果不解析DTD就会很明显。所以我想某人

想出了添加< br />对于人类读者来说,HTML会产生一些感觉。好吧,只是一些解释。我猜

有人只是困惑。使用< br />它似乎很愚蠢在

非X-HTML中。即使浏览器只是不在乎。使用

验证工具不好。

无论如何。在许多网站上有一定的趋势假装XHTML1

有一些可访问性或其他奖励(如搜索引擎优化)

与HTML4相比,这当然只是传说。

说大多数浏览器不支持XHTML像你一样

然而似乎只是开始另一个传奇。并不是说你没有正确(XHTML作为XML应用程序等),但更多的是在大多数人都能理解的情况下。 (哦,我不能在大多数

浏览器中使用XHTML - 是的,你可以)。


-

Google Blogoscoped
http://blog.outer-court.com


这篇关于谁开始“为XML做好准备 - 带有斜杠的代码br”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆