HTML5枚举类型 [英] HTML5 enumerated types

查看:120
本文介绍了HTML5枚举类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请不要理解中的这些段落标准


指定属性时,如果其值为ASCII
不区分大小写,则为一个然后,
关键字的状态是属性所代表的状态。如果
属性值与给定关键字都不匹配,但属性
的默认值无效,则该属性表示
状态。否则,如果属性值与任何关键字
都不匹配,但是定义了缺失值默认状态,那么这是属性所代表的
状态。否则,没有默认值,
和无效值必须被忽略。

When the attribute is specified, if its value is an ASCII case-insensitive match for one of the given keywords then that keyword's state is the state that the attribute represents. If the attribute value matches none of the given keywords, but the attribute has an invalid value default, then the attribute represents that state. Otherwise, if the attribute value matches none of the keywords but there is a missing value default state defined, then that is the state represented by the attribute. Otherwise, there is no default, and invalid values must be ignored.

当未指定属性时,如果缺少值
默认状态定义,然后是
(缺失)属性表示的状态。否则,缺少属性意味着
没有表示状态。

When the attribute is not specified, if there is a missing value default state defined, then that is the state represented by the (missing) attribute. Otherwise, the absence of the attribute means that there is no state represented.

无效值有关默认缺失值默认字词。

任何人都可以举个例子或更好地解释一下吗?

Can anyone give me an example or explain better?

谢谢。

推荐答案

枚举属性可以定义为具有有效值列表:例如

An enumerated attribute can defined as having a list of valid values: e.g.


  • text

  • date

  • 地址

  • 电话

  • text
  • date
  • address
  • phone

还有两个默认值


  • 无效的默认值,例如手机

  • 缺失值默认值:例如文本

然后对于元素 foo 和属性 bar 如上所述:

Then for an element foo and attribute bar as above:

<foo bar="date">   => valid value, state is `date`
<foo bar="time">   => invalid value, state is the invalid default `phone`
<foo>              => missing value, state is the missing value default `text`

有时候,属性没有为其定义的无效默认值,但它默认定义了缺失值。在这种情况下:

Sometimes however, the attribute doesn't have an invalid default defined for it, but it does have a missing value default defined. In this case:

<foo bar="date">   => valid value, state is `date`
<foo bar="time">   => invalid value, state is the missing value default `text`
<foo>              => missing value, state is the missing value default `text`

有时该属性定义了无效的默认值它,但它没有默认定义的缺失值。在这种情况下:

Sometimes the attribute has an invalid default defined for it, but it doesn't have a missing value default defined. In this case:

<foo bar="date">   => valid value, state is `date`
<foo bar="time">   => invalid value, state is the invalid default `phone`
<foo>              => missing value, attribute has no state

有时该属性没有无效的默认值或者为其定义的缺失值默认值。在这种情况下:

And sometimes the attribute doesn't have either an invalid default or a missing value default defined for it. In this case:

<foo bar="date">   => valid value, state is `date`
<foo bar="time">   => invalid value, attribute has no state
<foo>              => missing value, attribute has no state

这篇关于HTML5枚举类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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