负责制定Web标准的World Wide Web Consortium (W3C)正式发表了HTML5.1推荐规格,规格定义了HTML语言第五大版本的第一个小版本。
W3C已在着手制定下个版本HTML5.2,计划2017年下半年发表并替换此次HTML5.1的规格。
这里摘出HTML5.1和HTML5之间的改变部分:
功能添加
The picture
and srcset
attributes allow responsive image selection.
The details
andsummary
elements enable authors to provide extended information that users can choose whether to read.
The menuitem
and type="context"
attribute value enable authors to add functionality to the browser’s context menu.
The requestAnimationFrame
API allows for more efficient animation.
enqueueJob
and nextJob
help explain Promise resolution in terms of microtasks.
The rev
attribute for links, primarily to support RDFa (previously defined in HTML 4).
HTMLMediaElement
and srcObject
objects.
Enable cross-origin track
and EventSource
and cross-origin content for ImageBitmap
in canvas
.
event-source-error
, event-track-error
and event-track-load
events for media fetching.
onrejectionhandled
and onunhandledrejection
and APIs for tracking promise rejection.
HTMLTableCaptionElement
, HTMLTableSectionElement
, HTMLTableRowElement
, for HTML table elements.
history.scrollRestoration
to control where a users' view is directed when navigating through their history.
IDL [SameObject]
, for some objects that return collections.
Add "noopener" to rel
and window
to allow for browsing contexts to be separated.
nonce
attribute on script
and style
to support the use of Content Security Policy.
功能移除
appCache
.
Media Controllers.
The command
API.
The usemap
attribute on object
.
The accessKeyLabel
IDL attribute.
The form
attribute is no longer valid for label
.
The multiple
attribute on input type="range"
.
hreflang
andtype
attributes on area
.
The use of nested section
elements each with an h1
to create an outline.
Special handling of isindex
in form submission.
navigator.yieldForStorageUpdates()
and the Storage mutex.
Disallow tfoot
before tbody
.
[Exposed=Window]
for HTMLHyperLinkElementUtils, [Exposed=Window, Worker]
for DOMStringMap and IDL Date
.
现有功能调整
The accesskey
takes a single character as a value (as in HTML 4).
header
and footer
elements can be nested, if each level is within a sectioning element.
option
elements can be empty.
The mousewheel
event is called wheel
.
The value
attribute of input type="submit"
is translatable.
A figcaption
can appear anywhere within a figure
.
Having title
, or writing email to a friend does not make an img
missing alt
conformant.
The content of time
is phrasing content, or text.
Blank alt
on area
elements with duplicate href
attributes is no longer conformant.
When navigating internally, the next search for a link etc starts from where the navigation moved to.
img
and related elements support width="0"
.
.tFoot
and .createTFoot()
always insert at the end of a table
fieldset
and namedItem
make HTMLCollection
s not HTMLFormControlsCollection
s and HTMLOptionsCollection
s.
frameElement
can return null
.
For images which don’t resolve currentSrc
is the URL given to the resolver, not necessarily the absolute URL.
script
IDL attributes reflect.
meta refresh
allows ;
or url=
to be optional.
navigator.javaEnabled()
is a method.
fileCallback
is called blobcallback
.
The toBlob()
callback is non-nullable.
origin
on HTMLHyperlinkElementUtils
and Location
is readonly.
The first title
child of an SVG is its title, not the last.
window.open()
can return null
(文/开源中国)