为什么我的文档没有通过XHTML 1.1 STRICT验证? [英] Why isn't my document validating as XHTML 1.1 STRICT?

查看:133
本文介绍了为什么我的文档没有通过XHTML 1.1 STRICT验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然不赞成使用target ="_ blank",但为什么W3C验证程序没有给出有关此错误的信息?您可以在验证器中粘贴并检查该代码:

While target="_blank" is deprecated, why is the W3C validator not giving an error about this ? You can paste and check this code int the validator:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<p>
<a href="http://www.stackoverflow.com" title="New window will open" target="_blank">Link opens in new window</a>
</p>
</body>
</html>

这是否意味着XHTML 1.1支持target ="_ blank",但严格的XHTML 1.0不支持?还是W3C验证程序中的错误?

Does it mean that XHTML 1.1 supports target="_blank", but XHTML 1.0 strict does not? Or is it a bug in the W3C validator?

推荐答案

您正在被验证为XHTML 过渡版,而不是严格.如果您手动将文档类型重写为XHTML 1.0 Strict,则会出现此错误:

You are being validated as XHTML Transitional rather than Strict. If you manually override the doctype to XHTML 1.0 Strict you get this error:

错误行11,第76栏:属性目标"存在,但不能用于此元素.

Error Line 11, Column 76: Attribute "target" exists, but can not be used for this element.

…om"; title =将打开新窗口" target =''_ blank">链接会在新窗口中打开

如果您要严格要求,请使用此文档类型:

Use this doctype if you want to be strict:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

过渡模式仍然允许某些不赞成使用的元素和属性,我想可以帮助人们 transition 逐步实现更严格的标记.

The transitional schemas still allow certain deprecated elements and attributes, I guess to help people transition in steps towards a stricter markup.

好,所以原始代码是XHTML 1.1,其中只有一个单一版本(没有严格/过渡),并且根据

OK, so the original code was XHTML 1.1 of which there is just one single version (no Strict/Transitional), and according this FAQ the target attribute is indeed not allowed. So I guess this must be a bug in the validator.

这篇关于为什么我的文档没有通过XHTML 1.1 STRICT验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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