Warning:
This wiki has been archived and is now read-only.
HTML5/obsolete
废弃的特性
废弃但符合规范的特性
此章节中列出的特性将会在规范检测中引起警告。
代码编写的作者不应该为img元素指定border属性。如果该属性出现,其值必须为"0",最好使用CSS方式替代。
代码编写的作者不应该为script元素指定language属性。如果该属性出现,其必须为一个匹配字符串"JavaScript"的ASCII-case-insensitive值,并且,它的type属性必须忽略或者指定为一个匹配字符串"text/javascript"的ASCII-case-insensitive值。该属性应该被完全地删除(它的值为"JavaScript"时,没有任何效果),或者使用type属性去替代它。
代码编写的作者不应该为a元素指定name属性。如果该属性出现,其值不能为空字符串,并且,不能与该元素的home-subtree中的其他任何IDs值相同,该元素自身的ID除外,如果有的话,也不能与该元素的home-subtree中的任何其他a元素的name属性值相同。如果该属性出现,且该元素已指定ID属性,则其属性值必须与它的ID相同。在此语言的早期版本中,该属性被故意设计成为在URLs中为片段检索指定可能的目标的一种途径。它应该被id属性进行取代。
对废弃但符合规范的特性进行警告
为了简化从HTML4过渡性文档到此规范中所定义语言的过度及停止一些仅仅在非常少的状况下才被允许的特性,标准检测需要对用户在文档中使用这些特性时进行警告。它们通常都是一些没有效果的过时的特性,并且它们仅被用来区分可能的错误(常规的标准错误)以及那些仅存的标签或不常用的令人沮丧的实践(这些警告)。
下面这些特性必须按照上面的描述进行分类:
- 在HTML中出现一个obsolete permitted DOCTYPE。
-
img元素出现了border属性,且它的值为字符串"0"。 -
script元素出现了language属性,如果它的值为一个匹配字符串"JavaScript"的ASCII-case-insensitive,并且,它没有指定type属性或者该属性被指定为一个匹配字符串"text/javascript"的ASCII-case-insensitive值。 -
a元素出现一个值不为空字符串的name属性
标准检测必须能够在页面中识别出没有违规错误且没有使用这些特性和没有违规错误但存在一些被废弃的特性。
非标准特性
以下列出的元素全部都是完全过时废弃的,它们不应该被使用:
acronym
使用abbr替代
bgsound
使用audio替代
dir
使用ul替代
noframes
可以使用iframe和css进行替代,或者通过在服务端include的方式将那些固定不变的部分合并在一起生成完整的页面。
isindex
使用一个显式的form和text field组合进行替代
listing
nextid
使用GUIDs进行替代
noembed
plaintext
使用"text/plain"的MIME type替代
rb
只需要将文本直接写在ruby元素中即可,rb元素完全可以丢掉
strike
如果该元素标记着一处编辑过的内容则使用del替代,否则,使用s替代
xmp
使用code替代,并且分别要将"<"转码为"<",将"&"转码为"&"
basefont
big
blink
center
font
multicol
nobr
spacer
tt
用其他适当的元素和CSS进行替代
在tt元素被用作标记键盘输入时,考虑使用kbd元素;如果是变量,考虑使用var元素;如果是计算机代码,考虑code元素;如果是计算输出,考虑samp元素。
类似的,如果big元素被用作表示一个标题,请考虑使用h1元素;如果它被用作标注重要的部分,考虑使用strong元素;如果它以高亮文本的方式用于表明引用的需要,考虑使用mark元素。
参见text-level semantics usage summary以获得更多建议示例。
以下的属性皆已废弃(虽然它们仍然是此语言中的一部分),请不要继续使用:
a元素的charset属性
link元素的charset属性
在链接到的源上使用HTTP Content-Type头来替代
a元素的coords属性
a元素的shape属性
a元素的methods属性
link的methods属性
使用HTTP OPTIONS特性进行替代
a元素的name属性(除非像在之前章节中提到的情形)
embed元素的name属性
img元素的name属性
option元素的name属性
使用id属性进行替代
a元素的rev属性
link元素的rev属性
使用rel属性替代,并且换上一个相对的措辞(如,用 rel="author" 替代 rev="made")
a元素的urn属性
link元素的urn属性
指定首选的持久标识,采用href属性替代
area的nohref属性
head元素的profile属性
当被用来声明文档中用到的meta术语时,它是不需要的,完全可以省略,可以去注册这些名字
当用来触发特别的user agent行为时,可以用link元素替代
html元素的version属性
不需要,完全可以省略
input元素的usemap属性
iframe元素的longdesc属性
img的longdesc属性
使用一个常规的a元素链接到描述部分,或者(为图片的情况下)使用image map提供一个链接到该图片的描述部分
img元素的lowsrc属性
使用一个压缩的JPEG图片(在src属性中指定)来替代使用两张不同的图片
link元素的target属性
不需要,完全可以省略
meta元素的scheme属性
每个范围只使用一个scheme,或者,将scheme声明作为值的一部分
object元素的archive属性
object元素的classid属性
object元素的code属性
object元素的codebase属性
object元素的codetype属性
使用data和type属性对plugins进行调用。可以用param元素将这些属性作为name进行设置
object元素的declare属性
完全地重复某个object元素,资源在每次都会被重
object元素的standby属性
优化链接的资源以使加载更快,或者,至少有所改善
param元素的type属性
param元素的valuetype属性
script元素的language属性(除非像在之前章节中提到的情形)
使用type属性替代
script元素的event属性
script元素的for属性
使用DOM Events机制注册事件监听。[DOMEVENTS]
table元素的datapagesize属性
不需要,完全可以省略
table元素的summary属性
从table章节中给定的techniques for describing tables方案中选用一种进行替代
在前面以简洁明了的方式使用文本,并在其后包含一些更详细的描述。可以使用title属性来包含那些详细的文本,这样在这些单元格中的内容可以变得简洁一点
datasrc属性,在以下元素上时:a, applet, button, div, frame, iframe, img, input, label, legend, marquee, object, option, select, span, table, textarea
datafld属性,在以下元素上时:a, applet, button, div, fieldset, frame, iframe, img, input, label, legend, marquee, object, param, select, span, textarea
dataformatas属性,在以下元素上时:button, div, input, label, legend, marquee, object, option, select, span, table
可使用script或类似XMLHttpRequest机制去实现动态页面。[XHR]
body元素的alink属性
body元素的bgcolor属性
body元素的link属性
body元素的marginbottom属性
body元素的marginheight属性
body元素的marginleft属性
body元素的marginright属性
body元素的margintop属性
body元素的marginwidth属性
body元素的text属性
body元素的vlink属性
br元素的clear属性
caption元素的align属性
col元素的align属性
col元素的char属性
col元素的charoff属性
col元素的valign属性
col元素的width属性
div元素的align属性
dl元素的compact属性
embed元素的align属性
embed元素的hspace属性
embed元素的vspace属性
hr元素的align属性
hr元素的color属性
hr元素的noshade属性
hr元素的size属性
hr元素的width属性
iframe元素的align属性
iframe元素的allowtransparency属性
iframe元素的frameborder属性
iframe元素的hspace属性
iframe元素的marginheight属性
iframe元素的marginwidth属性
iframe元素的scrolling属性
iframe元素的vspace属性
input元素的align属性
input元素的hspace属性
input元素的vspace属性
img元素的align属性
img元素的border属性(除非像之前章节中提到的情形)
img元素的hspace属性
img元素的vspace属性
legend元素的align属性
li元素的type属性
menu元素的compact属性
object元素的align属性
object元素的border属性
object元素的hspace属性
object元素的vspace属性
ol元素的compact属性
p元素的align属性
pre元素的width属性
table元素的align属性
table元素的bgcolor属性
table元素的cellpadding属性
table元素的cellspacing属性
table元素的frame属性
table元素的rules属性
table元素的width属性
tr元素的align属性
tr元素的bgcolor属性
tr元素的char属性
tr元素的charoff属性
tr元素的valign属性
ul元素的compact属性
ul元素的type属性
body,table,thead,tbody,tfoot,tr,td,th元素的background属性
全部使用CSS替代
table元素的border属性可以用于在一些CSS支持有限或根本不支持CSS的浏览环境中,提供基础样式以确保表格的清晰易读,比如一些基于文本的浏览器,所见即所得的编辑器,还有一些CSS被禁用或样式表丢失的情形等等。为此,可以在table元素上使用border属性,但其值只能为"1",其他任何值都被视为废弃的。如果想要调整表格的宽度等样式,可以使用CSS进行调整。
实施需求
applet元素
applet元素是Java特有的,它是embed元素的变体。applet元素现在已经被废弃,以便所有的扩展框架(如Java,.NET, Flash等等)能够以一致的方式进行处理。
当此元素仍然出现在HTML解析器(HTML parser)或XML解析器(XML parser)的未闭合元素栈(stack of open elements)中时;当此元素没有出现在Document中(in a Document)时;当此元素所在的文档还未完全激活(fully active);当此元素所在文档被创建时,该文档的浏览环境(browsing context)具有它的沙箱插件浏览环境标识(snadboxed plugins browsing context);当此元素所在的文档(Document)由一个sniffed type在导航(navigation)期间被确认为text/html-sandboxed的资源解析而来时;当此元素包含一个media element的前身时;当此元素包含一个没有处于正在呈现它的fallback content状态时的object元素的前身时;当Java语言的运行时插件(plugin)不可用时;当Java运行时插件存在,但它却被禁用时;此元素将呈现(represents)等同于它所要表达给用户的的内容。
否则,user agent应该实例化一个Java语言的运行时插件(plugin),并将此元素的所有属性名和属性值传递进去,它们将按照源码解析时属性加入的顺序添加到此元素上,然后是一个值为null的"PARAM"参数,然后是所有作为applet元素子节点的param元素提供的名字和值,这将存在tree order中,以供插件plugin使用。如果此插件支持脚本接口,HTMLAppletElement对象绘制此元素时应该将该接口暴露出去。applet元素将呈现此插件。
applet元素不会被CSS的"display"属性影响。Java语言运行时即使在此元素被CSS的"display:none"样式隐藏时也会被实例化。applet元素必须实现HTTPAppletElement接口。
interface HTMLAppletElement : HTMLElement { attribute DOMString align; attribute DOMString alt; attribute DOMString archive; attribute DOMString code; attribute DOMString codeBase; attribute DOMString height; attribute unsigned long hspace; attribute DOMString name; attribute DOMString _object; // 底線並非標識符的一部分 attribute unsigned long vspace; attribute DOMString width; };
align, alt, archive, code, height, hspace, name, object, vspace, 和 width 等IDL属性必须反映与它们各自同名属性的内容。为此,applet元素的object内容属性定义为包含一个URL。
IDL属性codeBase必须反映codebase内容属性,此属性因此目的而定义为包含一个URL。
marquee元素
marquee是一个动态呈现内容的元素。CSS的transitions和animations会是更适合的机制。
在本章节中提到的任务里的任务源(task source)为DOM操作任务源(DOM manipulation task source)。
marquee元素必须实现HTMLMarqueeElement接口。
interface HTMLMarqueeElement : HTMLElement { attribute DOMString behavior; attribute DOMString bgColor; attribute DOMString direction; attribute DOMString height; attribute unsigned long hspace; attribute long loop; attribute unsigned long scrollAmount; attribute unsigned long scrollDelay; attribute boolean trueSpeed; attribute unsigned long vspace; attribute DOMString width; attribute Function onbounce; attribute Function onfinish; attribute Function onstart; void start(); void stop(); };
marquee元素可以被开启和关闭,当它被创建时,默认为开启(turned on)状态。
当start()方法被调用时,marquee元素必须设置为开启(turned on)。
当stop()方法被调用时,marquee元素必须设置为关闭(turned off)。
当marquee元素被创建时,user agent必须做任务队列(queue a task)以便触发该元素上名为start的事件(fire a simple event)。
marquee元素上属性的内容behavior是个可枚举的属性(enumerated attribute),它包括如下关键词(全都不符合标准):
| 关键词 | 描述 |
|---|---|
scroll
|
滚动 |
slide
|
滑动 |
alternate
|
交替 |
默认值为scroll。
marquee元素上属性的内容direction是个可枚举的属性(enumerated attribute),它包括如下关键词(全都不符合标准):
| 关键词 | 描述 |
|---|---|
left
|
向左 |
right
|
向右 |
up
|
向上 |
down
|
向下 |
默认值为left。
marquee元素上属性的内容truespeed是个布尔属性(boolean attribute)。
marquee元素具有一个marquee滚动间隔(marquee scroll interval),它的获取过程如下:
- 如果此元素有指定
scrolldelay属性,且在使用非负整数解析规则(rules for parsing non-negative integers)去解析它的值时没有返回错误,则令delay的值为该解析后的值,否则,令delay值为85。 - 如果该元素没有指定
truespeed属性,且delay值小于60,则令delay值为60。 - marquee滚动间隔(marquee scroll interval)即为delay的值,单位为毫秒。
marquee元素具有一个marquee滚动的步进距离(marquee scroll distance),如果此元素指定了scrollamount属性,且在使用非负整数解析规则(rules for parsing non-negative integers)去解析它的值时没有返回错误,则该步进距离为该解析后的值,否则,步进距离为6,单位为CSS中的像素px。
marquee元素具有一个marquee循环次数(marquee loop count),如果此元素指定了loop属性,且在使用整数解析规则(rules for parsing integers)去解析它的值时没有返回错误,或返回值小于1,则该循环次数为该解析后的值,否则,循环次数为-1。
IDL属性loop,在获取的时候,必须返回此元素的marquee loop count;在设置的时候,如果所设的值与原有的值不同,且无论是大于0或等于-1,都必须为此元素属性的内容loop设置一个来自新值的有效整数(valid integer),其他值都应该被忽略。(如果有必要,需要为此元素加上loop属性及新值)
marquee元素同样还具有一个marquee当前循环索引值(marquee curent loop index),当该元素被创建时,其值为0。
渲染层将应时地增加marquee当前循环索引值(increment the marquee current loop index) ,必须使它按以下步骤来运行:
- 如果marquee循环次数(marquee loop count)为-1,则忽略下面这些步骤。
- 为marquee当前循环索引值(marquee current loop index)加1。
- 如果marquee当前循环索引值(marquee current loop index)大于等于此元素的marquee循环次数(marquee loop count),则关闭(turn off)此元素且做个任务对列(queue a task)去触发该元素中名为
finish的事件(fire a simple event)。否则,如果该元素的
behavior属性的状态为alternate,则做个任务队列去触发该元素中名为bounce的事件。否则,做个任务对列去触发该元素中名为
estart的事件。
以下列出的事件句柄(event handlers)(和与之对应的事件句柄事件类型(event handler event types))作为marquee元素的内容和IDL属性,必须支持:
| 事件句柄 | 事件句柄事件类型 |
|---|---|
onbounce
|
弹回(bounce)
|
onfinish
|
结束(finish)
|
onstart
|
开始(start)
|
IDL属性behavior, direction, height, hspace, vspace, 和 width,必须能够反映与之同名属性的内容。
IDL属性bgColor,必须能够反映出bgcolor属性的内容。
IDL属性scrollAmount,必须能够反映scrollamount属性的内容,默认值为6。
IDL属性scrollDelay,必须能够反映scrolldelay属性的内容,默认值为85。
IDL属性trueSpeed,必须能够反映truespeed属性的内容。
Frames
frameset元素在使用帧(框架)时作为documents中的body元素(the body element)。
frameset元素必须实现HTMLFrameSetElement接口。
interface HTMLFrameSetElement : HTMLElement {
attribute DOMString cols;
attribute DOMString rows;
attribute Function onafterprint;
attribute Function onbeforeprint;
attribute Function onbeforeunload;
attribute Function onblur;
attribute Function onerror;
attribute Function onfocus;
attribute Function onhashchange;
attribute Function onload;
attribute Function onmessage;
attribute Function onoffline;
attribute Function ononline;
attribute Function onpagehide;
attribute Function onpageshow;
attribute Function onpopstate;
attribute Function onredo;
attribute Function onresize;
attribute Function onscroll;
attribute Function onstorage;
attribute Function onundo;
attribute Function onunload;
};
frameset元素的IDL属性cols和rows必须反映与之同名属性的内容。
frameset元素必须支持以下的事件句柄内容属性(event handler content attribute),暴露Window对象的事件句柄(event handlers):
- onafterprint
- onbeforeprint
- onbeforeunload
- onblur
- onerror
- onfocus
- onhashchange
- onload
- onmessage
- onoffline
- ononline
- onpagehide
- onpageshow
- onpopstate
- onredo
- onresize
- onscroll
- onstorage
- onundo
- onunload
该DOM接口同时也暴露事件句柄IDL属性(event handler IDL attributes),将它们镜像到Window元素上。
暴露到frameset元素上的那些Window对象上的事件句柄IDL属性onblur, onerror, onfocus, onload, 和 onscroll等,将覆盖通常被HTML元素(HTML elements)支持的同名的事件句柄IDL属性(event handler IDL attributes)。
frame元素定义了一个嵌套的浏览环境(nested browsing context),类似于iframe元素,但它渲染在frameset对象中。
当此浏览环境被创建时,如果出现了一个src属性,那么user agent必须决定(resolve)相对于该元素的属性值,如果成功,则必须将该元素的浏览环境导航(navigate)到绝对路径(absolute URL)的结果中,作为可替换的,且与该frame元素所在文档的浏览环境(browsing context)一起,作为源浏览环境(source browsing context)。
无论src属性在什么时候被设置,user agent必须给它一个相对于该元素的结果,如果成功的话,嵌套的浏览环境(browsing context)必须被导航(navigated)到绝对路径(absolute URL)的结果中去,与该frame元素所在文档的浏览环境(browsing context)一起,作为源浏览环境(source browsing context)。
当此浏览环境被创建时,如果出现一个name属性,则浏览环境名称(browsing context name)必须设置为该属性的值;否则,该浏览环境名称(browsing context name)必须设置为空字符串。
无论name属性在什么时候被设置,嵌套的浏览环境(browsing context)的名称(name)必须设置为新的值。如果该属性被移除,那么,浏览环境名称(browsing context name)必须设置为空字符串。
当一个frame里的内容被载入时,在内容本身的任何load事件被触发后,user agent必须做个任务队列(queue a task),去触发此frame元素上名为load的事件(fire a simple event)。当内容载入失败时(比如,因为网络错误等),user agent必须做个任务队列(queue a task)去触发此元素上名为error的事件(fire a simple event)。
上面提到的任务(tasks)中的任务源(task source)是指DOM manipulation task source。
当frame元素中有一个活动的解析器(active parser)时,且当此frame元素中有任何东西使该元素浏览环境(browsing content)活动文档(active document)的load事件延迟时(delaying the load event),此frame必须延迟它的文档的load事件(delay the load event)。
frame元素必须实现HTMLFrameElement接口:
interface HTMLFrameElement : HTMLElement { attribute DOMString frameBorder; attribute DOMString longDesc; attribute DOMString marginHeight; attribute DOMString marginWidth; attribute DOMString name; attribute boolean noResize; attribute DOMString scrolling; attribute DOMString src; readonly attribute Document contentDocument; readonly attribute WindowProxy contentWindow; };
frame元素的IDL属性name, scrolling和src,必须反映(reflect)与之同名属性的内容。
frame元素的IDL属性frameBorder,必须反映(reflect)该元素frameborder属性的内容。
frame元素的IDL属性longDesc,必须反映(reflect)该元素longdesc属性的内容,为此,它被定义为包含一个URL。
frame元素的IDL属性marginHeight,必须反映(reflect)该元素marginheight属性的内容。
frame元素的IDL属性marginWidth,必须反映(reflect)该元素marginwidth属性的内容。
frame元素的IDL属性noResize,必须反映(reflect)该元素noresize属性的内容。
frame元素的IDL属性contentDocument,必须反映(reflect)该元素嵌套浏览环境(nested browsing context)中活动文本(active document)的Document对象。
IDL属性contentWindow,必须返回frame元素嵌套浏览环境(nested browsing context)的WindowProxy对象。
其他元素,属性和API
user agents在某种程度上来说,就语义化和渲染效果方面,必须采取与abbr相同的方式来对待acronym元素。
[Supplemental] interface HTMLAnchorElement { attribute DOMString coords; attribute DOMString charset; attribute DOMString name; attribute DOMString rev; attribute DOMString shape; };
a元素的IDL属性coords, charset, name, rev 和 shape,必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLAreaElement { attribute boolean noHref; };
area元素的IDL属性noHref必须能够反映nohref元素属性的内容。
basefont元素必须实现HTMLBaseFontElement接口:
interface HTMLBaseFontElement : HTMLElement { attribute DOMString color; attribute DOMString face; attribute long size; };
basefont元素的IDL属性color, face 和 size,必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLBodyElement { attribute DOMString text; attribute DOMString bgColor; attribute DOMString background; attribute DOMString link; attribute DOMString vLink; attribute DOMString aLink; };
body元素的IDL属性text必须能够反映(reflect)该元素的text属性的内容。
body元素的IDL属性bgColor必须能够反映(reflect)该元素的bgcolor属性的内容。
body元素的IDL属性background必须能够反映(reflect)该元素的background属性的内容。(background属性没有定义为包含URL,无视之前渲染章节中关于它的规则。)
body元素的IDL属性link必须能够反映(reflect)该元素的link属性的内容。
body元素的IDL属性aLink必须能够反映(reflect)该元素的alink属性的内容。
body元素的IDL属性vLink必须能够反映(reflect)该元素的vlink属性的内容。
[Supplemental] interface HTMLBRElement { attribute DOMString clear; };
br元素的IDL属性clear必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLTableCaptionElement { attribute DOMString align; };
caption元素的IDL属性align必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLTableColElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; attribute DOMString width; };
col元素的IDL属性align和width必须能够反映(reflect)与之同名属性的内容。
col元素的IDL属性ch必须能够反映(reflect)该元素的char属性的内容。
col元素的IDL属性chOff必须能够反映(reflect)该元素的charoff属性的内容。
col元素的IDL属性vAlign必须能够反映(reflect)该元素的valign属性的内容。
user agents在某种程度上来说,就语义化和渲染效果方面,必须采取与ul相同的方式来对待dir元素。
dir元素必须实现HTMLDirectoryElement接口:
interface HTMLDirectoryElement : HTMLElement { attribute boolean compact; };
dir元素的IDL属性compact必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLDivElement { attribute DOMString align; };
div元素的IDL属性align必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLDListElement { attribute boolean compact; };
dl元素的IDL属性compact必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLEmbedElement { attribute DOMString align; attribute DOMString name; };
embed元素的IDL属性name和align必须能够反映(reflect)与之同名属性的内容。
font元素必须实现HTMLFontElement接口:
interface HTMLFontElement : HTMLElement { attribute DOMString color; attribute DOMString face; attribute DOMString size; };
font元素的IDL属性color, face 和 size 必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLHeadingElement { attribute DOMString align; };
h1 - h6元素的IDL属性align必须能够反映(reflect)与之同名属性的内容。
head元素的IDL属性profile(实现于HTMLHeadElement接口)是被故意删除的。除非有需求来自其他适用的规范(another applicable specification),否则在实现时最好因此而不要去支持该属性。(我们这儿提到的,它在一个早前的DOM规范中做过了定义。)
[Supplemental] interface HTMLHRElement { attribute DOMString align; attribute DOMString color; attribute boolean noShade; attribute DOMString size; attribute DOMString width; };
hr元素的IDL属性align, color, size 和 width 必须能够反映(reflect)与之同名属性的内容。
hr元素的IDL属性noShade必须能够反映(reflect)该元素的noshade属性的内容。
[Supplemental] interface HTMLHtmlElement { attribute DOMString version; };
html元素的IDL属性 version 必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLIFrameElement { attribute DOMString align; attribute DOMString frameBorder; attribute DOMString longDesc; attribute DOMString marginHeight; attribute DOMString marginWidth; attribute DOMString scrolling; };
iframe元素的IDL属性align 和 scrolling 必须能够反映(reflect)与之同名属性的内容。
iframe元素的IDL属性frameBorder必须能够反映(reflect)该元素的frameborder属性的内容。
iframe元素的IDL属性longDesc必须能够反映(reflect)该元素的longdesc属性的内容。
iframe元素的IDL属性marginHeight必须能够反映(reflect)该元素的marginHeight属性的内容。
iframe元素的IDL属性marginWidth必须能够反映(reflect)该元素的marginWidth属性的内容。
[Supplemental] interface HTMLImageElement { attribute DOMString name; attribute DOMString align; attribute DOMString border; attribute unsigned long hspace; attribute DOMString longDesc; attribute unsigned long vspace; };
img元素的IDL属性name, align, border, space 和 space 必须能够反映(reflect)与之同名属性的内容。
img元素的IDL属性longDesc必须能够反映(reflect)该元素的longdesc内容属性,因此,它被定义为包含一个URL。
[Supplemental] interface HTMLInputElement { attribute DOMString align; attribute DOMString useMap; };
input元素的IDL属性align必须能够反映(reflect)与之同名属性的内容。
input元素的IDL属性useMap必须能够反映(reflect)该元素的usemap属性的内容。
[Supplemental] interface HTMLLegendElement { attribute DOMString align; };
legend元素的IDL属性align必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLLIElement { attribute DOMString type; };
li元素的IDL属性type必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLLinkElement { attribute DOMString charset; attribute DOMString rev; attribute DOMString target; };
link元素的IDL属性charset, rev 和 target 必须能够反映(reflect)与之同名属性的内容。
user agents在某种程度上来说,就语义化和渲染效果方面,必须采取与pre相同的方式来对待listing元素。
[Supplemental] interface HTMLMenuElement { attribute boolean compact; };
menu元素的IDL属性compact必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLMetaElement { attribute DOMString scheme; };
user agents大可将meta元素上的内容属性scheme,当作为该元素内容属性name的扩展,当在处理一个meta元素,且它的name属性值为user agent认定为可支持scheme属性的内容时。
user agents被鼓励可以忽略scheme属性,且被替代为处理给予元数据名称的值,如果它被指定为所有scheme属性预期的值。
比如,如果user agent在name属性值为"eGMS.subject.keyword"的meta元素上发生行为,并且知道scheme属性使用此元数据名称,那么,可以考虑,将scheme属性,看作为name属性的扩展。因此,下面两个meta元素可视为两个不同的元数据提供了两个名字,一个是由"eGMS.subject.keyword"和"LGGC"组合而成,另一个是由"eGMS.subject.keyword"和"ORLY"组合而成:
<!-- 此标记是无效的 --> <meta name="eGMS.subject.keyword" scheme="LGCL" content="Abandoned vehicles"> <meta name="eGMS.subject.keyword" scheme="ORLY" content="Mah car: kthxbye">
以上是按此标记建议的处理,然而,它应该与下面的内容相同:
<meta name="eGMS.subject.keyword" content="Abandoned vehicles"> <meta name="eGMS.subject.keyword" content="Mah car: kthxbye">
meta元素的IDL属性scheme,必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLObjectElement { attribute DOMString align; attribute DOMString archive; attribute DOMString border; attribute DOMString code; attribute DOMString codeBase; attribute DOMString codeType; attribute boolean declare; attribute unsigned long hspace; attribute DOMString standby; attribute unsigned long vspace; };
object元素的IDL属性align, archive, border, code, declare, hspace, standby 和 vspace,必须能够反映(reflect)与之同名属性的内容。
object元素的IDL属性codeBase,必须能够反映(reflect)该元素的codebase属性的内容,为此,它被定义为包含一个URL。
object元素的IDL属性codeType,必须能够反映(reflect)该元素的codetype属性的内容。
[Supplemental] interface HTMLOListElement { attribute boolean compact; };
ol元素的IDL属性compact,必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLParagraphElement { attribute DOMString align; };
p元素的IDL属性align,必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLParamElement { attribute DOMString type; attribute DOMString valueType; };
param元素的IDL属性type,必须能够反映(reflect)与之同名属性的内容。
param元素的IDL属性valueType,必须能够反映(reflect)该元素的valuetype属性的内容。
user agents在某种程度上来说,就语义化和渲染效果方面,必须采取与pre相同的方式来对待plaintext元素。(虽然解析器对此元素存在特殊行为。)
[Supplemental] interface HTMLPreElement { attribute unsigned long width; };
pre元素的IDL属性width,必须能够反映(reflect)与之同名属性的内容。
[Supplemental] interface HTMLScriptElement { attribute DOMString event; attribute DOMString htmlFor; };
script元素的IDL属性event和htmlFor,在取值时,必须返回空字符串,在设值的时候什么都不做。
[Supplemental] interface HTMLTableElement { attribute DOMString align; attribute DOMString bgColor; attribute DOMString cellPadding; attribute DOMString cellSpacing; attribute DOMString frame; attribute DOMString rules; attribute DOMString summary; attribute DOMString width; };
table元素的IDL属性align, frame, summary, rules 和 width,必须能够反映(reflect)与之同名属性的内容。
table元素的IDL属性bgColor,必须能够反映(reflect)该元素的bgcolor属性的内容。
table元素的IDL属性cellPadding,必须能够反映(reflect)该元素的cellPadding属性的内容。
table元素的IDL属性cellSpacing,必须能够反映(reflect)该元素的cellSpacing属性的内容。
[Supplemental] interface HTMLTableSectionElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; };
tbody, thead, tfoot元素的IDL属性align,必须能够反映(reflect)与之同名属性的内容。
tbody, thead, tfoot元素的IDL属性ch,必须能够反映(reflect)元素上char属性的内容。
tbody, thead, tfoot元素的IDL属性charOff,必须能够反映(reflect)元素上charoff属性的内容。
tbody, thead, tfoot元素的IDL属性vAlign,必须能够反映(reflect)元素上valign属性的内容。
[Supplemental] interface HTMLTableCellElement { attribute DOMString abbr; attribute DOMString align; attribute DOMString axis; attribute DOMString bgColor; attribute DOMString ch; attribute DOMString chOff; attribute DOMString height; attribute boolean noWrap; attribute DOMString vAlign; attribute DOMString width; };
td, th元素的IDL属性abbr, align, axis, height 和 width,必须能够反映(reflect)与之同名属性的内容。
td, th元素的IDL属性bgColor,必须能够反映(reflect)元素上bgcolor属性的内容。
td, th元素的IDL属性ch,必须能够反映(reflect)元素上char属性的内容。
td, th元素的IDL属性chOff,必须能够反映(reflect)元素上charoff属性的内容。
td, th元素的IDL属性noWrap,必须能够反映(reflect)元素上nowrap属性的内容。
td, th元素的IDL属性vAlign,必须能够反映(reflect)元素上valign属性的内容。
[Supplemental] interface HTMLTableRowElement { attribute DOMString align; attribute DOMString bgColor; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; };
tr元素的IDL属性align,必须能够反映(reflect)与之同名属性的内容。
tr元素的IDL属性bgColor,必须能够反映(reflect)元素上bgcolor属性的内容。
tr元素的IDL属性ch,必须能够反映(reflect)元素上char属性的内容。
tr元素的IDL属性chOff,必须能够反映(reflect)元素上charoff属性的内容。
tr元素的IDL属性vAlign,必须能够反映(reflect)元素上valign属性的内容。
[Supplemental] interface HTMLUListElement { attribute boolean compact; attribute DOMString type; };
ul元素的IDL属性compact和type,必须能够反映(reflect)与之同名属性的内容。
user agents在某种程度上来说,就语义化和渲染效果方面,必须采取与pre相同的方式来对待xmp元素。(虽然解析器对此元素存在特殊行为。)
bgsound, isindex, multicol, nextid, rb 和 spacer元素必须实现HTMLUnknownElement接口:
[Supplemental] interface HTMLDocument { attribute DOMString fgColor; attribute DOMString bgColor; attribute DOMString linkColor; attribute DOMString vlinkColor; attribute DOMString alinkColor; readonly attribute HTMLCollection anchors; readonly attribute HTMLCollection applets; void clear(); readonly attribute HTMLAllCollection all; };
以下表格中第一列所列出的这些Document属性,必须能够反映(reflect)第二列中同一行所对应的在正文元素(the body element)上给出的这些属性的内容,如果正文元素(the body element)是一个body元素(相对于frameset元素)。当此正文元素不存在或它是一个frameset元素时,这些属性转而在取值时必须返回空字符串,在设值时,什么也不做。
| IDL属性 | 内容属性 |
|---|---|
fgColor
|
text
|
bgColor
|
bgcolor
|
linkColor
|
link
|
vlinkColor
|
vlink
|
alinkColor
|
alink
|
anchors属性必须返回一个植根于Document节点的HTMLCollection,过滤后仅匹配到有name属性的a元素。
applets属性必须返回一个植根于Document节点的HTMLCollection,过滤后仅匹配到applet元素。
clear()方法必须什么都不做。
all属性必须返回一个植根于Document节点的HTMLCollection,过滤后匹配到所有的元素。
通过all返回的对象有一些异常的行为:
- 如果在JavaScript中调用ToBoolean()操作,user agents必须将通过
all返回的对象设置为false. - 如果为了在JavaScript中做
==和!=,user agents必须将通过all返回的对象赋值为undefined。 - 如果在JavaScript中调用
typeof操作应用在通过all返回的对象上时,user agent必须令其返回字符串undefined。
undefined的对象提供准备。这些违反都是出于此目的,那就是,期望能够兼容两种类别的遗留内容:一种是通过document.all来检测遗留的user agents,另一种是仅支持那些遗留user agents且document.all对象不是用来进行检测的情况。[ECMA262]