HTML5兼容 - 类属性中的尾随空格 [英] HTML5 Compliant - Trailing Space in Class Attribute

查看:149
本文介绍了HTML5兼容 - 类属性中的尾随空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道技术上HTML5是一个'生活规范',但我想知道它是否符合类名中的尾随空格。我在规范中没有看到任何对此场景的引用,但我的一个队友说它无效。也许我错过了什么?

I know that technically HTML5 is a 'living spec' but I'm wondering if it's compliant to have trailing spaces inside of a class name. I didn't see any reference to this scenario in the spec, but one of my teammates said it was invalid. Maybe I missed something?

修剪那些空间(我在大型Java ecom应用程序中工作)会很痛苦,我想知道它是不是值得为SEO,验证或任何其他目的做。我觉得这不是......哈哈

It'd be a pain to trim those spaces (I'm working inside of a large Java ecom application) and I want to know if it's worth doing for SEO, validation or any other purpose. I get the feeling it's not... haha

推荐答案

正如我们在下面的链接中看到的,对什么没有限制开发人员可以在class属性中使用。

As we can see in the link below, there is no restriction on what the developer can use in the class attribute.

http://www.w3.org/html/wg/drafts/html/master/dom.html#classes

事实上,在说出类是什么以及它们被用于拆分空间后,作者说:

In fact, after saying what the classes are and that they're used spliting in the spaces, the author(s) says:


作者可以在
类属性中使用的令牌没有其他限制,但鼓励作者使用
描述内容性质的值,而不是描述$ b的值$ b所需的内容呈现。

There are no additional restrictions on the tokens authors can use in the class attribute, but authors are encouraged to use values that describe the nature of the content, rather than values that describe the desired presentation of the content.

我们这里的同事经过测试并成功通过了W3C验证,所以无法猜测为什么你的朋友认为它无效。

Our colleagues here have tested and it successfully passes W3C validation, so I can't guess why your friend thought it was invalid.

这篇关于HTML5兼容 - 类属性中的尾随空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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