AI News, The Conference Room That Re-Arranges Itself

The Conference Room That Re-Arranges Itself

You can add a new entry to the long list of problems that can be solved by robots: arranging tables in a conference room.

The movement is monitored by an overhead camera with a fish-eye lens, and the software uses a trial-and-error approach to determine the best sequence of motion.

In the paper, the authors explained the rationale for the project: In these days, at conference rooms or event sites, people arrange tables to desired positions suitable for the event.

HTML

This specification defines a big part of the Web platform, in lots of detail.

Web platform specification stack relative to other specifications can be best summed up as

enabled it to be adapted, over the subsequent years, to describe a number of other types of

defined in this specification, implementers of tools that operate on pages that

use the features defined in this specification, and individuals wishing to establish the

familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity

semantic-level scripting APIs for authoring accessible pages on the Web ranging from static

customization of presentation (although default rendering rules for Web browsers are included at

the end of this specification, and several mechanisms for hooking into CSS are provided as part of

hardware configuration software, image manipulation tools, and applications that users would be

to be used by users on an occasional basis, or regularly but from disparate locations, with low

systems, games (especially multiplayer online games), public telephone books or address books,

communications software (e-mail clients, instant messaging clients, discussion software), document

at extending HTML in 1995 known as HTML 3.0 then made way to a more pragmatic approach known as

The following year, the W3C membership decided to stop evolving HTML and instead begin work on

effort started with a reformulation of HTML4 in XML, known as XHTML 1.0, which added no new

focus turned to making it easier for other working groups to extend XHTML, under the banner of

by browser vendors were specified and published under the name DOM Level 1 (in 1998) and DOM Level

out, with some DOM Level 3 specifications published in 2004 but the working group being closed

Web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements

limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for

proof of concept to show that it was possible to extend HTML4's forms to provide many of the

features that XForms 1.0 introduced, without requiring browsers to implement rendering engines

At this early stage, while the draft was already publicly available, and input was

aforementioned early draft proposal covering just forms-related features, were presented to the

be jointly owned by all three vendors, and to allow reuse of the specification.

also meant including significantly more detail than had previously been considered the norm.

and in 2007 formed a working group chartered to work with the WHATWG on the development of the

the conclusion that they had different goals: the W3C wanted to publish a 'finished' version of

maintaining the specification rather than freezing it in a state with known problems, and adding

developed over a period of several decades by a wide array of people with different priorities

bugs have often become de-facto, and now de-jure, standards, as content is often unintentionally

designed such that no script can ever detect the simultaneous execution of other scripts.

be thought of as completely serializing the execution of all scripts in all browsing contexts.

script execution, but also un-representable via serialized statement execution

certain circumstances, unfortunately, conflicting needs have led to this specification violating

HTML has a wide array of extensibility mechanisms that can be used for adding semantics in a

This specification defines an abstract language for describing documents and applications, and

This specification is divided into the following major sections: There are also some appendices, listing obsolete features and IANA considerations, and several indices.

read by picking random sections from the contents list and following all the cross-references.

requirements that apply to producers, for example authors and the documents they create,

of requirements that follow the condition, even in the case of there being multiple sets of

servers, and shared computers enable packets that appear to all come from a single IP address to

anonymize requests so that requests from a single user at one node on the Internet appear to come

individual user's browser's 'digital fingerprint' can be computed, which can be as good, if not

Grouping requests in this manner, especially across multiple sites, can be used for both benign

reasonably benign purpose would be determining whether a particular person seems to prefer sites

with dog illustrations as opposed to sites with cat illustrations (based on how often they visit

the sites in question) and then automatically using the preferred illustrations on subsequent

information such as the person's home address (determined from the addresses they use when getting

driving directions on one site) with their apparent political affiliations (determined by

examining the forum sites that they participate in) to determine whether the person should be

Since the malevolent purposes can be remarkably evil, user agent implementers are encouraged to

consider how to provide their users with tools to minimize leaking information that could be used

log into a site to post under a specific identity requires that the user's requests be

information such as how wide text is, which is necessary for many effects that involve drawing

via a brute force search, which fonts a user has installed, information which can vary

Other features in the platform can be used for the same purpose, though, including, though not

which two sites can communicate that predate this API: a site embedding another can send data via

unique identifier known to the server to initiate a server-side data exchange;

fingerprinting techniques described above can be used by two sites to uniquely identify a visitor

basic HTML document looks like this: HTML documents consist of a tree of elements and text.

(Certain start tags and end tags can in certain cases be omitted and are implied by other tags.) Tags have to be nested such that elements are all completely within each other, without

overlapping: This specification defines a set of elements that can be used in HTML, along with rules about

is a hyperlink, formed using the a element and its href attribute: Attributes are placed inside the start tag, and consist

turned into the following DOM tree: The document element of this tree is the html element, which is the

because the source contains a number of spaces (represented here by '␣') and line breaks

reasons not all of the spaces and line breaks in the original markup appear in the DOM.

particular, all the whitespace before head start tag ends up being dropped silently,

and all the whitespace after the body end tag ends up placed at the end of the

are small programs that can be embedded using the script element or using event

of the form's output element to say 'Hello World': Each element in the DOM tree is represented by an object, and these objects have APIs so that

ways: Since DOM trees are used as the way to represent HTML documents when they are processed and

presented by implementations (especially interactive implementations like Web browsers), this

specification is mostly phrased in terms of DOM trees, instead of the markup described above.

influence exactly how such rendering takes place, authors can use a styling language such as

cautioned that this specification, by necessity, defines the language with a level of detail that

When HTML is used to create interactive sites, care needs to be taken to avoid introducing

comprehensive study of this matter is beyond the scope of this document, and authors are

URL parameters, messages from third-party sites, etc, it is imperative that the data be

hostile user to perform a variety of attacks, ranging from the potentially benign, such as

providing bogus user information like a negative age, to the serious, such as running scripts

every time a user looks at a page that includes the information, potentially propagating the

attack in the process, to the catastrophic, such as deleting all data in the server.

When writing filters to validate user input, it is imperative that filters always be

safelist-based, allowing known-safe constructs and disallowing all other input.

filters that disallow known-bad inputs and allow everything else are not secure, as not

everything that is bad is yet known (for example, because it might be invented in the

are some that authors are encouraged to consider when writing safelist filters: If a site allows a user to make form submissions with user-specific side-effects, for example

posting messages on a forum under the user's name, making purchases, or applying for a passport,

it is important to verify that the request was made by the user intentionally, rather than by

another site tricking the user into making the request unknowingly.

Sites can prevent such attacks by populating forms with user-specific hidden tokens, or by

page that provides users with an interface to perform actions that the user might not wish

to perform needs to be designed so as to avoid the possibility that users can be tricked into

One way that a user could be so tricked is if a hostile site places the victim site in a

small iframe and then convinces the user to click, for instance by having the user

the iframe under the mouse cursor just as the user is about to click, thus tricking the user

the script uninterrupted before doing anything else, such as firing further events or continuing

mean that authors need to be careful to avoid hooking event handlers after the events could have

attributes, or create the element and add the event handlers in the same script.

is safe because, as mentioned earlier, scripts are run to completion before further events can

conformance requirements for documents are still important: in practice, interoperability (the

situation in which all implementations process particular content in a reliable and identical or

Presentational markup in general has been found to have a number of problems: While it is possible to use presentational markup in a way that provides users of assistive

more difficult than doing so when using semantically-appropriate markup.

such techniques doesn't help make pages accessible for non-AT non-graphical users, such as users

Using media-independent markup, on the other hand, provides an easy way for documents to be

authored in such a way that they work for more users (e.g.

It is significantly easier to maintain a site written in such a way that the markup is

For example, changing the color of a site that uses <font color=''> throughout requires changes across the entire site,

whereas a similar change to a site based on CSS can be done by changing a single file.

provided a mode (HTML4 Transitional) to help authors move away from presentational markup;

The only remaining presentational markup features in HTML are the style attribute and the style element.

it can be useful for rapid prototyping (where its rules can be directly moved into a separate

style sheet later) and for providing specific styles in unusual cases where a separate style sheet

for page-specific styles, but in general an external style sheet is likely to be more convenient

To allow user agents to be used in controlled environments without having to implement the

more bizarre and convoluted error handling rules, user agents are permitted to fail whenever

user agents (user agents that process HTML files in one pass, without storing state).

interoperability problems with such user agents, any syntax resulting in such behavior is

invariants that XML enforces, such as element or attribute names never contain multiple colons,

that are allowed in the HTML syntax.) Certain syntax constructs can result in disproportionately poor performance.

reduce the number of users who accidentally run into such problems, they are made

Certain syntax constructs are known to cause especially subtle or serious problems in legacy

user agents, and are therefore marked as non-conforming to help authors avoid them.

these errors early makes later maintenance easier.

When a user makes a simple typo, it is helpful if the error can be caught early, as this can

save the author a lot of debugging time.

error to use element names, attribute names, and so forth, that do not match the names defined

In order to allow the language syntax to be extended in the future, certain otherwise

including all optional tags, preferring the consistency derived from such custom over the minor

authors, conformance checkers can provide modes of operation wherein such conventions are

These restrictions are present for similar reasons: To avoid misuse of elements with defined meanings, content models are defined that restrict

how elements can be nested when such nestings would be of dubious value.

element inside a kbd element, since it is highly unlikely for an author to indicate

contradictions in the semantics expressed are also considered conformance errors.

ul element, which only allows li element children.

consist just of zero or more list items, so if a ul element contains something

For example, div elements are rendered as block boxes, and span elements as inline boxes.

elements, or nesting just span elements, or nesting span elements

inside div elements all serve the same purpose as nesting a div

element in a span element, but only the latter involves a block box in

an inline box, the latter combination is disallowed.

attribute to the value 'false' is disallowed, because despite the

appearance of meaning that the element is enabled, it in fact means that the element is

disabled (what matters for implementations is the presence of the attribute, not its

For example, the area element's shape attribute, despite accepting both circ and circle values in practice as synonyms, disallows

cause extra confusion when teaching the language.

Certain elements are parsed in somewhat eccentric ways (typically for historical reasons),

and their content model restrictions are intended to avoid exposing the author to these

Some errors are intended to help prevent script problems that would be hard to debug.

element being selected, with sometimes disastrous effects whose cause is hard to determine.

wasted authoring time, and by encouraging authors to avoid making them, authors can save time in

For example, a script element's src attribute causes the element's contents to be ignored.

However, this isn't obvious, especially if the element's contents appear to be executable script

— which can lead to authors spending a lot of time trying to debug the inline script

non-conforming to have executable script in a script element when the src attribute is present.

validating their documents are less likely to waste time with this kind of mistake.

complications involved (especially when involving scripting, styling, or any kind of automated

serialization), this specification has a few restrictions intended to at least somewhat mitigate

For example, there are somewhat complicated rules surrounding the lang and xml:lang attributes

Another example would be the restrictions on the values of xmlns attributes in the HTML serialization, which are intended to ensure that

elements in conforming documents end up in the same namespaces whether processed as HTML or

As with the restrictions on the syntax intended to allow for new syntax in future revisions

of the language, some restrictions on the content models of elements and values of attributes

are intended to allow for future expansion of the HTML vocabulary.

character (_) to only specific predefined values allows new predefined values to be introduced

at a future time without conflicting with author-defined values.

For example, requiring that attributes that take media query lists use only

valid media query lists reinforces the importance of following the conformance rules of

ranging from short static documents to long essays or reports with rich multimedia, as well as to

objects and their descendant DOM trees, and to serialized byte streams using the HTML syntax or the XML syntax, depending

definition.) In the context of byte streams, the term HTML document refers to resources labeled as

visible might sometimes be used when referring to the way a document is

achieved, be it time-sharing cooperative multitasking, fibers, threads, processes, using different

immediately must interrupt the currently running task, run itself, and then resume the

To start a new parallel queue, run the following steps: Steps running in parallel can themselves run other steps in in

agent has an implementation capable of decoding the semantics of an external resource.

type is said to be supported if the implementation can process an external resource of that

pixel data could be decoded and rendered, even if, unbeknownst to the implementation, the image

compression format used was not supported, even if the implementation could determine the

The term element type is used to refer to the set of elements that have a given

type button, meaning they have the local name 'button' and

or string, means that the length of the text is zero (i.e., not even containing controls or U+0020 SPACE).

node becomes connected when the insertion steps are invoked with it as the argument and it

actually an interface, is sometimes used instead of the more accurate 'an object implementing the

The term plugin refers to a user-agent defined set of content handlers used by the

user agent that can take part in the user agent's rendering of a Document object, but

Typically such content handlers are provided by third parties, though a user agent can also

regardless of whether the party that implemented the PDF viewer component was the same as that

from the user agent (as opposed to using the same interface) is not a plugin by this

privileges as the user agent itself, vulnerabilities in the third-party software become as

fingerprinting vector that increases the chances of users being uniquely identified, user agents

This specification describes the conformance criteria for user agents

itself be a user agent — such user agents are subject to additional rules, as explained

from the HTML namespace found in XML documents as described in this specification,

so that users can interact with them, unless the semantics of those elements have been

an XML document, execute the script contained in that element.

within a transformation expressed in XSLT (assuming the user agent also supports XSLT), then the

processor would instead treat the script element as an opaque element that forms

HTML MIME type as described in this specification, so that users can interact with

elements do not override the requirements on DOM objects representing those elements.

example, the script element in the example above would still implement the

User agents that process HTML and XML documents purely to render non-interactive versions of

them must comply to the same conformance criteria as Web browsers, except that they are exempt

non-interactive presentation user agents will also opt to lack scripting

allowing forms to be dynamically submitted, and so forth.

is irrelevant when the user cannot interact with the document, the UA would not need to support

User agents, whether interactive or not, may be designated (possibly as a user option) as

supporting the suggested default rendering defined by this specification.

rendering are encouraged to offer settings that override this default to improve the experience

designated, implement the rules the rendering section defines as the

behavior that user agents are expected to implement.

disabled entirely) are exempt from supporting the events and DOM interfaces mentioned in this

or in terms of the DOM, such user agents must still act as if events and the DOM were

support scripting, or that have scripting disabled, might be unable to fully convey the author's

detecting errors that require interpretation of the author's intent (for example, while a

document is non-conforming if the content of a blockquote element is not a quote,

conformance checkers running without the input of human judgement do not have to check that

blockquote elements only contain quoted material).

browsing context (meaning that no scripts are run, and

that the parser's scripting flag is disabled), and should also check that the input

document conforms when parsed with a browsing context

in which scripts execute, and that the scripts never cause non-conforming states to occur other

render the documents or check them for conformance should act in accordance with the semantics

increases the nesting level for each paragraph and does not increase the nesting level for each

Conformance criteria that apply to authors also apply to authoring tools, where appropriate.

specified purpose, but only to the extent that authoring tools are not yet able to determine

for its nearest article or body element ancestor.

authoring tool is likely unable to determine the difference, an authoring tool is exempt from

elements for any block of italics text (for instance);

doesn't have to verify that when the user uses a tool for inserting contact information for an

article element, that the user really is doing that and not inserting something

When an authoring tool is used to edit a non-conforming document, it may preserve the

conformance errors in sections of the document that were not edited during the editing session

must not claim that the output is conformant if errors have been so preserved.

Authoring tools are expected to come in two broad varieties: tools that work from structure

or semantic data, and tools that work on a What-You-See-Is-What-You-Get media-specific editing

source information can be used to make informed choices regarding which HTML elements and

certain extreme cases mean limiting the use of flow elements to just a few elements, like

div, b, i, and span and making liberal use

users to create well-structured, semantically rich, media-independent content.

to prevent denial of service attacks, to guard against running out of

For compatibility with existing content and prior specifications, this specification describes

two authoring formats: one based on XML, and one using a custom format inspired by SGML (referred to as the HTML syntax).

Some conformance requirements are phrased as requirements on elements, attributes, methods or

words, this specification does not distinguish between conformance criteria on authors and

conformance criteria on documents.) Vendor-specific proprietary user agent extensions to this specification are strongly

fragments the user base, allowing only users of specific user agents to access the content in

be updated accordingly, or an extension specification can be written that overrides the

their random junk actually is conforming for everyone's purposes: if someone else decides that

problem, or to aid in development, or for performance reasons), user agents must act as if they

— leaving the attribute on the object but making it return null or throw an exception is

documents parsed or created in the manners described in this specification (e.g.

done for element type names in start and end-tags except that the default namespace declared with

namespace URI is null (this is the same way attribute names are expanded).

If the QName has no prefix and the principal node type of the axis is element, then the

value of the default element namespace when executing an XPath expression through the DOM3 XPath

API is determined in the following way: This is equivalent to adding the default element namespace feature of XPath 2.0

to XPath 1.0, and using the HTML namespace as the default element namespace for HTML documents.

It is motivated by the desire to have implementations be compatible with legacy HTML content

while still supporting the changes that this specification introduces to HTML regarding the

namespace used for HTML elements, and by the desire to use XPath 1.0 rather than XPath 2.0.

motivated by desire to have implementations be compatible with legacy content while still

supporting the changes that this specification introduces to HTML regarding which namespace is

method is 'html' (either explicitly or via the defaulting rule in XSLT 1.0) are affected as

follows: If the transformation program outputs an element in no namespace, the processor must, prior to

constructing the corresponding DOM element node, change the namespace of the element to the

(Processors that serialize the output are unaffected.) [XSLT10] This specification does not specify precisely how XSLT processing interacts with the HTML

parser infrastructure (for example, whether an XSLT processor acts as if it puts any

This specification does not specify how XSLT interacts with the navigation algorithm, how it fits in with the event loop, nor

There are various places in HTML that accept particular data types, such as dates or numbers.

This section describes what the conformance criteria for content in those formats is, and how to

they might consider using to implement the parsing of syntaxes described below.

libraries are likely to implement error handling behavior that differs from what is required in

describe date syntaxes similar to those used in this specification, and thus implementations tend

variable that holds the string being parsed, and having a position variable pointing at

presence of a boolean attribute on an element represents the true value, and the absence of the

ASCII case-insensitive match for the attribute's canonical name, with no leading or

defined to map to a particular state (several keywords might map to the same state, in

If the attribute value matches none of the given keywords, but the attribute has an

attribute value matches none of the keywords but there is a missing value default state

with a U+002D HYPHEN-MINUS (-) prefix represents the number represented in base ten by

invoked, the steps must be followed in the order given, aborting at the first step that returns a

valid non-negative integer represents the number that is represented in base ten

When invoked, the steps must be followed in the order given, aborting at the first step that

valid floating-point number represents the number obtained by multiplying the

significand by ten raised to the power of the exponent, where the significand is the first number,

interpreted as base ten (including the decimal point and the number after the decimal point, if

any, and interpreting the significand as a negative number if the whole string starts with a

character (-) between the E and the number and the number is not zero, or else ignoring a U+002B

restrict what is allowed for authors, while the user agent requirements use the rules for

parsing floating-point number values below (e.g., the max attribute of the progress element).

some cases the user agent requirements include checking if a string is a valid

floating-point number (e.g., the value sanitization algorithm for the Number state of the input element, or the

return the same string for that value (though it may differ from the value used by other user

invoked, the steps must be followed in the order given, aborting at the first step that returns a

valid list of floating-point numbers is a number of valid floating-point numbers separated by U+002C COMMA characters,

restrictions on the number of floating-point numbers that can be given, or on the range of values

The rules for parsing a list of floating-point numbers are as follows: The rules for parsing a list of dimensions are as follows.

of zero or more pairs consisting of a number and a unit, the unit being one of percentage,

year is: 31 if month is 1, 3, 5, 7, 8,

29 if month is 2 and year is a number divisible by 400, or if year is a number divisible by 4 but not by 100;

Implementors are therefore encouraged to carefully examine any date parsing libraries before using

arbitrary choice resulting from the cultural biases of those involved in the decision.

the section discussing date, time, and number formats in forms

date with no time-zone information and no date information beyond a year and a month.

string is a valid month string representing a year year and

month month if it consists of the following components in the given order: The rules to parse a month string are as follows.

The rules to parse a month component, given an input string and

date with no time-zone information, consisting of a year, a month, and a day.

string is a valid date string representing a year year, month

components in the given order: The rules to parse a date string are as follows.

The rules to parse a date component, given an input string and a

string is a valid yearless date string representing a month month and a day day if it consists of the following components

information, consisting of an hour, a minute, a second, and a fraction of a second.

string is a valid time string representing an hour hour, a

following components in the given order: The second component cannot be 60 or 61;

The rules to parse a time component, given an input string and a

consisting of an hour, a minute, a second, and a fraction of a second, but expressed without a

string is a valid local date and time string representing a date and time if it

normalized local date and time string representing a date and time if it consists of the

following components in the given order: The rules to parse a local date and time string are as follows.

string is a valid time-zone offset string representing a time-zone offset if it

consists of either: This format allows for time-zone offsets from -23:59 to +23:59.

practice, the range of offsets of actual time zones is -12:00 to +14:00, and the minutes component

of offsets of actual time zones is always either 00, 30, or 45.

will remain so forever, however, since time zones are used as political footballs and are thus

date and time section below for details on using time-zone offsets with historical times

consisting of an hour, a minute, a second, and a fraction of a second, expressed with a time-zone

string is a valid global date and time string representing a date, time, and a

time-zone offset if it consists of the following components in the given order: Times in dates before the formation of UTC in the mid twentieth century must be expressed and

interpreted in terms of UT1 (contemporary Earth solar time at the 0° longitude), not UTC (the

expressed and interpreted as UT1 times with explicit time zones that approximate the contemporary

difference between the appropriate local time and the time observed at the location of Greenwich,

either a time in UTC, with associated time-zone offset information for round-tripping or display

Gregorian date Monday December 29th 1969 (1969-12-29) is defined as week number 1 in week-year

Gregorian calendar that has a Wednesday as its first day (January 1st) and where year is a number divisible by 400, or a number divisible by 4 but not by 100.

seconds, but is instead a period whose exact length depends on the precise day from which it is

it is also one of the following: The rules to parse a date or time string are as follows.

range 0..255, representing the red, green, and blue components of the color respectively, in the

exactly seven characters long, and the first character is a U+0023 NUMBER SIGN character (#), and

representing the red component, the middle two digits representing the green component, and the

simple color values given a simple color are as given in the following

algorithm: Some obsolete legacy attributes parse colors in a more complicated manner, using the

set of space-separated tokens is a string containing zero or more words (known as

tokens where none of the tokens are duplicated but where the order of the tokens is

set of comma-separated tokens is a string containing zero or more tokens each

separated from the next by a single U+002C COMMA character (,), where tokens consist of any string

of zero or more characters, neither beginning nor ending with ASCII whitespace, nor

For instance, the string ' a ,b,,d d ' consists of four tokens: 'a', 'b', the empty

string consisting of a U+0023 NUMBER SIGN character (#) followed by a string which exactly matches

the value of the name attribute of an element with type type in

string is a valid media query list if it matches the <media-query-list> production of the Media Queries specification.

consisting of only ASCII whitespace, or is a media query list that matches the user's

string is a valid URL potentially surrounded by spaces if, after stripping leading and trailing ASCII

string is a valid non-empty URL potentially surrounded by spaces if, after stripping leading and trailing ASCII

URL record obtained by running these steps: The document base URL of a Document object is the

absolute URL obtained by running these steps: Parsing a URL is the process of taking a string and obtaining the URL record that

match that of the document or environment settings object for legacy reasons.

document or environment settings object, the user agent must use the

affected by a base URL change (as defined by the DOM specification): If the URL identified by the hyperlink is being shown to the user, or if any

data derived from that URL is affecting the display, then the href attribute should be reparsed relative to the element's node document and the UI updated

URL(s) are being shown to the user, then the ping attribute's tokens should be reparsed relative to the element's node document and the UI updated

shown to the user, or if any data derived from that URL is affecting the display,

element's node document and the UI updated appropriately.

img elements, although subsequent accesses of the src IDL attribute from script will return a new absolute

When a user agent uses different heuristics for content type detection than the

doesn't allow the use of single quotes and requires supporting a backslash-escape mechanism that

table lists the keywords and states for the attribute — the keywords in the left column map

purposes of reflection, the canonical case for the Anonymous state is the anonymous keyword.

For module scripts, certain CORS settings attributes have been repurposed to have a slightly different

meaning, wherein they only impact the request's credentials mode (since the mode is always 'cors').

this translation, we define the module script credentials mode for a given CORS

Each referrer policy, including the empty string, is a keyword for this attribute,

The attribute's invalid value default and missing value default are both the empty string state.

The impact of these states on the processing model of various fetches is defined in more detail throughout this specification, in

selectors) by extracting the value from the content attribute, moving it into an internal slot

list is append-only, user agents can optimize away the contains a header-delivered

means that on getting, the IDL attribute returns the current value of the content attribute, and

on setting, the IDL attribute changes the value of the content attribute to the given value.

In general, on getting, if the content attribute is not present, the IDL attribute must act as

whose content attribute is defined to contain a URL, then on getting, if the

content attribute is absent, the IDL attribute must return the empty string.

whose content attribute is an enumerated attribute, and the IDL attribute is

limited to only known values, then, on getting, the IDL attribute must return the

conforming value associated with the state the attribute is in (in its canonical case), if any, or

the empty string if the attribute is in a state that has no associated keyword value or if the

attribute whose content attribute is an enumerated attribute, then, on getting, if

the corresponding content attribute is in its missing value default then the IDL attribute

must return null, otherwise, the IDL attribute must return the conforming value associated with

content attribute must be removed, and otherwise, the content attribute must be set to the

getting the IDL attribute must return true if the content attribute is set, and false if it is

rules for boolean content attributes.) If a reflecting IDL attribute has a signed integer type (long)

then, on getting, the content attribute must be parsed according to the rules for parsing signed integers, and if that is successful, and the

value is in the range of the IDL attribute's type, the resulting value must be returned.

the other hand, it fails or returns an out of range value, or if the attribute is absent, then the

default value must be returned instead, or 0 if there is no default value.

value must be converted to the shortest possible string representing the number as a valid

integer and then that string must be used as the new content attribute value.

must be parsed according to the rules for parsing non-negative integers, and if that

is successful, and the value is in the range of the IDL attribute's type, the resulting value must

is absent, the default value must be returned instead, or −1 if there is no default value.

On setting, if the value is negative, the user agent must throw an

must be converted to the shortest possible string representing the number as a valid

non-negative integer and then that string must be used as the new content attribute

If a reflecting IDL attribute has an unsigned integer type (unsigned long) then, on getting, the content attribute must be

parsed according to the rules for parsing non-negative integers, and if that is

successful, and the value is in the range 0 to 2147483647 inclusive, the resulting value must be

absent, the default value must be returned instead, or 0 if there is no default value.

first, if the new value is in the range 0 to 2147483647, then let n be the new value,

otherwise let n be the default value, or 0 if there is no default value;

n must be converted to the shortest possible string representing the number as a

valid non-negative integer and that string must be used as the new content attribute

If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is limited to only non-negative numbers

greater than zero, then the behavior is similar to the previous case, but zero is not

parsing non-negative integers, and if that is successful, and the value is in the range 1

returns an out of range value, or if the attribute is absent, the default value must be returned

if the new value is in the range 1 to 2147483647, then let n be the new value,

otherwise let n be the default value, or 1 if there is no default value;

n must be converted to the shortest possible string representing the number as a

valid non-negative integer and that string must be used as the new content attribute

If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is limited to only non-negative numbers

greater than zero with fallback, then the behavior is similar to the previous case, but

be parsed according to the rules for parsing non-negative integers, and if that is

successful, and the value is in the range 1 to 2147483647 inclusive, the resulting value must be

range 1 to 2147483647, then let n be the new value, otherwise let n be the

the number as a valid non-negative integer and that string must be used as the new

If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is clamped to the range

and the value is between min and max inclusive, the resulting value must be

double), then, on getting, the content attribute must be parsed according to the

rules for parsing floating-point number values, and if that is successful, the

the default value must be returned instead, or 0.0 if there is no default value.

given value must be converted to the best representation of the number as a floating-point

number and then that string must be used as the new content attribute value.

double) that is limited to numbers greater than zero, then the behavior is

similar to the previous case, but zero and negative values are not allowed.

content attribute must be parsed according to the rules for parsing floating-point number

values, and if that is successful and the value is greater than 0.0, the resulting value

attribute is absent, the default value must be returned instead, or 0.0 if there is no default

Otherwise, the given value must be converted to the best representation of the number as a

floating-point number and then that string must be used as the new content attribute

return a DOMTokenList object whose associated element is the element in question and

whose associated attribute's local name is the name of the attribute in question.

select, and textarea elements can have a name for the purpose of this

The supported property names consist of the non-empty values of all the id attributes of all the elements represented by the

tree order, ignoring later duplicates, with the id of

The indexed property getter must return the result of getting the 'all'-indexed element from this

method must perform the following steps: The following elements are 'all'-named elements:

Can be set, to check the first radio button with the given value represented by the object.

The supported property names consist of the non-empty values of all the id and name attributes of all the

elements represented by the collection, in tree order, ignoring later

duplicates, with the id of an element preceding its name if it contributes both, they differ from each other, and neither is the

RadioNodeList object, on getting, must return the value returned by running the

following steps: On setting, the value IDL attribute must run the

following steps: The HTMLOptionsCollection interface is used for collections of option elements.

rooted on a select element and has attributes and methods that manipulate that

When set to a smaller number, truncates the number of option elements in the corresponding container.

When set to a greater number, adds new blank option elements to that container.

The before argument can be a number, in which case element is inserted before the item with that number, or an element from the

collection, in which case element is inserted before that element.

If before is omitted, null, or a number out of range, then element will be added at the end of the list.

On setting, the behavior depends on whether the new value is equal to, greater than, or less

If the new value is greater, then n new option elements with no attributes and no child nodes must be

rooted, where n is the difference between the two numbers (new value minus old

If the new value is lower, then the last n nodes in the collection must be removed from their parent nodes, where n is the difference between the two numbers (old value minus new value).

or adds any optgroup elements, and never adds new children to existing

The supported property names consist of the non-empty values of all the id and name attributes of all the

elements represented by the collection, in tree order, ignoring later

duplicates, with the id of an element preceding its name if it contributes both, they differ from each other, and neither is

indexed property or set the value of an existing indexed property for a given

property index index to a new value value, it must run the following

algorithm: The add(element, before) method must act according to the following algorithm: The remove(index) method must act according to the following algorithm: The selectedIndex IDL

attribute must act like the identically named attribute on the select element on

which the HTMLOptionsCollection is rooted The DOMStringList interface is a non-fashionable retro way of representing a list

method, when invoked, must return true if this DOMStringList object's associated list

disk and later restored, or cloned across document and worker boundaries (including across

set of steps that deserializes the data in serialized, using it to set up

platform object type in question, with none of its internal data set up;

steps for the partial interface or mixin should be understood as being appended to those of

However, to better specify the behavior of certain more complex situations, the model was updated

platform object type in question, with none of its internal data set up;

steps for the partial interface or mixin should be understood as being appended to those of

form has all the information necessary to later deserialize into a new JavaScript value in a

This process can throw an exception, for example when trying to allocate memory for the new

immediately, with the deserialization step delayed until the target Realm becomes known.

messagePort.postMessage() uses this pair of abstract operations, as the destination Realm is not known until the

saved for an indefinite amount of time, and then reified back into a JavaScript value later,

is anticipated to be stored in a persistent manner, instead of passed between Realms.

when attempting to serialize SharedArrayBuffer objects, since storing shared memory

platform object with custom serialization steps when the

StructuredSerializeForStorage on author-supplied state objects, storing them as

serialized state in the appropriate session history entry.

StructuredDeserialize is used so that the history.state property can return a clone of the

multiple times on the result to produce a fresh clone for each destination being broadcast

to define a 'structured clone' algorithm, and more recently a StructuredClone abstract operation.

However, in practice all known uses of it were better served by separate serialization and

Call sites that are not invoked as a result of author code synchronously calling into a user

agent method must take care to properly prepare to run script and prepare to

the serialization process can invoke author-defined accessors as part of its final

deep-serialization steps, and these accessors could call into operations that rely on the entry and incumbent concepts being properly set up.

algorithms without needing to prepare to run script and prepare to run a

serialize some author-supplied object periodically, directly from a task on the event loop, would need to ensure it performs

usually it is simpler to perform the serialization ahead of time, as a synchronous consequence of

browsing context, it must act as follows: The WHATWG DOM standard defines a Document interface, which

The Document has an HTTPS state (an HTTPS state value), initially 'none', which represents the security properties of the network channel used to

empty string, which represents the default referrer policy used by fetches initiated by the Document.

cookies can't be applied to this resource, the empty string will be returned.

across frames, the path restrictions on cookies are only a tool to help manage which cookies are

contexts in a multiprocess user agent can modify cookies while scripts are running.

for instance, try to read a cookie, increment its value, then write it back out, using the new

different browser windows at the same time, it might end up using the same 'unique' identifier for

form 'MM/DD/YYYY hh:mm:ss', in the user's local time zone.

getting, must return the date and time of the Document's source file's last

modification, in the user's local time zone, in the following format: All the numeric components above, other than the year, must be given as two ASCII

digits representing the number in base ten, zero-padded if necessary.

given as the shortest possible string of four or more ASCII digits representing the

Returns 'loading' while the Document is loading, 'interactive' once it is finished parsing but still loading subresources, and

'interactive' but before the transition to 'complete', at the point where all subresources apart from async script elements have loaded.

is created, it must have its current document readiness set to the string 'loading' if the document is associated with an HTML parser, an

user agent must fire an event named readystatechange at the Document object.

must, on getting, run the following algorithm: On setting, the steps corresponding to the first matching condition in the following list must

On setting, the following algorithm must be run: The value returned by the body getter is

that document that have a name attribute whose value is equal to the name argument (in a case-sensitive manner), in tree

argument, the user agent may return the same as the object returned by the earlier call.

that is currently executing, as long as the element represents a classic script.

In the case of reentrant script execution, returns the one that most recently started executing

or SVG script element (e.g., because the running script is an event

handler, or a timeout), or if the currently executing script or SVG

script element represents a module script.

a new solution for identifying the running script in such contexts, which does not make it

tree order according to the element that contributed them, ignoring later duplicates,

and with values from id attributes coming before values from name attributes when the same element contributes both: To determine the value of a named property

name for a Document, the user agent must return the value obtained using

the following steps: Named elements with the name name, for the purposes of the above algorithm, are those that are either: An embed or object element is said to be exposed if it has

These definitions allow HTML processors, such as Web browsers or search engines, to present and

use documents and applications in a wide variety of contexts that the author might not have

appropriate intended semantic purpose, as doing so prevents software from correctly processing the

browsing context are exempt from all document conformance requirements other than the

Through scripting and using other mechanisms, the values of attributes, text, and indeed the

entire structure of the document may change dynamically while a user agent is processing it.

semantics of a document at an instant in time are those represented by the state of the document

at that instant in time, and the semantics of a document can therefore change over time.

'value' attribute is dynamically updated by a script, the UA would update the rendering to show

implement, and expose to scripts, the interfaces listed for them in the relevant sections of this

hyperlink with that id attribute's value as the fragment for the hyperlink's href attribute value.

The basic interface, from which all the HTML elements' interfaces inherit, and which must be used by elements that have no additional requirements, is

disparate features, and the members of this interface are therefore described in various different

It indicates that the interface object for the given interface will have a specific behavior when

redundant with the content models of elements that allow this one as a child, and is provided

element that is both flow content and phrasing content can be used

anywhere that either flow content or phrasing content is expected, but

since anywhere that flow content is expected, phrasing content is also

expected (since all phrasing content is flow content), only 'where

any additional normative conformance criteria that may apply to authors and implementations.

attribute values on HTML elements may be any string value, including the empty

element must have contents that match the requirements described in the element's content

ignored when establishing whether an element's contents match the element's content model or not,

and must be ignored when following algorithms that define document and element semantics.

compound documents, these contexts could be inside elements from other namespaces, if those

in this specification: Some elements also fall into other categories, which are defined in other parts of

Sectioning content, heading content, phrasing content, embedded content, and interactive

Heading content defines the header of a section (whether explicitly marked up using

This specification includes extra constraints on the exact value of Text nodes and

content but not metadata, are embedded content for the purposes of the content models

(For example, MathML, or SVG.) Some embedded content elements can have fallback content: content that is to be used

As a general rule, elements whose content model allows any flow content or

phrasing content should have at least one node in its contents that is palpable content and that does

hear (audio elements) or view (video or img or

canvas elements) or otherwise interact with (for example, interactive form

can be empty legitimately, for example when it is used as a placeholder which will later be filled

in by a script, or when the element is part of a template and would on most pages be filled in but

Conformance checkers are encouraged to provide a mechanism for authors to find elements that

derived from the content model of its parent element: the elements required in the part of the

content model that is 'transparent' are the same elements as required in the part of the content

model of the parent of the transparent element in which the transparent element finds itself.

of text with one or more sentences that discuss a particular topic, as in typography, but can also

complicating matters, since those elements, with their hybrid content models, can straddle

of sibling phrasing content nodes uninterrupted by other types of content, in an

node that is neither embedded content nor inter-element whitespace, a

ins, del, and map elements.) Conformance checkers may warn authors of cases where they have paragraphs that overlap each

would otherwise not be any content other than phrasing content to separate the paragraphs from

elements (even those not defined in this specification): These attributes are only defined by this specification as attributes for HTML

The WHATWG DOM standard defines the user agent requirements for the class, id, and slot

attribute must have a value that is a set of space-separated tokens representing the

attribute's value matches that slot attribute's value — but only

To enable assistive technology products to expose a more fine-grained interface than is

for assistive technology products can be specified (the ARIA role and aria-* attributes).

[ARIA] The following event handler content attributes may be specified on any HTML element: The attributes marked with an asterisk have a different meaning when specified on

body elements as those elements expose event handlers of the

For example, only media elements will ever receive a volumechange event fired by the user agent.

HTML element, to store custom data, state, annotations, and

In HTML documents, elements in the HTML namespace may have an xmlns attribute specified, if, and only if, it has the exact value 'http://www.w3.org/1999/xhtml'.

When parsed by an HTML parser, the attribute ends up in no namespace, not the 'http://www.w3.org/2000/xmlns/' namespace like namespace declaration attributes in

discouraged as many user agents do not expose the attribute in an accessible manner as required by

this specification (e.g., requiring a pointing device such as a mouse to cause a tooltip to

appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern

If this attribute is omitted from an element, then it implies that the title attribute of the nearest ancestor HTML element with a title attribute set is also

primary language for the element's contents and for any of the element's attributes that contain

If both the lang attribute in no namespace and the lang attribute in the XML namespace are specified on the same

The attribute in no namespace with no prefix and with the literal localname 'xml:lang' has no effect on language processing.

To determine the language of a node, user agents must look at the nearest ancestor

element (including the element itself if the node is an element) that has a lang attribute in the XML

namespace are set on an element, user agents must use the lang attribute in the XML

attribute set, but there is a pragma-set default language set, then that is the

higher-level protocol reports multiple languages, the language of the node is unknown, and the

round-tripping or communicating with other services that expect language tags, user agents should

pass unknown language tags through unmodified, and tagged as being BCP 47 language tags, so that

subsequent services do not interpret the data as another type of language description.

a Web browser and screen reader working in unison communicated about the language of the element,

the browser would tell the screen reader that the language was 'xyzzy', even if it knew it was

invalid, just in case the screen reader actually supported a language with that tag after all.

Even if the screen reader supported both BCP 47 and another syntax for encoding language names,

and in that other syntax the string 'xyzzy' was a way to denote the Belarusian language, it would

be incorrect for the screen reader to then start treating text as Belarusian, because

'xyzzy' is not how Belarusian is described in BCP 47 codes (BCP 47 uses the code 'be' for

the selection of appropriate fonts or pronunciations, for dictionary selection, or for the user

attribute that is used to specify whether an element's attribute values and the values of

its Text node children are to be translated when the page is localized, or whether to

there is a third state, the inherit state, which is the missing value default (and

values of its Text node children are to be left as-is when the page is localized,

The following attributes are translatable attributes: Other specifications may define other attributes that are also translatable

return true if the element's translation mode is translate-enabled, and

On setting, it must set the content attribute's value to 'yes' if the new value is true, and set the content attribute's value to 'no' otherwise.

The attribute is an enumerated attribute with the following keywords and states: Indicates that the contents of the element are explicitly directionally isolated

that the direction is to be determined programmatically using the contents of the element (as

character with a strong directionality, in a manner analogous to the Paragraph Level

last resort when the direction of the text is truly unknown and no better server-side heuristic

The directionality of an element (any element, not just an HTML element) is either 'ltr' or 'rtl', and is determined as per the first appropriate set of steps from

bidirectional character type AL or R, and there is no character of bidirectional character type

string, or if the element is a document element, the directionality of

Find the first character in tree order that matches the following criteria: If such a character is found and it is of bidirectional character type AL or R, the

to be included in the rendering in some manner, is determined as per the first appropriate set of

steps from the following list: Find the first character (in logical order) of the attribute's value that is of bidirectional

The following attributes are directionality-capable attributes: Returns the html element's dir attribute's value, if any.

Can be set, to either 'ltr', 'rtl', or 'auto' to replace the html element's dir attribute's value.

If there is no html element, returns the empty string and ignores new values.

attribute to indicate text direction rather than using CSS, since that way their documents will

[CSSATTR] In user agents that support CSS, the attribute's value must be parsed when the attribute is

value, then the style rules defined in the attribute's value must not be applied to the

and show content, or to convey meaning that is otherwise not included in the document, is

custom data attribute is an attribute in no namespace whose name starts with the

data, state, annotations, and similar, private to the page or application, for which there are no

independent tools, either this specification should be extended to provide the feature explicitly,

of libraries that are reused by many authors are encouraged to include their name in the attribute

make the exact name used in the attribute names customizable, so that libraries whose authors

unknowingly picked the same name can be used on the same page, and so that multiple versions of a

pairs, run the following algorithm: The supported property names on a DOMStringMap object at any instant

whose name component is name in the list returned from getting the DOMStringMap's name-value

set the value of an existing named property for a DOMStringMap, given a

property name name and a new value value, run the following steps: To delete an existing named property

name for a DOMStringMap, run the following steps: This algorithm will only get invoked by the Web IDL specification for names that

Can be set, to replace the element's children with the given value, but with line breaks

these steps: The inner text collection steps, given a node node, are

as follows: Note that descendant nodes of most replaced elements (e.g., textarea,

elements that allow free-form text, may contain characters in the ranges U+202A to U+202E

must have, in its user agent style sheet, the rules using those properties given in this

specification's rendering section, or, alternatively, the user agent must

act as if it implemented just the aforementioned properties and had a user agent style sheet that

included all the aforementioned rules, but without letting style sheets specified in documents

override them, or, alternatively, the user agent must implement another styling language with

[CSSGC] The following elements and attributes have requirements defined by the rendering section that, due to the requirements in this section, are

determine what pronunciations to use, translation tools to determine what rules to use, and so

the attribute's value must be a valid non-empty URL potentially surrounded by

(This is a long process that takes many years.) Using the manifest attribute at this time is highly discouraged.

selection, later base elements cannot affect the parsing of URLs in manifest attributes, as

attribute provides scripted access to the offline application cache mechanism.

is used as an e-mail authoring format, the title element can be omitted.

The base element allows authors to specify the document base URL for

must come before any other elements in the tree that have attributes defined as taking URLs, except the html element (its manifest attribute isn't affected by base

contain a valid browsing context name or keyword, which specifies which

browsing context is to be used as the default when hyperlinks and forms in the

base element that is the first base element with an href content attribute in a document tree has a

situations occur: To set the frozen base URL for an element element:

The href IDL attribute, on setting, must set the href content attribute to the given new value.

The destination of the link(s) is given by the href attribute, which must be present and must contain a

The types of link indicated (the relationships) are given by the value of the rel attribute, which, if present, must have a value that is a

used are allowed according to the definitions in this specification, then the element does not

tokens must only include the tokens from this list that the user agent implements the

Theoretically a user agent could support the processing model for the canonical keyword — if it were a search engine that executed

head element and in the body of the page, subject to the constraints of

Two categories of links can be created using the link element: Links to external resources and hyperlinks.

whether a particular link type is an external resource or a hyperlink.

element can create multiple links (of which some might be external resource links and some might be hyperlinks);

they each count as a separate external resource, and each is affected by its own attributes

and area elements, which indicates the type of a link whose context is given by the

For external resource links, the type attribute is used as a hint to user agents so that they can

It is intended for use with external resource links, where it helps set the referrer policy

sheet links that are in a document tree, for which the title attribute defines CSS

elements in that a link without a title does not inherit the title of the parent element: it

attribute must have a value that is an unordered set of unique space-separated tokens

must not be specified on link elements that do not have a rel attribute that specifies the icon

The apple-touch-icon keyword is a registered extension to the predefined set of link types, but user

attribute must be specified on link elements that have a rel attribute that contains the preload keyword.

<color> production, defining a suggested color that user agents can use to

customize the display of the icon that the user sees when they pin your site.

The mask-icon keyword is a registered extension to the predefined set of link types, but user

attribute is purely advisory, and describes for which media the document in question was

resource link type has a default type defined, then the user agent must assume that the

the appropriate time as specified for the external resource link's particular type.

If the attribute is omitted, and the external resource link type does not have a

the resource if the type was known and supported, then the user agent should obtain the resource under the assumption that it will be

authoritative — upon fetching the resource, user agents must not use the type attribute to determine its actual type.

(as defined in the next paragraph) is used to determine whether to apply the resource,

Otherwise, if the resource is expected to be an image, user agents may apply the

if the user agent opts not to apply the image sniffing rules, then the user agent must use the

default type defined, then the user agent must assume that the resource is of that type.

Once the user agent has established the type of the resource, the user agent must apply the

resource if it is of a supported type and the other relevant conditions apply, and must ignore the

representation must be made available (modulo cross-origin restrictions) even if the resource is

run the following steps: User agents may opt to only try to obtain such resources when they are needed, instead of

resource to not be applied.) Once the attempts to obtain the resource and its critical subresources are

complete, the user agent must, if the loads were successful, queue a task to

connection being prematurely closed, unsupported Content-Type), queue a task to fire an event named error at

element must delay the load event of the element's node document until

resource to be needed, do not delay the load event.) HTTP `Link` headers, if supported, must be assumed to come

headers are to be processed according to the rules given in the relevant specifications.

Interactive user agents may provide users with a means to follow the hyperlinks created using the link element, somewhere

could include the following information (obtained from the element's attributes, again as defined

with each link element in the document: User agents could also include other information, such as the type of the resource (as given by

The activation behavior of link elements that create hyperlinks is to follow the

The meta element can represent document-level metadata with the name attribute, pragma directives with the http-equiv attribute, and the file's character encoding

meta element has no effect in XML documents, but is allowed in XML documents in order

If a meta element has no content attribute, then the value part of the metadata name-value

The value must be a short free-form string giving the name of the Web application that the

Translations of the Web application's name may be given, using the lang attribute to specify the language of each name.

and with its name attribute set to the value application-name per document.

title, since the title might include status messages and the like relevant to the

status of the page at a particular moment in time instead of just being the name of the

To find the application name to use given an ordered list of languages (e.g.

American English, and English), user agents must run the following steps: This algorithm would be used by a browser when it needs a name for the page, for

The value must be a free-form string that identifies one of the software packages used to

historically been used unreliably and even misleadingly as a way to spam search engine results

To obtain the list of keywords that the author has specified as applicable to the page, the

user agent must run the following steps: User agents should not use this information when there is insufficient confidence in the

the keyword information of pages within the system to populate the index of a site-specific

search engine, but a large-scale content aggregator that used this information would likely find

that certain users would try to game its ranking mechanism through the use of inappropriate

meta elements have their name or content attributes changed, user agents must run the

following algorithm: The value must be a string that matches the CSS <color> production, defining

a suggested color that user agents should use to customize the display of the page or of the

specified value, or use it as a color highlight in a tab bar or task switcher.

There must not be more than one meta element with its name attribute set to the value theme-color per document.

To obtain a page's theme color, user agents must run the following steps: If any meta elements are inserted into the document or removed from the document, or existing meta elements have their

attributes changed, user agents must re-run the above algorithm and apply the result to any

the theme color as a background and display white text over it, it might use a darker variant of

the theme color in that part of the UI, to ensure adequate contrast.

However, a new metadata name should not be created in any of the following cases: Also, before creating and using a new metadata name, consulting the WHATWG Wiki MetaExtensions page is

encouraged — to avoid choosing a metadata name that's already in use, and to avoid duplicating the

purpose of any metadata names that are already in use, and to avoid new standardized names

One of the following: If a metadata name is found to be redundant with existing values, it should be removed and

If a metadata name is added in the 'proposed' state for a period of a month or more without

If a metadata name is added with the 'proposed' status and found to be redundant with

existing values, it should be removed and listed as a synonym for the existing value.

metadata name is added with the 'proposed' status and found to be harmful, then it should be

given in the first cell of the rows with keywords give the states to which those keywords map.

present and represents one of the above states, then the user agent must run the algorithm

appropriate for that state, as described in the following list: This feature is non-conforming.

successfully processed, there is no pragma-set default language.

agent requirements are all handled by the parsing section of the specification.

that is an ASCII case-insensitive match for a string that consists of: the literal

string 'text/html;', optionally followed by any number of ASCII

whitespace, followed by the literal string 'charset=utf-8'.

document must not contain both a meta element with an http-equiv attribute in the Encoding declaration state and a

used in HTML documents, but elements with an http-equiv attribute in that state must not be used in

document, string input, and optionally a meta element

meta, are as follows: For meta elements with an http-equiv

attribute in the Refresh state, the content attribute must have a value consisting either of: In the former case, the integer represents a number of seconds before the page is to be

in the latter case the integer represents a number of seconds before the page is to be

policy state, the content attribute must have a

The Content Security Policy given in the content attribute will be enforced upon the current document.

character encoding declaration is a mechanism by which the character encoding used to store or transmit a document is specified.

character encoding declaration is present or not, the actual character encoding used to encode the document must be

The following restrictions also apply: In addition, due to a number of restrictions on meta elements, there can only be

metadata, and the document is not an iframe srcdoc document, then the encoding must be specified

this case, the source is already decoded, since it is part of the document that contained the

iframe.) In XML, the XML declaration should be used for inline character encoding information, if

The style element allows authors to embed CSS style sheets in their documents.

value matches the environment and the other relevant conditions apply, and must not

attribute is omitted, is 'all', meaning that by default styles apply to all

style block without a title does not inherit the title of the parent element: it

The user agent must run the update a style block algorithm whenever

one of the following conditions occur: The update a style block algorithm is as follows: Once the attempts to obtain the style sheet's critical subresources, if any, are

complete, or, if the style sheet has no critical subresources, once the style sheet

has been parsed and processed, the user agent must, if the loads were successful or there were

sheet's critical subresources failed to completely load for any reason (e.g.

error, HTTP 404 response, a connection being prematurely closed, unsupported Content-Type),

queue a task to fire an event named error at the style element.

The element must delay the load event of the element's node document until all the

attempts to obtain the style sheet's critical subresources, if any, are complete.

[CSSOM] Style sheets, whether added by a link element, a style element, an

some other mechanism, have a style sheet ready flag, which is initially unset.

When a style sheet is ready to be applied, its style sheet ready flag must be set.

style element with no @import rules), then the style rules must

to script once the event loop reaches its update the rendering step.

the following conditions occur: Giving up on a style sheet before the style sheet loads, if the style sheet

eventually does still load, means that the script might end up operating with incorrect

For example, if a style sheet sets the color of an element to green, but a script

that inspects the resulting style is executed before the sheet is loaded, the script will find

that the element is black (or whatever the default color is), and might thus make poor choices

have to balance the likelihood of a script using incorrect information with the performance impact

The body element exposes as event handler content attributes a number

element, replace the generic event handlers with the same names normally supported by

then would it trigger the onerror event handler content attribute on the

composition in a document, page, application, or site and that is, in principle, independently

newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any

represent articles that are in principle related to the contents of the outer article.

instance, a blog entry on a site that accepts user-submitted comments could represent the comments

as article elements nested within the article element for the blog

sidebars) is all one single self-contained composition, that content may be marked with an

pages or to parts within the page: a section with navigation links.

the element is primarily intended for sections that consist of major navigation blocks.

particular, it is common for footers to have a short list of links to various pages of a site,

navigation information being immediately available, can use this element as a way to determine

content that is tangentially related to the content around the aside element, and

The element can be used for typographical effects like pull quotes or sidebars, for

element is said to have the highest rank, the h6 element has the lowest rank, and two

hgroup element indicate subheadings or subtitles or (secondary) alternative

contains information about its section such as who wrote it, links to related documents, copyright

When the footer element contains entire sections, they represent appendices, indexes, long colophons, verbose license

p element is the appropriate element for marking up postal addresses in general.) The address element must not contain information other than contact

address elements defined by the first applicable entry from the following list: The contact information consists of all the address elements that have node as an ancestor and do not have another body or

article element ancestor that is a descendant of node.

the nearest article or body element ancestor, whichever is

purposes, such as indexing sections based on the sections' contact information.

or higher rank start new (implied) sections, headings of lower rank

but the sections and headings inside these elements do not contribute to the outlines of their

ancestor sectioning root or their nearest ancestor element of sectioning

content, whichever is nearest, regardless of what implied sections other headings may have

content, instead of relying on the implicit sections generated by having multiple headings

of a DOM tree, in tree order, with each node being visited when it is entered and when it

root element consists of a list of one or more potentially nested sections.

associates each node in the DOM tree with a particular section and potentially a heading.

(The sections in the outline aren't section elements, though some may correspond to

such elements — they are merely conceptual sections.) The algorithm that must be followed during a walk of a DOM subtree rooted at a sectioning

content element or a sectioning root element to determine that element's

outline is as follows: The tree of sections created by the algorithm above, or a proper subset thereof, must be used

when generating document outlines, for example when generating tables of contents.

When creating an interactive table of contents, entries should jump the user to the relevant

The outline depth of a heading content element associated with a section section is the number of sections that are ancestors of section in the

outermost outline that section finds itself in when the outlines of its Document's elements are created, plus 1.

outline depth of a heading content element not associated with a section is 1.

User agents are encouraged to expose page outlines to users to aid in navigation.

content, user agents are also encouraged to offer a mode that navigates the page using

juicy, green apples make a great filling for apple pies.';

On the other hand, one could imagine a tweet or reddit comment or tumblr post or newspaper

While paragraphs are usually represented in visual media by blocks of text that

are physically separated from adjacent blocks through blank lines, a style sheet or user agent

would be equally justified in presenting paragraph breaks in a different manner, for instance

a scene change in a story, or a transition to another topic within a section of a

Some examples of cases where the pre element could be used: Authors are encouraged to consider how preformatted text will be experienced when

the formatting is lost, as will be the case for users of speech synthesizers, braille displays,

To represent a block of computer code, the pre element can be used with a

within a pre element to indicate text that the user is to enter.

corresponding citation link, the value of the attribute must be parsed relative to the element's node document.

allow users to follow such citation links, but they are primarily intended for private use (e.g.,

by server-side scripts collecting statistics about a site's use of quotations), not for

intentionally ordered, such that changing the order would change the meaning of the document.

an integer determined as follows: The type attribute can be used to specify the kind

attribute represents the state given in the cell in the second column of the row whose first cell

User agents should render the items of the list in a manner consistent with the state of the

or equal to zero should always use the decimal system regardless of the type attribute.

section (the mapping is straightforward: the states above have the same names as their

It is possible to redefine the default CSS list styles used to implement this

where the start content attribute is omitted and the reversed content attribute is specified.

items is not important — that is, where changing the order would not materially change the

the form of an unordered list of items (represented by li elements), each of

ol, ul, or menu element, then the element is an item of the

list owner, which is determined as follows: To determine the ordinal value of each element owned by a given list

owner owner, perform the following steps: The value IDL attribute must reflect

heading starts a new section, so a heading in a list implicitly splits the list into spanning

The dl element represents an association list consisting of zero or

(dt elements, possibly as children of a div element child) followed by

one or more values (dd elements, possibly as children of a div element

child), ignoring any nodes other than dt and dd element children, and

The order of the list of groups, and of the names and values within each group, may be

attributes that apply to whole groups, or just for styling purposes, each group in a

The name-value groups of a dl element dl are determined using the

empty) and a value (a list of dd elements, initially empty).

follow these steps: When a name-value group has an empty list as name or value, it is often due to

accidentally using dd elements in the place of dt elements and vice

not indicate that its contents are a term being defined, but this can be indicated using the

The element can thus be used to annotate illustrations, diagrams, photos, code listings,

the page is to display the figure, for example a photograph on an image sharing site, the

figure and figcaption elements can be used to explicitly provide a

purpose than the surrounding flow, the aside element should be used (and can itself

the div element leads to better accessibility for readers and easier maintainability

happens when users follow hyperlinks or download hyperlinks created using the a

attributes may be used to indicate to the user the likely nature of the target resource before the

The activation behavior of a elements that create hyperlinks is to run the following steps: Same as textContent.

rel, hreflang, and type, must reflect the respective content attributes

The level of stress that a particular piece of content has is given by its number of ancestor

which the hgroup element is appropriate.) For example, the first word of the previous paragraph is marked up with

The relative level of importance of a piece of content is given by its number of ancestor

Small print typically features disclaimers, caveats, legal restrictions, or

text emphasized by the em element or marked as important with the strong

page listing terms of use, for instance, would not be a suitable candidate for the

small element: in such a case, the text is not a side comment, it is the main content

mark a span of text as having been removed from a document, use the del element.

person's name is not the title of a work — even if people call that person a piece of

work — and the element must therefore not be used to mark up people's names.

names of famous people are keywords rendered with a different style to draw attention to them.

Content inside a q element must be quoted from another source, whose address, if

links, but they are primarily intended for private use (e.g., by server-side scripts collecting

The paragraph, description list group, or section that is the nearest ancestor of the dfn

Defining term: if the dfn element has a title attribute, then the exact value of that attribute

Text nodes, and that child element is an abbr element with a title attribute, then the exact value of that attribute is

If an abbreviation is pluralized, the expansion's grammatical number (plural vs singular) must

The ruby element allows one or more spans of phrasing content to be marked with

Ruby annotations are short runs of text presented alongside base text, primarily

sequences: The ruby and rt elements can be used for a variety of kinds of

annotations, including in particular (though by no means limited to) those described below.

content is segmented and segments are placed into three categories: base text segments, annotation

latter of which are used for legacy user agents that do not support ruby at all).

segments can overlap (with a limit of two segments overlapping any one position in the DOM, and

with any segment having an earlier start point than an overlapping segment also having an equal or

later end point, and any segment have a later end point than an overlapping segment also having an

segment can be associated with a base text segment, and each base text segment can have annotation

at least one annotation segment, and each annotation segment is associated with one base text

segment.) A ruby element represents the union of the segments of base

text it contains, along with the mapping from those base text segments to annotation segments.

element is the result that would be obtained from running the following algorithm: When the steps above say to set the current base text, it means to run the following

steps at that point in the algorithm: When the steps above say to push a ruby level, it means to run the following steps

at that point in the algorithm: When the steps above say to pop a ruby level, it means to run the following steps at

that point in the algorithm: When the steps above say to push a ruby annotation, it means to run the following

steps at that point in the algorithm: The rt element marks the ruby text component of a ruby annotation.

text component of a ruby annotation, to be shown by user agents that don't support ruby

whose parent element is not a ruby element represents its

this specification, the element serves to provide both a machine-readable value for the purposes

of data processors, and a human-readable value for the purposes of rendering in a Web browser.

script has a literal value to store alongside a human-readable value.

The kind of content is limited to various kinds of dates, times, time-zone offsets, and

that are observed at the same specific time in each time zone, throughout a day.

the 2020 new year is celebrated at 2020-01-01 00:00 in each time zone, not at the same precise

example a videoconference meeting, a valid global date and time string is likely

dates), specifying the geographic location that controls the time is usually more useful than

specifying a time zone offset, because geographic locations change time zone offsets with

boundaries of those time zones are redrawn, as happened with Samoa at the end of 2011.

exists a time zone database that describes the boundaries of time zones and what rules apply

within each such zone, known as the time zone database.

events, or recurring virtual events where the time is not anchored to a specific geographic

For example, the precise time of an asteroid impact, or a particular meeting in a

series of meetings held at 1400 UTC every day, regardless of whether any particular part of the

world is observing daylight saving time or not.

local time zone offset of a specific geographic location, a valid local date and time

string combined with that geographic location is likely more useful.

element's datetime value by using the following algorithm: The algorithms referenced above are intended to be designed such that for any

efficient approach might be to create a single algorithm that parses all these data types in one

be an XML element name, a file name, a computer program, or any other string that a computer would

wish to mark code elements with the language used, e.g.

variable in a mathematical expression or programming context, an identifier representing a

constant, a symbol identifying a physical quantity, a function parameter, or just be a term used

The kbd element represents user input (typically keyboard input,

input based on system output, for example invoking a menu item.

represents an actual key or other single unit of input as appropriate for the input mechanism.

The sub element can be used inside a var element, for variables that

mood, or otherwise offset from the normal prose in a manner indicating a different quality of

text, such as a taxonomic designation, a technical term, an idiomatic phrase from another

Terms in languages different from the main text should be annotated with lang attributes (or, in XML, lang attributes in the XML namespace).

element to identify why the element is being used, so that if the style of a particular use (e.g.

dream sequences as opposed to taxonomic terms) is to be changed at a later date, the author

doesn't have to go through the entire document (or series of related documents) annotating each

i element, for instance the em element for marking up stress emphasis,

drawn for utilitarian purposes without conveying any extra importance and with no implication of

an alternate voice or mood, such as key words in a document abstract, product names in a review,

actionable words in interactive text-driven software, or an article lede.

attribute on the b element to identify why the element is being used, so that if the

style of a particular use is to be changed at a later date, the author doesn't have to go through

stress emphasis should use the em element, importance should be denoted with the

explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in

b element or the mark element should be used, depending on the context;

transliteration, a thought, or for labeling ship names in Western texts, the i

The mark element represents a run of text in one document marked or

indicates a highlight that was not originally present but which has been added to bring the

reader's attention to a part of the text that might not have been considered important by the

document that has been highlighted due to its likely relevance to the user's current activity.

[BIDI] The dir global attribute defaults to auto on this element (it never inherits from the parent element like

value ltr to specify a left-to-right override and with the value rtl to

While line breaks are usually represented in visual media by physically moving

subsequent text to a new line, a style sheet or user agent would be equally justified in causing

line breaks to be rendered in a different manner, for instance as green dots, or as extra

br elements must be used only for line breaks that are actually part of the

rel attribute, as defined for those keywords in the link types section.

Similarly, for a and area elements with an href attribute and a rel attribute, links must be created for the keywords of the

rel attribute as defined for those keywords in the link types section.

beyond linking the element's node document to the resource given by the element's href attribute.

area elements must have a value that is a valid URL potentially surrounded by

invoked, the user agent may allow the user to indicate a preference regarding whether the

to use the hyperlink to download a resource, the user agent must download the hyperlink.

indicates that the author intends the hyperlink to be used for downloading a resource.

specifies the default file name that the author recommends for use in labeling the resource in a

most file systems have limitations with regard to what punctuation is supported in file names,

area elements, impact the processing model, and are supported by the user agent.

Other specifications may add HTML link types as defined in Other link types, with the following additional requirements: The rel attribute has no default value.

attribute is omitted or if none of the values in the attribute are recognized by the user agent,

authoritative — upon fetching the resource, user agents must use only language information

associated with the resource to determine its language, not metadata included in the link to the

User agents must not consider the type attribute authoritative — upon fetching the

resource, user agents must not use metadata included in the link to the resource to determine its

An element implementing the HTMLHyperlinkElementUtils mixin has an associated set the url algorithm, which runs these steps: When elements implementing the HTMLHyperlinkElementUtils mixin are created, and

attribute set, changed, or removed, the user agent must set the url.

steps: To update href, set the element's href content attribute's value to the element's url, serialized.

run these steps: The protocol attribute's setter must run these

run these steps: The username attribute's setter must run these

run these steps: The password attribute's setter must run these

steps: The host attribute's setter must run these steps: The hostname attribute's getter must

run these steps: The hostname attribute's setter must run these

steps: The port attribute's setter must run these steps: The pathname attribute's getter must

run these steps: The pathname attribute's setter must run these

steps: The hash attribute's setter must run these steps: An element element cannot navigate if one of the following is true: This is also used by form submission for

subject, optionally with a hyperlink suffix, the user agent must run the

following steps: The task source for the tasks mentioned above is the DOM manipulation task

that a resource is intended to be downloaded for use later, rather than immediately used, the

The attribute can furthermore be given a value, to specify the file name that user agents are

attachment disposition type, to avoid the user being warned of possibly

confidential information without their full understanding.) When a user downloads a hyperlink created by an

element subject, optionally with a hyperlink suffix, the user agent must

run the following steps: When a user agent is to handle a resource obtained from a fetch as a download, it

should provide the user with a way to save the resource for later use, if a resource is

If the user agent needs a file name for a resource being handled as a download, it

files from untrusted sites, and user agents are strongly urged to follow it.

consists of any part of the file name that platform conventions dictate will be used for

name following the last dot ('.') in the file name to determine the type of

User agents should ignore any directory or path information provided by the resource itself,

deciding where to store the resulting file in the user's file system.

the value of the element's href attribute can be parsed, relative to the element's node document, without

record ping URL, ignoring tokens that fail to parse: This may be done in parallel with the primary fetch, and is independent of the

User agents should allow the user to adjust this behavior, for example in conjunction with a

Based on the user's preferences, UAs may either ignore the ping attribute altogether, or selectively ignore URLs in the

should clearly indicate to the user that following the hyperlink will also cause secondary

requests to be sent in the background, possibly including listing the actual target URLs.

For example, a visual user agent could include the hostnames of the target ping

The following table summarizes the link types that are defined by this specification, by their

In this section, the term referenced document refers to the resource identified by the

element representing the link, and the term current document refers to the resource within

area element, the element's rel attribute must be split on ASCII whitespace.

Some of the sections that follow the table below list synonyms for certain keywords.

indicated synonyms are to be handled as specified by user agents, but must

The alternate keyword modifies the meaning of the stylesheet keyword in the way described for that keyword.

alternate keyword does not create a link of its own.

The keyword creates a hyperlink referencing a syndication feed (though not

necessarily syndicating exactly the same content as the current page).

elements in the document with the alternate keyword used and

with their type attribute set to the value application/rss+xml or the value application/atom+xml.

syndication feed, the first such element (in tree order) should be used as the

If the alternate keyword is used with the hreflang attribute, and that attribute's value differs

from the document element's language, it indicates that the referenced

If the alternate keyword is used with the type attribute, it indicates that the referenced document is

a reformulation of the current document in the specified format.

with the link type 'alternate', then, in addition to implying

that those documents are alternative representations of the first document, it is also implying

keyword indicates that the referenced document provides further information about the author of

the nearest article element ancestor of the element defining the hyperlink, if there

that the referenced document provides further information about the author for the page as a

link, a, and area elements that have a rev attribute with the value 'made' as having the author keyword specified as a link relationship.

ancestor article element of the linking element in question, or of the section the linking element is most closely associated with, if

The canonical keyword indicates that URL given by the href attribute is the preferred URL for the current document.

helps search engines reduce duplicate content, as described in more detail in The Canonical

beneficial, as it is highly likely that the user will require resources located at that

origin, and the user experience would be improved by preempting the latency costs

This keyword does not create a hyperlink, but annotates any other hyperlinks created by the element (the

document that is not part of the site that the current document forms a part of.

keyword indicates that the referenced document provides further help information for the parent of

For a and area elements, on some browsers, the help keyword causes the link to use a different cursor.

The specified resource is an icon representing the page or site, and should be used by the user

multiple icons are provided, the user agent must select the most appropriate icon according to the

user agents must use the last one declared in tree order at the time that the user

unsupported format), then the user agent must try the next-most-appropriate icon as determined by

User agents are not required to update icons when the list of icons changes, but

The sizes keywords represent icon sizes in raw pixels (as

displays with a device pixel density of two device pixels per CSS pixel

different resource is to be used for small high-resolution icons vs large low-resolution icons

To parse and process the attribute's value, the user agent must first split the attribute's value on ASCII whitespace, and must then

Other keywords must be further parsed as follows to determine what they represent: The keywords specified on the sizes attribute must not

represent icon sizes that are not actually available in the linked resource.

instead run these steps in parallel: For historical reasons, the icon keyword may be preceded by the

ASCII case-insensitive match for the string 'shortcut icon' (with a single U+0020 SPACE character between the tokens and

provides the copyright license terms under which the main content of the current document is

fetch behavior for module scripts (including, e.g., a different interpretation of the crossorigin attribute), and places the result into the

contrast, a similar external resource link using the preload keyword would place the result in the preload cache, without

Additionally, implementations can take advantage of the fact that module scripts declare their dependencies in order to fetch the specified module's

observable without using technology such as service workers, or monitoring on the server side.

Notably, the appropriate load or error events will occur after the specified module is fetched, and

The appropriate times to fetch the resource for such a link are: Unlike some other link relations, changing the relevant attributes (such as as, crossorigin, and

This keyword does not create a hyperlink, but annotates any other hyperlinks created by the element (the

by the original author or publisher of the page, or that the link to the referenced document was

included primarily because of a commercial relationship between people affiliated with the two

This keyword does not create a hyperlink, but annotates any other hyperlinks created by the element (the

The keyword indicates that any newly created browsing context which results from

following the hyperlink will be disowned, which means that its window.opener attribute will be null.

This keyword does not create a hyperlink, but annotates any other hyperlinks created by the element (the

If a user agent follows a link defined by an a or area element that

keyword when present on a hyperlink that creates a new browsing context.

beneficial, as it is highly likely that the user will require resources located at that

origin, and the user experience would be improved by preempting the latency costs

The prefetch keyword indicates that preemptively fetching and caching the specified resource is likely to be

as attribute (and the priority associated with the corresponding destination), as it is highly likely that the user

provides an interface specifically for searching the document and its related resources.

the search link type to enable user agents to autodiscover search

supported style sheet type, the user agent must instead assume it to be text/css.

sequence, and that the link is leading to the document that is the next logical document in the

element, user agents should implement one of the processing models described in Resource

example, a user agent may wish to use the less-costly preconnect hint when trying to conserve data, battery power, or

processing power, or may wish to pick a resource hint depending on heuristic analysis of past

sequence, and that the link is leading to the document that is the previous logical document in

One of the following: If a keyword is found to be redundant with existing values, it should be removed and listed

values, it should be removed and listed as a synonym for the existing value.

added with the 'proposed' status and found to be harmful, then it should be changed to

existing-rel-values page to establish if a value is allowed or not: values defined in this

specification or marked as 'proposed' or 'ratified' must be accepted when used on the elements for

conformance checkers should offer to add the value to the Wiki, with the details described above,

wiki existing-rel-values page with the status 'proposed' or 'ratified' may be used with the

document is long, for instance the minutes of a meeting, authors are encouraged to include a fragment pointing to the specific part of that document that

the corresponding citation link, the value of the attribute must be parsed relative to the element's node document.

allow users to follow such citation links, but they are primarily intended for private use (e.g.,

by server-side scripts collecting statistics about a site's edits), not for readers.

If the given value is a global date and time then user agents should use the associated

time-zone offset information to determine which time zone to present the given datetime in.

Since the ins and del elements do not affect paragraphing, it is possible, in some cases where paragraphs are implied (without explicit p elements), for an

ins or del element to span both an entire paragraph or other

paragraph, a whole second paragraph, and the start of a third paragraph to be covered by the same

good practice): However, due to the way implied paragraphs are defined, it is

not possible to mark up the end of one paragraph and the start of the very next one using the same

element(s) and two ins or del elements, as for example: Partly because of the confusion described above, authors are strongly encouraged to always mark

The elements that form part of the table model have complicated content model requirements that

do not allow for the ins and del elements, so indicating edits to a

To indicate that an entire row or an entire column has been added or removed, the entire

contents of each cell in that row or column can be wrapped in ins or del

to allow authors to declaratively control or give hints to the user agent about which image resource to use,

based on the screen pixel density, viewport size, image format, and other factors.

has no meaning when the element is nested within a picture element, and the resource

it merely provides a context for its contained img element that enables it

element or a media element: The srcset attribute must be present, and

The srcset attribute contributes the image sources to the source set, if the

If the srcset attribute has any image candidate strings using a width descriptor, the sizes attribute must also be present, and is a

contributes the source size to the source set, if the

If present, the value must contain a valid media query list.

skip to the next source element if the value does not match the environment.

source set, to allow the user agent to skip to the next source element

specified, the user agent will not select a different source element if it finds

that it does not support the image format after fetching it.

specified, it must have at least one of the following: The src attribute must not be present.

element is already inserted in a video or audio element will have no

attribute on the media element directly, possibly making use of the canPlayType() method to pick from amongst available

resource, to help the user agent determine if it can play this media

MIME types define, might be necessary to specify exactly how the resource is encoded.

attribute and whose networkState has the value NETWORK_EMPTY, the user agent must invoke the media

The IDL attributes src, type, srcset, sizes and media must reflect the respective

valid non-empty URL potentially surrounded by spaces referencing a non-interactive,

optionally animated, image resource that is neither paged nor scripted.

JPEGs), single-page vector documents (single-page PDFs, XML files with an SVG document element),

animated bitmaps (APNGs, animated GIFs), animated vector graphics (XML files with an SVG

definitions preclude SVG files with script, multipage PDF files, interactive MNG files, HTML

If the srcset attribute is present and has any image candidate strings using a width

attribute contributes the source size to the source set (if no

elements should not be used to display transparent images, as such images rarely convey meaning and

to display that image, then the element represents the element's image data.

gives a textual equivalent or replacement for the image.

to display that image, then the element represents the element's image data.

In a conforming document, the absence of the alt attribute indicates that the image is a key part of the content

but that a textual replacement for the image was not available when the image was generated.

to display that image, then the element represents the element's image data.

is not being rendered, and may, if requested by the user, or if so configured, or when required

to provide contextual information in response to navigation, provide caption information for the

image, derived as follows: The element represents nothing.

User agents may always provide the user with the option to display any image, or to prevent any

optical character recognition (OCR) of text found within the image.

While user agents are encouraged to repair cases of missing alt attributes, authors must not rely on such behavior.

These attributes return the actual rendered dimensions of the

image in parallel, returning a promise that fulfills when decoding is complete.

Returns a new img element, with the width and height attributes set to the values

The IDL attributes width and height must return the rendered width and height of the

resources that the user agent can choose from: The above situations are not mutually exclusive.

While it is possible to solve these problems using scripting, doing so introduces some other

problems: With this in mind, this specification introduces a number of features to address the above

attributes on the img element can be used, using the x

descriptor, to provide multiple images that only vary in their size (the smaller image is a

size of the image depends on the viewport width

(viewport-based selection), but can be used together with

descriptor, to provide multiple images that only vary in their size (the smaller image is a

The picture element and the source element, together with the media attribute, can be used, to provide multiple images that

vary the image content (for instance the smaller image might be a cropped version of the bigger

can be used, to provide multiple images in different formats.

CSS and media queries can be used to construct graphical page layouts that adapt dynamically to

as the page is loading, CSS and CSS media queries can be used to provide the dimensions: Alternatively, the width and height attributes can be used to provide the width for legacy user

agents, using CSS just for the user agents that support picture: The img element is used with the src attribute,

which gives the URL of the image to use for legacy user agents that do not support the

If the author wants the biggest image in legacy user agents, the markup could be as

follows: However, if legacy mobile user agents are more important, one can list all three images in the

ignored entirely by picture-supporting user agents, the src attribute can default to any image, including one that is neither

the smallest nor biggest: Above the max-width media feature is used, giving the maximum

after the URL, the following image candidate string, if there is one, must begin with

An image candidate string consists of the following components, in order, with the

further restrictions described below this list: There must not be an image candidate string for an element that has the same

width descriptor value as another image candidate string's width

pixel density descriptor value as another image candidate string's

requirement, an image candidate string with no descriptors is equivalent to an

If an element has a srcset attribute present, all image candidate strings for that element must have the width

valid source size list is a string that matches the following grammar:

When an img element's current request's state is completely available and the

user agent can decode the media data without errors, then the img element is said to

When an img element's current request is available, the img element provides a paint

source whose width is the image's density-corrected intrinsic width (if any), whose height is the image's density-corrected intrinsic height

element's image data must be treated as if its resolution, in device pixels per CSS pixels, was the current pixel density.

density-corrected intrinsic width and height are the intrinsic width and height after taking into account the current pixel

ok status) must be ignored when determining the image's type and whether it is a

disabled, user agents may obtain images immediately or on demand.

user agent that obtains images on demand must update the image data of an

img element whenever it needs the image data (i.e., on demand), but only if the

img element has experienced relevant mutations, if the user agent only

obtains images on demand, the img element's current request's state must return to unavailable.

The relevant mutations for an img element are as follows: Each Document object must have a list of available images.

Document is created, user agents can add to it all the images that are loaded in

doing so, and must unset the ignore higher-layer caching flag for the copied entry.

User agents must remove entries in the list of available images as appropriate

previously been loaded, and to avoid re-downloading images in the same document even when they

The user agent can also store the image data separately from the list of available images.

caching flag is unset, the user agent would remove it from the list of available

images but could keep the image data separately, and use that if the server responds with a

user agent to present the image to the screen, the data needs to be decoded.

when to perform decoding, in order to create the best user experience.

In order to aid the user agent in deciding whether to perform synchronous or asynchronous

hint keywords: When decoding an image, the user agent should

If the state indicated is auto, then the user agent is free to choose any

Since the decode() method performs decoding independently from the process responsible for

strong reference from the element's node document to the element x, even

To abort the image request for an image request image request means to run the following steps: To upgrade the pending request to the current request for an img element means to run the following steps: To fire a progress event or event named type at an element e,

depending on resource r, means to fire a progress event named

When asked to select an image source for a given img element el,

user agents must do the following: When asked to update the source set for a given img element el,

user agents must do the following: Each img element independently considers its previous sibling

source elements plus the img element itself for selecting an image

source, ignoring any other (invalid) elements, including other img elements in

When asked to parse a srcset attribute from an element, parse the value of the

element's srcset attribute as follows: When asked to parse a sizes attribute from an element, with a fallback width

width, parse a comma-separated list of component values from the value of

the element's sizes attribute (or the empty string, if the attribute is

[CSSSYNTAX] For each unparsed size in unparsed sizes list: If the above algorithm exhausts unparsed sizes list without returning a

size value, follow these steps: While a valid source size list only contains a bare <source-size-value>

and protect against simple author errors such as a final trailing comma.

set gives every image source a pixel density descriptor.

densities of a source set source set, the user agent must do the

following: The user agent may at any time run the following algorithm to update an img

more, the user agent might want to wait until the user has returned to the page before determining

which image to use, in case the environment changes again in the meantime.) User agents are encouraged to run this algorithm in particular when the user changes

document, so that the density-corrected intrinsic width and height match the

new viewport, and so that the correct image is chosen when art direction

The most general rule to consider when writing alternative text is the following: the

never contain text that could be considered the image's caption, title, or

containing the image to someone over the phone, without mentioning that there is an image present.

element, has no textual content but contains one or more images, the alt attributes must contain text that together convey the purpose of

are using a text-only browser, or because they are listening to the page being read out by a

hands-free automobile voice Web browser, or simply because they are blind) are still able to

Many pages include logos, insignia, flags, or emblems, which stand for a particular entity such

as a company, organization, project, band, software package, country, or some such.

as a page heading, the alt attribute must contain the name of the entity being represented by

If the logo is merely used as decorative material (as branding, or, for example, as a side

image in an article that mentions the entity to which the logo belongs), then the entry below on

actual typographic effects used to render the text, but just to convey the text itself.

for example gaiji, itaiji, or new characters such as novel currency symbols, the alternative text

cannot be directly represented using text, e.g., because of decorations or because there is no

In many cases, the image is actually just supplementary, and its presence merely reinforces the

In general, an image falls into this category if removing the image doesn't make the page any

less useful, but including the image makes it a lot easier for users of visual browsers to

empty string, or a textual representation of the information that the image conveys.

If an image is decorative but isn't especially page-specific — for example an image that

forms part of a site-wide design scheme — the image should be specified in the site's CSS,

When a picture has been sliced into smaller image files that are then displayed together to

form the complete picture again, one of the images must have its alt attribute set as per the relevant rules that would be appropriate

for the picture as a whole, and then all the remaining images must have their alt attribute set to the empty string.

sole contents of links, then one image per link must have alternative text in its alt attribute representing the purpose of the link.

How to provide alternative text for an image that is a key part of the content depends on the

When it is possible for detailed alternative text to be provided, for example if the image is

part of a series of screenshots in a magazine review, or part of a comic strip, or is a

photograph in a blog entry about that photograph, text that can serve as a substitute for the

image must be given as the contents of the alt attribute.

suitable alternative text, but it may be somewhat brief.

because the image is obtained in some automated fashion without any associated alternative text

where the user did not provide suitable or usable alternative text (e.g.

sites), or because the author does not themself know what the images represent (e.g.

the following conditions must be met as well: Such cases are to be kept to an absolute minimum.

possibility of the author having the ability to provide real alternative text, then it would not

connection, or because they are using a text-only browser, or because they are listening to the

page being read out by a hands-free automobile voice Web browser, or simply because they are

blind), the alt attribute is only allowed to be omitted rather

than being provided with replacement text when no alternative text is available and none can be

acceptable reason for omitting the alt attribute.

part of a service to count page views, then the alt attribute

audience is not necessarily personally known to the author, such as documents on a Web site,

e-mails sent to public mailing lists, or software documentation.

specific person who is known to be able to view images, the alt

alternative text (as appropriate according to the kind of image involved, as described in the

above entries), so that the e-mail is still usable should the user use a mail client that does not

support images, or should the document be forwarded on to other users whose abilities might not

For images that are the sole contents of links, markup generators should examine the link

attribute to the empty string, under the assumption that the image is a purely decorative image

that doesn't add any information but is still specific to the surrounding content, or omit the

attribute on img elements for which they have been unable to obtain alternative text

egregious error of providing phony alternative text, because state-of-the-art automated

conformance checkers cannot distinguish phony alternative text from correct alternative text.

Markup generators should generally avoid using the image's own file name as the alternative

Similarly, markup generators should avoid generating alternative text from any content that

whereas the browsers that later read the page can be updated by the user, therefore the browser is

attribute as an error unless one of the conditions listed below applies: The iframe element represents a nested browsing

using the HTML syntax that consists of the following syntactic components, in the

QUOTATION MARK (') and U+0026 AMPERSAND () characters, and to specify the sandbox attribute, to ensure safe embedding of content.

[XML] If the src attribute and the srcdoc attribute are both specified together, the srcdoc attribute takes priority.

a fallback URL for legacy user agents that do not support the srcdoc attribute.

context, set the element's nested browsing context to the newly-created

from a document, the user agent must discard the element's nested browsing context, if it is not null,

its src attribute set, changed, or removed, the user agent

loaded at the time of the new navigation, then the navigation must be completed with replacement enabled.

when the nested browsing context was created, then any navigation required of the user agent in that algorithm must be completed

loaded, the user agent must run the iframe load event steps.

The iframe load event steps are as follows: This, in conjunction with scripting, can be used to probe the URL space of the

access control policies that are stricter than those described above to mitigate this attack, but

not ready for post-load tasks, and when anything in the iframe is delaying the load event of the iframe's

browsing context in the iframe is again navigated, that will further delay the load event.

If, when the element is created, the srcdoc attribute is not set, and the src attribute is either also not set or set but its value cannot be

is present, the browsing context name must be set to the value of this attribute;

otherwise, the browsing context name must be set to the empty string.

forms, scripts, and various potentially annoying APIs are disabled, links are prevented from

keyword allows the content to navigate its top-level browsing context;

and the allow-forms, allow-modals, allow-orientation-lock, allow-pointer-lock, allow-popups, allow-presentation, allow-scripts, and allow-popups-to-escape-sandbox

keywords re-enable forms, modal dialogs, screen orientation lock, the pointer lock API, popups,

the presentation API, scripts, and the creation of unsandboxed auxiliary browsing contexts respectively.

attacker can convince the user to just visit the hostile content directly, rather than in the

files are unable to attack the site, even if the user is tricked into visiting those pages

has a nested browsing context, the user agent must parse the sandboxing directive using the attribute's value as the

attribute is removed while it has a non-null nested browsing context, the user agent

the iframe element's browsing context are to be allowed to use requestFullscreen() (if it's not blocked for other

the iframe element's browsing context are to be allowed to use getUserMedia() (if it's not blocked for other

allowattribute, run these steps: To set the allow* flags for a Document document means to

run these steps: The iframe element supports dimension attributes for cases where the

create a nested browsing context, regardless of whether the specified initial

not support iframe elements, the contents would be parsed as markup that could act as

fallback content.) The HTML parser treats markup inside iframe elements as

The IDL attributes src, srcdoc, name,and sandbox must reflect the respective content

browsing context, if its nested browsing context is non-null, or null

embed element, the node may also support other

attribute and the src attribute are present, then the type attribute must specify the same type as the explicit Content-Type metadata of the resource given by the src attribute.

active when the following conditions are all met simultaneously: Whenever an embed element that was not potentially active becomes potentially active, and whenever a potentially active embed element that is

remaining potentially active and has its src attribute set, changed, or removed or its type attribute set, changed, or removed, the user agent must

queue a task using the embed task source to run the

The embed element setup steps are as follows: The embed element has no fallback content.

find a suitable plugin when attempting to find and instantiate one for the algorithm above, then

flag is set on the embed element's node document's active

sandboxing flag set, then the user agent must not instantiate the plugin, and

must instead render the embed element in a manner that conveys that the

user agent must act as if the conditions above did not apply for the purposes of this element.

disabled in sandboxed browsing contexts because they might not honor the restrictions imposed by

agents should convey the danger of overriding the sandbox to the user if an option to do so is

embed element's nested browsing context's active document

is not ready for post-load tasks, and when anything is delaying the load event of the embed element's browsing

events mode, the embed must delay the load event of its

Any namespace-less attribute other than name, align, hspace, and vspace may be

object element, the node also supports other

attribute, it is possible in certain cases for an attacker on the remote host to use the plugin

mechanism to run arbitrary scripts, even if the author has used features such as the Flash

boolean attribute whose presence indicates that the resource specified by the data attribute is only to be used if the value of the type attribute and the Content-Type of the

Whenever one of the following conditions occur: ...the user agent must queue a task to run the following steps to (re)determine

should pass to the plugin used the names and values of all the attributes on the

element, in the order they were added to the element, with the attributes added by the parser

being ordered in source order, followed by a parameter named 'PARAM' whose value is null, followed

object element if the sandboxed plugins browsing context flag is set on

the object element's node document's active sandboxing flag

content, used only when referenced resources can't be shown (e.g.

targeting multiple user agents with different capabilities, with the user agent picking the first

object element's nested browsing context's active document

is not ready for post-load tasks, and when anything is delaying the load event of the object element's browsing

events mode, the object must delay the load event of its

object element represents an image, can indicate that the object has an associated

object element, then the element defines a parameter with the given name-value pair.

plugin is communicating with the user agent using an API that features the ability to

update the plugin when the name or value of a parameter so changes, then the user agent must

video element is used for playing videos or movies, and audio files with

not support video, so that legacy video plugins can be tried, or to show text to the

users of these older browsers informing them of how to access the video contents.

make video content accessible to the partially sighted, the blind, the hard-of-hearing, the deaf,

Captions can be provided, either embedded in the video stream or as external files using the

descriptions can be embedded in the video stream or in text form using a WebVTT file

referenced using the track element and synthesized into speech by the user agent.

element at all, transcripts or other textual alternatives can be provided by simply linking to

[WEBVTT] The video element is a media element whose media data is

ostensibly video data, possibly with associated audio data.

muted, and controls attributes are the attributes common to all media elements.

URL of an image file that the user agent can show while no video data is available.

The attribute, if present, must contain a valid non-empty URL potentially surrounded by

If the specified resource is to be used, then, when the element is created or when the poster attribute is set, changed, or removed, the user agent must

run the following steps to determine the element's poster frame (regardless of the

value of the element's show poster flag): The image given by the poster attribute,

video (typically one of the first non-blank frames) that gives the user an idea of what the video

ought to be displayed 'inline' in the document by default, constrained to the element's playback

area, instead of being displayed fullscreen or in an independent resizable window.

agents have chosen to play all videos inline by default, and in such user agents the playsinline attribute has no effect.

list below: Frames of video must be obtained from the video track that was selected when the event loop last reached

Which frame in a video stream corresponds to a particular playback position is

The video element also represents any text track cues whose text track cue active flag is set and whose

The user agent must play the audio from audio tracks that were enabled when the event loop last reached step

In addition to the above, the user agent may provide messages to the user (such as 'buffering',

'no video loaded', 'error', or more detailed information) by overlaying text or icons on the video

User agents that cannot render the video may instead make the element represent a link to an external video playback utility or to the video

element provides a paint source whose width is the media resource's

height, and whose appearance is the frame of video corresponding to the current playback position, if that is available, or else

account the resource's dimensions, aspect ratio, clean aperture, resolution, and so forth, as

the aspect ratio to the video data's dimensions to obtain the 'correct' dimensions, then the user

agent must apply the ratio by increasing one dimension and leaving the other unchanged.

queue a task to fire an event named resize at the media element.

In the absence of style rules to the contrary, video content should be rendered inside the

element's playback area such that the video content is shown centered in the playback area at the

largest possible size that fits completely within it, with the video content's aspect ratio being

Thus, if the aspect ratio of the playback area does not match the aspect ratio of the

User agents should provide controls to enable or disable the display of closed captions, audio

description tracks, and other additional data associated with the video stream, though such

User agents may allow users to view the video content in manners more suitable to the user,

viewing mode by default upon playing a video, although they should not do so when the playsinline attribute is specified.

interface features, controls to enable this should not interfere with the page's normal rendering

User agents may allow video playback to affect system features that could interfere with the

for example, user agents could disable screensavers while video playback is in

not support audio, so that legacy audio plugins can be tried, or to show text to the

users of these older browsers informing them of how to access the audio contents.

available, the video element can be used instead of the audio element to

play the audio, allowing users to enable the visual alternatives.

naturally, transcripts or other textual alternatives can be provided by simply linking to them in

[WEBVTT] The audio element is a media element whose media data is

muted, and controls attributes are the attributes common to all media elements.

data played synchronized with the current playback position, at the element's

attribute set to the value passed in the argument, if applicable.

the constructor must perform the following steps: The track element allows authors to specify explicit external timed text tracks for media elements.

given in the first cell of each row maps to the state given in the second cell.

empty string and whose value, when the attribute was set, could be successfully parsed relative to the element's node document, then the

If the element's track URL identifies a WebVTT resource, and the element's kind attribute is not in the chapters metadata or metadata state, then the WebVTT file must be a

not the empty string, then the element's track language is the value of the attribute.

This title is used by user agents when listing subtitle, caption, and audio description tracks in their user interface.

element children of the same media element whose kind attributes are in the same state, whose srclang attributes are both missing or have values that

the empty string, then the element's track label is the value of the attribute.

whose kind attribute is in the subtitles or captions state and whose default attribute is specified.

whose kind attribute is in the description state and whose default attribute is specified.

whose kind attribute is in the chapters metadata state and whose default attribute is specified.

There is no limit on the number of track elements whose kind attribute is in the metadata state and whose default attribute is specified.

represented by a number from the following list: The text track not loaded state.

numeric value corresponding to the text track readiness state of the

track element's text track, as defined by the following list: The track IDL attribute must, on getting,

section applies equally to media elements for audio or for

The term media resource is used to refer to the complete set of media data, e.g.

media element, the video data of the media resource is only that of the

currently selected track (if any) as given by the element's videoTracks attribute when the event loop last

reached step 1, and the audio data of the media resource is the result of mixing all

the currently enabled tracks (if any) given by the element's audioTracks attribute when the event loop last

no playback area for visual content (such as video or captions), whereas the video

element event task source of the media element in question.

records the last error the element encountered since its resource selection algorithm was last invoked.

message and message format are not generally uniform across different user agents.

message is available, then the empty string is returned.

given an error code which is one of the above values, return a new MediaError object

whose code is the given error code and whose message is a string containing any details the user

agent is able to supply about the cause of the error condition, or the empty string if the user

The src content attribute on media elements gives the URL of the media resource (video, audio) to

src attribute, the user agent must immediately invoke the

or changed, the user agent must invoke the media element's media element load

not do this, even if there are source elements present.) The src IDL attribute on media elements must reflect the content attribute of the same

must return the element's assigned media provider object, if any, or null otherwise.

On setting, it must set the element's assigned media provider object to the new

value, and then invoke the element's media element load algorithm.

There are three ways to specify a media resource: the srcObject IDL attribute, the src content attribute, and source elements.

attribute takes priority, followed by the content attribute, followed by the elements.

codecs parameter is allowed or not depends on the MIME type.) [RFC6381] Types are usually somewhat incomplete descriptions;

agent can often only know whether it might be able to play media of that type (with

varying levels of confidence), or whether it definitely cannot play media of that

that the user agent definitely does not support, for example because it doesn't recognize the

the user agent is that it can play media resources of the given type.

empty string if type is a type that the user agent knows it cannot

that the type represents a media resource that it can render if used in with this

'probably' for a type that allows the codecs parameter if that parameter is not present.

source element allows the user agent to avoid downloading resources that use formats

return the current network state of the element, which must be one of the following values: The resource selection algorithm defined

attribute changes value and what events fire to indicate changes in this state.

Causes the element to reset and start selecting and loading a new media resource

element is invoked, the user agent must run the media element load

of the first steps in the algorithm is to return and continue running the remaining steps

element and a given URL record or media provider object is as

follows: When a media element is to forget the media element's media-resource-specific

tracks, the user agent must remove from the media element's list of text

text tracks, then empty the media element's audioTracks attribute's AudioTrackList object,

The following table lists the keywords and states for the attribute — the

keywords in the left column map to the states in the cell in the second column on the same row as

The attribute's missing value default is user-agent defined, though the Metadata state is suggested as a compromise

between reducing server load and providing an optimal user experience.

Authors might switch the attribute from 'none' or 'metadata' to 'auto' dynamically once the user begins playback.

example, on a page with many videos this might be used to indicate that the many videos are not to

the user agent about what the author thinks will lead to the best user experience.

may be ignored altogether, for example based on explicit user preferences or based on the

media resource, if any, that the user agent has buffered, at the time the attribute

user agent uses HTTP range requests in response to seeking, then there could be multiple

Thus, a time position included within a range of the objects return by the buffered attribute at one time can end up being not included in

Returning a new object each time is a bad pattern for attribute getters and is

media resource has a media timeline that maps times (in seconds) to

timeline: if the media resource somehow specifies an explicit timeline whose

gives each frame a specific time offset and gives the first frame a

the media resource can specify a timeline or not depends on the media resource's format.) If the media resource specifies an

explicit start time and date, then that time and date should be considered the zero point

If the media resource has a discontinuous timeline, the user agent must extend the

timeline used at the start of the resource across the entire resource, so that the media

timeline of the media resource increases linearly starting from the

video format exposes the original times for the two clips, the video data might expose a timeline

zero time on the media timeline should correspond to the first frame of the

explicit timings of any kind, not even frame durations, the user agent must itself determine the

An example of a file format with no explicit timeline but with explicit frame

If, in the case of a resource with no timing information, the user agent will nonetheless be

able to seek to an earlier point than the first frame originally provided by the server, then the

zero time should correspond to the earliest seekable time of the media resource;

otherwise, it should correspond to the first frame received from the server (the point in the

media resource at which the user agent began receiving the stream).

At the time of writing, there is no known format that lacks explicit frame time

offsets yet still supports seeking to a frame before the first frame sent by the server.

In any case, the user agent must ensure that the earliest possible position (as

defined below) using the established media timeline, is greater than or equal to

user agent is to show a poster frame for a video element instead of showing the video

getting, return the media element's default playback start position,

element's default playback start position to the new value;

set the official playback position to the new value and then seek to the new value.

to obtain certain parts of the resource after it has expired from its buffer.

it corresponds to the start time of the first range in the seekable attribute's TimeRanges object, if any, or

position is before the earliest possible position, the user agent must seek to the earliest possible position;

the element in the past 15 to 250ms and is not still running event handlers for such an event,

Because of the above requirement and the requirement in the resource fetch algorithm that kicks in when the metadata of the clip becomes known, the current

If at any time the user agent learns that an audio or video track has ended and all media

data relating to that track corresponds to parts of the media timeline that

are before the earliest possible position, the user agent may queue a

live event with no announced end time), then the attribute must return the positive Infinity

any part of the media data and before setting readyState to a value equal to or greater than HAVE_METADATA, even if doing so requires fetching multiple

from being unknown to known, or from a previously established length to a new length) the

position ends up being greater than the time of the end of the media resource,

from positive Infinity to the time of the last frame or sample in the stream, and the durationchange event would be fired.

user agent initially estimated the media resource's duration instead of determining

it precisely, and later revises the estimate based on new information, then the duration would

Some video files also have an explicit date and time corresponding to the zero time in the

attribute that, if specified, indicates that the media element is to seek back

Returns a value that expresses the current state of the element with respect to rendering the

current playback position, from the codes in the list below.

either of the following conditions is also true: In practice, the difference between HAVE_METADATA and HAVE_CURRENT_DATA is negligible.

canvas, where it distinguishes the case where something will be drawn (HAVE_CURRENT_DATA or greater) from the case where

When the ready state of a media element whose networkState is not NETWORK_EMPTY changes, the user agent must follow the steps

given below: It is possible for the ready state of a media element to jump between these states

For example, the state of a media element can jump straight from HAVE_METADATA to HAVE_ENOUGH_DATA without passing through the HAVE_CURRENT_DATA and HAVE_FUTURE_DATA states.

getting, return the value described above that describes the current ready state of the

described herein) will automatically begin playback of the media resource as

attribute rather than using script to trigger automatic playback, as this allows the user to

are also encouraged to consider not using the automatic playback behavior at all, and instead to

let the user agent wait for the user to start playback explicitly.

The default rate has no direct effect on playback, but if the user switches to a fast-forward

mode, when they return to the normal playback mode, it is expected that the rate of playback

media resource and beginning playback if necessary.

media element is a blocked media element if its readyState attribute is in the HAVE_NOTHING state, the HAVE_METADATA state, or the HAVE_CURRENT_DATA state, or if the element has

media element is said to be potentially playing when its paused attribute is false, the element has not ended

playback, playback has not stopped due to errors, and the element is not a

potentially playing stopping playback due to its readyState attribute changing to a value lower than HAVE_FUTURE_DATA.

specified, and the element's node document's active sandboxing flag set

does not have the sandboxed automatic features browsing context flag set.

media element is said to have ended playback when: The ended attribute must return true if, the

last time the event loop reached step 1, the media element had

element's readyState attribute is HAVE_METADATA or greater, and the user agent encounters a non-fatal error during the processing of the

media data, and due to that error, is not able to play the content at the

paused attribute is false, the readyState attribute is either HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA and the user agent has reached a point

because it has paused for user interaction, the user agent must queue a

paused attribute is false, the readyState attribute is either HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA and the user agent has suspended

playback of the media resource in order to play content that is temporally anchored

to the media resource and has a nonzero length, or to play content that is

temporally anchored to a segment of the media resource but has a length longer than

in-band content is when the user agent is playing audio descriptions from an external WebVTT file, and

the synthesized speech generated for a cue is longer than the time between the text track

cue start time and the text track cue end time.

agent must follow these steps: When the current playback position reaches the earliest possible

backwards, then the user agent must only queue a task to fire an event named timeupdate at the element.

gives the desired speed at which the media resource is to play, as a multiple of its

effective playback rate, which is the speed at which the media resource plays, as a

the user is using a feature such as fast forward or slow motion playback.

mutable: on getting it must return the last value it was set to, or 1.0 if it hasn't yet been set;

being set by script or by being changed directly by the user agent, e.g.

media timeline of the media resource reached through the usual monotonic

increase of the current playback position during normal playback, if any, at the time

Returning a new object each time is a bad pattern for attribute getters and is

To take pending play promises for a media element, the user agent must

run the following steps: To resolve pending play promises for a media element with a list of

promises promises, the user agent must resolve each promise in promises with

To reject pending play promises for a media element with a list of

promise promises and an exception name error, the user agent must reject

element is invoked, the user agent must run the following steps.

the user agent is required to pause the media element, the user agent must run the

following steps: The internal pause steps for a media element are as follows: If the element's playbackRate is positive or zero,

0.0, in which case the current playback position doesn't move, despite playback not

being paused (paused doesn't become true, and the pause event doesn't fire).

playback rate — depending on the protocol and media available, it is plausible that the user

agent could negotiate with the server to have the server provide the media data at the appropriate

the stream's playback rate) the client doesn't actually have to drop or interpolate any

once a media element is in a state where no further audio could ever be played by that element may

media element whose media resource has no audio tracks could eventually play audio

Whenever a text track cue is added to the list of cues of a text track that is in the list of text

be added to the media element's list of newly introduced cues.

a text track is added to the list of text tracks for a media

element's list of newly introduced cues has new cues added while the

media element's show poster flag is not set, then the user agent must

When a text track cue is removed from the list of cues of a text track that is in the list of text

tracks for a media element, and whenever a text track is removed

element's show poster flag is not set, then the user agent must run the

due to playback or seeking), the user agent must run the time marches on steps.

current playback position changes while the steps are running, then the user agent

thus run as often as possible or needed — if one iteration takes a long time, this can cause

certain cues to be skipped over as the user agent rushes ahead

to 'catch up'.) The time marches on steps are as follows: For the purposes of the algorithm above, a text track cue is considered to be part

of a text track only if it is listed in the text track list of cues, not

from a Document, the user agent must run the following steps: Returns true if the user agent is currently seeking.

resource to which it is possible for the user agent to seek.

media resource, if any, that the user agent is able to seek to, at the time the

because it is a simple movie file and the user agent and the server support HTTP Range requests,

then the attribute would return an object with one range, whose start is the time of the first

frame (the earliest possible position, typically zero), and whose end is the same as

Returning a new object each time is a bad pattern for attribute getters and is

agents should also buffer recent content where possible to enable seeking to be fast.

For instance, consider a large video file served on an HTTP server without

current frame and data obtained for subsequent frames, never allow seeking, except for seeking to

storage space is available), allowing the user to jump back and rewatch something surprising

without any latency, and would in addition allow arbitrary seeking by reloading the file from the

restart the video and watch it all the way through just to get to an earlier unbuffered spot.

happens, the user agent must act as if the algorithm for seeking was used whenever the current playback position

in addition to the primary video and audio tracks, a media resource could have

foreign-language dubbed dialogues, director's commentaries, audio descriptions, alternative

representing the audio tracks available in the media element's media

representing the video tracks available in the media element's media

VideoTrackList object represents a dynamic list of zero or more video tracks, of

resource dynamically adds or removes audio or video tracks, then the indices of the tracks

tracks represented by the respective object minus one, if any tracks are represented.

VideoTrackList object (respectively) whose identifier is equal to the value of the

id argument (in the natural order of the list, as defined above).

tracks match the given argument, the methods must return null.

in a format that supports media fragment syntax, the identifier returned for a particular

track must be the same identifier that would enable the track if used as the name of a track in

The category of a track is the string given in the first column of the table below that is the

most appropriate for the track based on the definitions in the table's second and third columns,

in the third column of a row says what the category given in the cell in the first column of that

and a category is only appropriate for video tracks if it applies to video tracks.

BCP 47 language tag of the language of the track, if it has one, or the empty string otherwise.

the user agent is not able to express that language as a BCP 47 language tag (for example because

the language information in the media resource's format is a free-form string without

a defined interpretation), then the method must return the empty string, as if the track had no

getting, must return true if the track is currently enabled, and false otherwise.

must enable the track if the new value is true, and disable it otherwise.

effect beyond changing the value of the attribute on the AudioTrack object.) Whenever an audio track in an AudioTrackList that was

disabled is enabled, and whenever one that was enabled is disabled, the user agent must

queue a task to fire an event named change at the AudioTrackList object.

object does not currently represent any tracks, or if none of the tracks are selected, it must

getting, must return true if the track is currently selected, and false otherwise.

must select the track if the new value is true, and unselect it otherwise.

being selected or unselected has no effect beyond changing the value of the attribute on the

unselected without a new track being selected in its stead, the user agent must queue a

playback, and the user selects that track then goes back to the start, then the user agent will

act as if that track started at the start of the media resource but was simply

The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes,

should play, but it is also possible to select specific tracks declaratively, by specifying

tracks, known as the media element's list of text tracks.

text track consists of: This decides how the track is handled by the user agent.

The possible strings are: The kind of track can change dynamically, in the case of

a text track corresponding to a track element.

case of a text track corresponding to a track element.

When a text track label is the empty string, the user agent should automatically

generate an appropriate label from the text track's other properties (e.g.

track and the text track's language) for use in its user interface.

metadata tracks to enable such tracks to be dispatched to different scripts in the document.

augmented with Web-specific interactive features could include text tracks with metadata for ad

targeting, trivia game data during game shows, player states during sports games, recipe

might be added or removed from the stream, and as each one is added, the user agent could bind

them to dedicated script modules using the value of this attribute.

Other than for in-band metadata text tracks, the in-band metadata track dispatch type is the empty string.

value is populated for different media formats is described in steps to expose a

This is a string (a BCP 47 language tag) representing the language of the text track's cues.

[BCP47] The language of a text track can change dynamically,

in the case of a text track corresponding to a track element.

Indicates that the text track was enabled, but when the user agent attempted to obtain it,

this failed in some way (e.g.

track changes dynamically as the track is obtained.

track in the DOM, the user agent is ignoring the text track.

fired, and the user agent will not attempt to obtain the track's cues.

perform such an attempt momentarily.

active, and events are being fired accordingly.

track's cues, the user agent will perform such an attempt momentarily.

maintaining a list of which cues are active, and events are being fired accordingly.

addition, for text tracks whose kind is subtitles or captions, the cues are being overlaid on the video

for text tracks whose kind is descriptions, the user agent is making the

cues available to the user in a non-visual fashion;

and for text tracks whose kind is chapters, the user agent is making available to

the user a mechanism by which the user can navigate to any point in the media

resource by selecting a cue.

dynamically, either because the text track has not yet been loaded or is still loading,

initially be empty, a blocked-on-parser flag, which must initially be false, and a

When the user agent is required to populate the list of pending text tracks of a

media element, the user agent must add to the element's list of pending text

tracks each text track in the element's list of text tracks whose

Whenever a track element's parent node changes, the user agent must remove the

corresponding text track from any list of pending text tracks that it is

Whenever a text track's text track readiness state changes to either

load, the user agent must remove it from any list of pending text tracks that

parser, the user agent must set the element's blocked-on-parser flag to true.

When a media element is popped off the stack of open elements of an

preferences for automatic text track selection, populate the list of pending text

The text tracks of a media element are ready when both the element's list of pending text

Each media element has a pending text track change notification flag,

tracks has its text track mode change value, the user agent must run the

following steps for the media element: The task source for the tasks listed in this

text track cue is the unit of time-sensitive data in a text track,

corresponding for instance for subtitles and captions to the text that appears at a particular

The time, in seconds and fractions of a second, that describes the beginning of the range of

The time, in seconds and fractions of a second, that describes the end of the range of the

boolean indicating whether playback of the media resource is to pause when the

end of the range to which the cue applies is reached.

[WEBVTT] The text track cue start time and text track cue end

though, so cues entirely before time zero cannot be active.) Each text track cue has a corresponding TextTrackCue object (or more

text track cue is associated with rules for updating the text track

rendering, as defined by the specification for the specific kind of text track

These rules are used specifically when the object representing the cue is added to a

In addition, each text track cue has two pieces of dynamic information: This flag must be initially unset.

when the cue becomes active or inactive, and to make sure the right cues are rendered.

The user agent must synchronously unset this flag whenever the text track cue is

removed from its text track's text track list of cues;

text track itself is removed from its media element's list of

text tracks or has its text track mode changed to disabled;

or more cues in text tracks that were showing prior to the relevant incident, the user agent must, after having unset

the flag for all the affected cues, apply the rules for updating the text track

[WEBVTT] This is used as part of the rendering model, to keep cues in a consistent position.

agent must empty the text track cue display state.

track cue order, which is determined as follows: first group the cues by their text track, with the groups being sorted in the same order

times must be sorted in the order they were last added to their respective text track

[INBAND] When a media resource contains data that the user agent recognizes and supports as

being equivalent to a text track, the user agent runs the steps to expose a

track (with its value set as defined below) and its corresponding new

The text track kind is determined from the state of the element's kind attribute according to the following table;

in the second column: The text track label is the element's track label.

text track must update accordingly, as per the definitions above.

The text track readiness state is initially not loaded, and the text track mode is initially disabled.

[WEBVTT] When a track element's parent element changes and the new parent is a media

element, then the user agent must add the track element's corresponding

text track to the media element's list of text tracks, and

When a track element's parent element changes and the old parent was a media

element, then the user agent must remove the track element's corresponding

text track from the media element's list of text tracks,

media element's list of text tracks, the user agent must queue a

task to run the following steps for the media element: When the user agent is required to honor user preferences for automatic text track

selection for a media element, the user agent must run the following steps: When the steps above say to perform automatic text track selection for one or more

text track kinds, it means to run the following steps:

text track and its track element, it must run the following algorithm.

set, changed, or removed, the user agent must immediately empty the element's text

adding cues from the resource being obtained using the previously given URL, if any.) How a specific format's text track cues are to be interpreted for the purposes of processing by

provides some constraints within which implementations can attempt to consistently expose such

To support the text track model of HTML, each unit of timed data is converted to a

text track cue as defined in this specification are not defined, implementations must

ensure that the mapping is consistent with the definitions of the aspects of a text track

cue as defined above, as well as with the following constraints: Should be set to the empty string if the format has no obvious analogue to a per-cue

This is the number of text tracks in the media element's list of text tracks.

Returns the TextTrack object representing the nth text track in the media element's list of text tracks.

TextTrackList object represents a dynamically updating list of text tracks in a given order.

in the media element's list of text tracks, in the same order as in the

instant are the numbers from zero to the number of text tracks in

TextTrackList object for a given index index, the user agent must return

media element's list of text tracks.

(indicating that a custom label probably needs to be generated from the other attributes of the

For in-band tracks, this is the ID that can be used with a fragment if the format supports media fragment

Returns the text track in-band metadata track dispatch type string.

list: The text track disabled mode.

The addTextTrack(kind, label, language) method of media elements, when invoked, must run the following steps: The kind attribute must return the

track elements, the track's identifier is the value of the element's id attribute, if any.

that supports media fragment syntax, the identifier returned for a particular

track must be the same identifier that would enable the track if used as the name of a track in

attribute must return the text track in-band metadata track dispatch type of the

the string corresponding to the text track mode of the text track that

the TextTrack object represents, as defined by the following list: On setting, if the new value isn't equal to what the attribute would currently return, the new

value must be processed as follows: Set the text track mode of the text track that the

TextTrack object represents to the text track disabled mode.

TextTrack object represents to the text track hidden mode.

TextTrack object represents to the text track showing mode.

TextTrack object represents is not the text track disabled mode, then

text track list of cues of the text track that the

times occur at or after the earliest possible position when the script

earliest possible position was the last time the event loop reached step

TextTrack object represents is not the text track disabled mode, then

text track list of cues of the text track that the

TextTrack object represents whose active flag was set when the script

text track cue's active flag was set when the script started if its

text track cue active flag was set the last time the event loop reached

method of TextTrack objects, when invoked, must run the following steps: Returns the number of cues in the list.

Returns the first text track cue (in text track cue order) with text track cue identifier id.

Returns null if none of the cues have the given identifier or if the argument is the empty string.

TextTrackCueList object represents a dynamically updating list of text track cues in a given order.

given index index, the user agent must return the indexth text track

must return the first text track cue in the list represented by the

TextTrackCueList object whose text track cue identifier is id, if any, or null otherwise.

text track cue belongs, if any, or null

Returns true if the text track cue pause-on-exit flag is set, false otherwise.

return the TextTrack object of the text track in whose list of cues the text track cue that the

the text track cue identifier of the text track cue that the

getting, must return the text track cue start time of the text track cue

cue start time must be set to the new value, interpreted in seconds;

element's show poster flag is not set, then run the time marches on steps for that media element.

must return the text track cue end time of the text track cue that the

element's show poster flag is not set, then run the time marches on steps for that media element.

getting, must return true if the text track cue pause-on-exit flag of the text

On setting, the text track cue pause-on-exit flag must be set if the new value is

The following are the event handlers that (and their corresponding event handler event types) that must

be supported, as event handler IDL attributes, by all objects implementing the

TextTrackList interface: The following are the event handlers that (and their corresponding event handler event types) that must

be supported, as event handler IDL attributes, by all objects implementing the

TextTrack interface: The following are the event handlers (and their corresponding event handler event types) that must

be supported, as event handler IDL attributes, by all objects implementing the

Text tracks can be used for storing data relating to the media data, for interactive or

For example, a page showing a sports broadcast could include information about the current

In order to make the score display render correctly whenever the user seeks to an arbitrary

point in the video, the metadata text track cues need to be as long as is appropriate for the

match that gives the match number, one cue that lasts until the blue alliance's score changes, and

live event, the time in the bottom right would presumably be automatically derived from the

The following shows what fragments of this could look like in a WebVTT file: The key here is to notice that the information is given in cues that span the length of time to

brief, nearly zero-length) cues when the score changes, for example saying 'red+2' at

05:11:17.198, 'red+3' at 05:11:25.912, etc, problems arise: primarily, seeking is much harder to

implement, as the script has to walk the entire list of cues to make sure that no notifications

When using cues in this manner, authors are encouraged to use the cuechange event to update the current annotations.

appropriate as it would require doing work even when the cues haven't changed, and, more

importantly, would introduce a higher latency between when the metadata cues become active and

are rate-limited.) Other specifications or formats that need a URL to identify the return values of

disabled for the media element, then the user agent should expose a user

playback, seek to an arbitrary position in the content (if the content supports arbitrary

seeking), change the volume, change the display of closed captions or embedded sign-language

tracks, select different audio tracks or turn on audio descriptions, and show the media content in

Even when the attribute is absent, however, user agents may provide controls to affect playback

play, pause, seeking, track selection, and volume controls), but such

be exposed in the media element's context menu, platform media keys, or a remote

The user agent may implement this simply by exposing a user interface to the user as described above (as if the controls attribute was present).

the user by displaying controls over the media element, then the user agent

should suppress any user interaction events while the user agent is interacting with this

(For example, if the user clicks on a video's playback control, mousedown events and so forth would not simultaneously be fired at

elements on the page.) Where possible (specifically, for starting, stopping, pausing, and unpausing playback, for

seeking, for changing the rate of playback, for fast-forwarding or rewinding, for listing,

enabling, and disabling text tracks, and for muting or changing the volume of the audio), user

interface features exposed by the user agent must be implemented in terms of the DOM API described

resources where seeking to an arbitrary position would be slow, user agents are encouraged to use

the approximate-for-speed flag when seeking in response to the user manipulating an

Returns the current playback volume, as a number in the range 0.0 to 1.0, where 0.0 is the

attribute, and false if the volume attribute is being

media element has a playback volume, which is a fraction in the range 0.0 (silent) to 1.0 (loudest).

Initially, the volume should be 1.0, but user agents may remember the last set value across

sessions, on a per-site basis or otherwise, so the volume may start at other values.

On setting, if the new value is in the range 0.0 to 1.0 inclusive, the

If the new value is outside the range 0.0 to 1.0 inclusive, then, on

playback is backwards, the element is muted.) The muted IDL attribute must return the value

When a media element is created, if the element has a muted content attribute specified, then the muted IDL attribute should be set to true;

agents may set the value to the user's preferred value (e.g.

attributes change, the user agent must queue a task to fire an event named volumechange at the media element.

the media element is not allowed to play, the user agent must run the

An element's effective media volume is determined as follows: The muted content attribute on media elements is a boolean attribute that controls the

default state of the audio output of the media resource, potentially overriding user

method must return the position of the start of the indexth range represented

by the object, in seconds measured from the start of the timeline that the object covers.

must return the position of the end of the indexth range represented by the

object, in seconds measured from the start of the timeline that the object covers.

if called with an index argument greater than or equal to the number of ranges

object, the ranges it represents must obey the following criteria: In other words, the ranges in such an object are ordered, don't overlap, and don't touch

that the user agent has discarded the entire media resource except for the current

zero would have a start equal to zero and an end equal to the duration of the timeline.

processing model described above: The following event fires on source element: The following events fire on AudioTrackList, VideoTrackList, and

TextTrackList objects: The following event fires on TextTrack objects and track elements: The following events fire on track elements: The following events fire on TextTrackCue objects: The main security and privacy implications of the video and audio

can flow: from hostile content to a victim page, and from a hostile page to victim content.

If a victim page embeds hostile content, the threat is that the content might contain scripted

this, user agents must ensure that there is no access from the content to the embedding page.

the case of media content that uses DOM concepts, the embedded content must be treated as if it

scripts in the SVG resource, the SVG file would appear to be in a lone top-level browsing context

If a hostile page embeds victim content, the threat is that the embedding page could obtain

corporate network into visiting a site that attempts to load a video from a previously leaked

product, then being able to read the subtitles would present a serious confidentiality breach.

Playing audio and video resources on small devices such as set-top boxes or mobile phones is

attribute and any source element descendants, and invoking the element's load() method.

Similarly, when the playback rate is not exactly 1.0, hardware, software, or format limitations

can cause video frames to be dropped and audio to be choppy or muted.

how precise an implementation reports the ranges that have been buffered depends on how carefully

in byte streams, a user agent receiving a variable-bitrate stream might only be able to determine

actually decoding parts of the video forwards, storing the complete frames, and

requirement that a user agent keep all the media data obtained for the lifetime of the media

element), it is again a quality of implementation issue: user agents with sufficient resources to

keep all the data around are encouraged to do so, as this allows for a better user experience.

example, if the user is watching a live stream, a user agent could allow the user only to view the

When a media element that is paused is removed from a document and not reinserted before the next time the event

loop reaches step 1, implementations that are resource constrained are encouraged to take

that opportunity to release all hardware resources (like video planes, networking resources, and

playback position and so forth, though, in case playback is later restarted.) The map element, in conjunction with an img element and any

HTMLCollection rooted at the map element, whose filter matches only

corresponding area on an image map, or a dead area on an image map.

attribute, then the area represented by the element cannot be selected, and the alt attribute must be omitted.

given in the first cell of the rows with keywords give the states to which those keywords map.

The first integer must be the distance in CSS pixels from the left edge of the image to the center of the circle, the

the image to the center of the circle, and the third integer must be the radius of the circle,

whole image.) In the polygon state, area elements must

respectively, and all the coordinates together must represent the points of the polygon, in

The four points must represent, respectively, the distance from the left edge of the image

to the left side of the rectangle, the distance from the top edge to the top side, the distance

from the left edge to the right side, and the distance from the top edge to the bottom side, all

area element, as described in the next section, the href, target, download, and ping

attribute may be used to indicate to the user the likely nature of the target resource before the

The activation behavior of area elements is to follow the hyperlink or download the hyperlink created by the area element, if any, and as

An image map allows geometric areas on an image to be associated with hyperlinks.

representing an image, may be associated with an image map (in the form of a map

usemap attribute specified, user agents must process it

as follows: Having obtained the list of area elements that form the image map (the areas), interactive user agents must process the list in one of two ways.

If the user agent intends to show the text that the img element represents, then

object elements cannot represent images, and thus this section never applies (the

If the user agent intends to show the image and allow interaction with the image to select

hyperlinks, then the image must be associated with a set of layered shapes, taken from the

area elements in areas, in reverse tree order (so the last

specified area element in the map is the bottom-most shape, and

obtain a shape to layer onto the image: Pointing device interaction with an image associated with a set of layered shapes per the above

algorithm must result in the relevant user interaction events being first fired to the top-most

shape covering the point that the pointing device indicated, if any, or to the image element

associated with multiple img and object elements, it is possible for an

When the MathML token elements (mi, mo, mn, ms, and mtext) are descendants of HTML elements, they may contain

elements whose content models do not allow straight text by pretending for the purposes of MathML

content models, layout, and rendering that the text is actually wrapped in a MathML

(Such text is not, however, conforming.) User agents must act as if any MathML element whose contents does not match the element's

user agents are encouraged to provide a way to export any MathML fragment as an XML

agents are encouraged to provide a way to export any SVG fragment as an XML namespace-well-formed

[SVG] Returns the Document object, in the case of iframe, embed, or object elements being used to embed SVG images.

the following steps: Author requirements: The width and height attributes on img, iframe,

embed, object, video, and, when their type attribute is in the Image Button state, input elements may be

specified to give the dimensions of the visual content of the element (the width and height

The specified dimensions given may differ from the dimensions specified in the resource itself,

resolution depends on the reading distance.) If both attributes are specified, then one of the

following statements must be true: The target ratio is the ratio of the intrinsic width to the

to extract tabular data from such documents would obtain very confusing results.

users of accessibility tools like screen readers are likely to find it very difficult to navigate

should clearly delineate cells in a table from each other, unless the user agent has classified

User agents, especially those that do table analysis on arbitrary content, are encouraged to

find heuristics to determine which tables actually contain data and which are merely being used

suggested as possible indicators: It is quite possible that the above suggestions are wrong.

to provide feedback elaborating on their experiences with trying to create a layout table

If a table element has a (non-conforming) summary attribute, and the user agent has not classified the

table as a layout table, the user agent may report the contents of that attribute to the user.

into the table at the position given by the argument, and returns the tr.

if the argument is omitted, is equivalent to inserting at the end of the table.

If the given position is less than −1 or greater than the number of rows, throws an

table element's node document, the given local name, and the HTML

getting, the first caption element child of the table element, if any,

table element, if any, must be removed, and the new value, if not null, must be

getting, the first thead element child of the table element, if any, or

thead element child of the table element, if any, must be removed, and

the new value, if not null, must be inserted immediately before the first element in the

If the new value is neither null nor a thead element, then a

first element in the table element that is neither a caption element nor

getting, the first tfoot element child of the table element, if any, or

tfoot element child of the table element, if any, must be removed, and

HTMLCollection rooted at the table node, whose filter matches only

immediately after the last tbody element child in the table element, if

tbody element children, and then must return the new tbody element.

HTMLCollection rooted at the table node, whose filter matches only

that those elements whose parent is a thead are included first, in tree order,

element, again in tree order, followed finally by those elements whose parent is a

the method must act as required by the first item in the following list of conditions that

describes the state of the table and the index argument: When the deleteRow(index) method is called, the user agent must run the following

might have difficulty understanding the content, authors should include explanatory information

Such explanatory information should introduce the purpose of the table, outline its basic cell

structure, highlight any trends or patterns, and generally teach the user how to use the

For instance, the following table: ...might benefit from a description explaining the way the table is laid out, something like

'Characteristics are given in the second column, with the negative side in the left column and the

There are a variety of ways to include this information, such as: Authors may also use other techniques, or combinations of the above techniques, as

The best option, of course, rather than writing a description explaining the way the table is

In visual media, providing column and row borders and alternating row backgrounds can be very

For tables with large volumes of numeric content, using monospaced fonts can help users see

patterns, especially in situations where a user agent does not render the borders.

for historical reasons, not rendering borders on tables is a common default.) In speech media, table cells can be distinguished by reporting the corresponding headers before

reading the cell's contents, and by allowing users to navigate the table in a grid fashion, rather

User agents are encouraged to render tables using these techniques whenever the page does not

The colgroup element represents a group of one or more columns in the table that is its parent, if it has a

whose value must be a valid non-negative integer greater than zero and less than or

specified, whose value must be a valid non-negative integer greater than zero and

body of data for the parent table element, if the tbody element has a

Creates a tr element, inserts it into the table section at the position given by

default if the argument is omitted, is equivalent to inserting at the end of the table

If the given position is less than −1 or greater than the number of rows, throws an

the column labels (headers) for the parent table element, if the thead

the column summaries (footers) for the parent table element, if the

Creates a td element, inserts it into the table row at the position given by the

if the argument is omitted, is equivalent to inserting at the end of the row.

If the given position is less than −1 or greater than the number of cells, throws an

a parent table element, or a parent tbody, thead, or

tfoot element and a grandparent table element, return the index

tfoot element, return the index of the tr element in the parent

HTMLCollection rooted at this tr element, whose filter matches only

method must act as follows: The HTMLTableCellElement interface is also used for th elements.

is impractical, may give the user context for the cell when rendering the contents of a cell;

instance, giving its position in the table model, or listing the cell's header cells

attributes on those header cells, if any, instead of the contents of the header cells

enumerated attribute with five states, four of which have explicit keywords: The scope attribute's missing value default is the

The td and th elements may have a colspan content attribute specified, whose value must

be a valid non-negative integer greater than zero and less than or equal to 1000.

The td and th elements may also have a rowspan content attribute specified, whose value must

These attributes give the number of columns and rows respectively that the cell is to span.

case-sensitive, each of which must have the value of an ID of a th element taking part in the same table as the td or th element (as defined by the table model).

same table that have headers attributes whose values include as one of their tokens

This does not necessarily correspond to the x-position of the cell in the

table, since earlier cells might cover multiple rows or columns.

clamped to the range [1, 1000], and its default value is 1.

clamped to the range [0, 65534], and its default value is 1.

element has a parent tr element, return the index of the cell's element in the parent

The various table elements and their content attributes together define the table

has one or more slots, then the x coordinates are always in the range 0 ≤ x < xwidth, and the y coordinates are always in the

cell is a set of slots anchored at a slot (cellx, celly), and with

row is a complete set of slots from x=0 to x=xwidth-1, for a particular value of y.

column is a complete set of slots from y=0 to y=yheight-1, for a particular value of x.

row group is a set of rows anchored at a slot (0, groupy) with a particular height such that the row group

column group is a set of columns anchored at a slot (groupx, 0) with a particular width such that the column group

are part of zero or one row groups and zero or more column groups.

To determine which elements correspond to which slots in a table associated with a table element, to determine the

dimensions of the table (xwidth and yheight), and to determine if there are any table model errors, user agents must use the following algorithm: The algorithm for processing row groups, which is invoked by the set of steps above

for processing thead, tbody, and tfoot elements, is: The algorithm for ending a row group, which is invoked by the set of steps above

when starting and ending a block of rows, is: The algorithm for processing rows, which is invoked by the set of steps above for

processing tr elements, is: When the algorithms above require the user agent to run the algorithm for growing

downward-growing cells, the user agent must, for each {cell, cellx, width} tuple in the list of downward-growing cells, if any, extend the cell cell so that it also covers the slots with

The internal algorithm for scanning and assigning header cells, given a principal cell, a header list, an initial coordinate (initialx, initialy),

header cell anchored at the slot with coordinate (x, y) with width width and height height is

header cell anchored at the slot with coordinate (x, y) with width width and height height is

header cell is said to be a column group header if its scope attribute is in the column

header cell is said to be a row group header if its scope attribute is in the row

physical tables, Volume 71: This table could look like this: The following shows how one might mark up the gross margin table on page 46 of Apple, Inc's

10-K filing for fiscal year 2008: This table could look like this: The following shows how one might mark up the operating expenses table from lower on the same

form is a component of a Web page that has form controls, such as text, buttons, checkboxes,

scripts can augment the user experience or use forms for purposes other than submitting data to a

interface, implementing the server-side processing, and configuring the user interface to

controls are represented by the input element, which by default provides a text

paragraph, and is typically separated from other parts using p elements.

Putting this together, here is how one might ask for the customer's name: To let the user select the size of the pizza, we can use a set of radio buttons.

also use the input element, this time with a type attribute with the value radio.

These use the input element with a type attribute with the value checkbox: The pizzeria for which this form is being written is always making mistakes, so it needs a way

of these form controls have attributes to control exactly what values can be specified;

case, three attributes of particular interest are min, max, and step.

minimum time, the maximum time, and the interval between allowed values (in seconds).

pizzeria only delivers between 11am and 9pm, and doesn't promise anything better than 15 minute

increments, which we can mark up as follows: The textarea element can be used to provide a multiline text control.

instance, we are going to use it to provide a space for the customer to give delivery

instructions: Finally, to make the form submittable we use the button element: This section is non-normative.

For the purposes of this introduction, we will assume that the script at https://pizza.example.com/order.cgi is configured to accept submissions using the

expecting the following parameters sent in an HTTP POST body: This section is non-normative.

For each form control you want submitted, you then have to give a name that will be used to

name, and the server distinguishes which checkbox was checked by seeing which values are submitted

with that name — like the radio buttons, they are also given unique values with the value attribute.

Given the settings in the previous section, this all becomes: There is no particular significance to the way some of the attributes have their

telephone number, did not specify an e-mail address, asked for a medium-sized pizza, selected the

Extra Cheese and Mushroom toppings, entered a delivery time of 7pm, and left the delivery

instructions text control blank, the user agent would submit the following to the online Web

Forms can be annotated in such a way that the user agent will check the user's input before the

easily bypass the form validation), but it allows the user to avoid the wait incurred by having

delivery time fields, we allow the user agent to notify the user when the user submits the form

without filling in those fields: It is also possible to limit the length of the input, using the maxlength attribute.

element, we can limit users to 1000 characters, preventing them from writing huge essays to the

busy delivery drivers instead of staying focused and to the point: When a form is submitted, invalid events are

can be useful for displaying a summary of the problems with the form, since typically the browser

Some browsers attempt to aid the user by automatically filling form controls rather than having

fields that can be usefully annotated in this way: the information about who the pizza is to be

For example, when typing in a credit card number the user may wish to only see

keys for digits 0-9, while when typing in their name they may wish to see a form field that by

attempts to illustrate the difference between the three attributes and provides advice suggesting

which phone number the page is asking for, whether they expect a telephone number in the

For example, a page that forms part of a checkout process on an e-commerce site for a customer

buying a gift to be shipped to a friend might need both the buyer's telephone number (in case of

payment issues) and the friend's telephone number (in case of delivery issues).

expects international phone numbers (with the country code prefix), this could thus look like

this: But if the site only supports British customers and recipients, it might instead look like this

different form controls used for the purpose: a text control (<input type=text>), a drop-down list (<select>), radio buttons (<input

automatically fill the second field with the value given in the first field when the user gave a

Separate from the choices regarding type and autocomplete, the inputmode attribute decides what kind of input modality (e.g.,

numeric input modality anyway (e.g., a virtual keyboard displaying only digits), the page would

In this pizza delivery example, the times are specified in the format 'HH:MM': two digits for

they are not necessary in this example.) In some locales, however, times are often expressed differently when presented to users.

would typically be written '1/2/03', while that same date in Japan would typically be written as

example, in what punctuation is used as the decimal separator and the thousands separator.

It is therefore important to distinguish the time, date, and number formats used in HTML and in

form submissions, which are always the formats defined in this specification (and based on the

well-established ISO 8601 standard for computer-readable date and time formats), from the time,

date, and number formats presented to the user by the browser and accepted as input from the user

The time, date, or number given by the page in the wire format is then translated to the user's

preferred presentation (based on user preferences or on the locale of the page itself), before

Similarly, after the user inputs a time, date, or number using their

preferred format, the user agent converts it back to the wire format before putting it in the DOM

This allows scripts in pages and on servers to process times, dates, and numbers in a

consistent manner without needing to support dozens of different formats, while still supporting

subtly different) categories in addition to the usual ones like flow content,

have a form content attribute, and a matching form IDL attribute, that allow authors to specify an explicit

form data set when a form element is submitted.

value must not be the empty string, and the value must be unique amongst the form

controls in the form will have their autofill field name set to 'off';

Returns the number of form controls in the form (excluding image buttons for historical

controls) in the form with the given ID or name (excluding image buttons for historical reasons);

are none, returns the img element with the given ID.

Once an element has been referenced using a particular name, that name will continue being

available as a way to reference that element in this method, even if the element's actual ID or name changes, for as long as

whose form owner is the form element, with the exception of input

elements whose type attribute is in the Image Button state, which must, for historical reasons, be

form element, the user agent must return the value returned by the item method on the elements collection, when invoked with the given index as its

Each form element has a mapping of names to elements called the past names

algorithm, in the order obtained from this algorithm: To determine the value of a named property name

for a form element, the user agent must run the following steps: If an element listed in a form element's past names map changes

invoked, the user agent must statically validate the constraints of the

form element, and return true if the constraint validation return a positive

invoked, the user agent must interactively validate the constraints of the

form element, and return true if the constraint validation return a positive

caption can be associated with a specific form control, known as the

label element's labeled control, either using the for attribute, or by putting the form control inside the

The label element's exact default presentation and behavior, in particular what

attribute on listed form-associated elements, and the label element does not have a form content attribute.

list of label elements, in tree order, whose labeled

The input element represents a typed data field, usually with a form

table lists the keywords and states for the attribute — the keywords in the left column map

The subsections that define each type also clearly define in normative 'bookkeeping' sections

these features depends on whether they apply or not, as defined in their various sections (q.v.

content attributes, IDL attributes, methods, and events apply to each state: †

If the control has no selectable text, the select() method results in a no-op, with no

convert a Date object to a string, which are used by max, min, step, valueAsDate,

set to true whenever the user interacts with the control in a way that changes the value.

or removed, if the control's dirty value flag is false, the

empty string otherwise, and then run the current value sanitization algorithm, if one

set to false when the element is created, and must be set to true whenever the user interacts with

boolean attribute that gives the default checkedness of the input element.

elements is to set the dirty value flag and dirty checkedness flag back to false, set the

value of the element to the value of the value content attribute, if there is one, or the empty string

files, and then invoke the value sanitization algorithm, if the type attribute's current state defines one.

agent should not allow the user to modify the element's value or checkedness.

must propagate the value, dirty value flag, checkedness, and dirty checkedness flag from the node being cloned

The activation behavior for input elements are these steps: The legacy-pre-activation behavior for input elements are these

steps: When an input element is first created, the element's rendering and behavior must

attribute's state, and the value sanitization algorithm, if one is defined for the

The disabled attribute is used to make the control non-interactive and to prevent its value from being submitted.

The form attribute is used to explicitly associate the input element with its form owner.

The autocomplete attribute controls how the user agent provides autofill behavior.

min, multiple, pattern, placeholder, required, size, src,

reflect the respective content attribute of the same name, limited to only

The IDL attributes width and height must return the rendered width and height of the

width and height of the image, in CSS pixels, if an image is available but not being rendered to a visual medium;

The autofocus, disabled, form, and name IDL attributes are part of the element's forms API.

Constraint validation: If an input element's type attribute is in the Hidden state, it is barred from constraint

case-sensitive match for the string '_charset_', then the element's value attribute must be omitted.

The input element represents a one line plain text edit control for

platforms where search controls are distinguished from regular text controls, the Search state might result in an appearance consistent with

the platform's search controls rather than appearing like a regular text control.

user to change the writing direction of the element, setting it either to a left-to-right writing

the following steps: The value attribute, if specified, must have a value that

in practice, telephone number fields tend to be free-form fields, because there are a

automatically escape characters entered by the user so that the value is always a valid

absolute URL (even if that isn't the actual value seen and edited by the user in the

user to change the e-mail address represented by its value.

User agents may allow the user to set the value to a string that is not a valid e-mail

The user agent should act in a manner consistent with expecting the user to

convert punycode in the domain labels of the value to IDN in the display and

the user agent cannot convert to punycode, the control is suffering from bad

have a value that is a single valid e-mail address.

of the element is neither the empty string nor a single valid e-mail address, the

editing the e-mail addresses given in the element's values.

user to add, remove, and edit the e-mail addresses represented by its values.

individual value in the list of values to a

string that is not a valid e-mail address, but must not allow users to set any

individual value to a string containing U+002C COMMA (,), U+000A LINE FEED (LF), or U+000D

particular, user agents should convert punycode in the domain labels of the value to IDN in the display and vice versa.

an individual value contains a U+002C COMMA (,) or is representing input that the user agent

cannot convert to punycode, the control is suffering from bad input.

Whenever the user changes the element's values, the user agent must run the following

steps: The value attribute, if specified, must have a value

of the element is not a valid e-mail address list, the element is suffering

syntax for e-mail addresses that is simultaneously too strict (before the '@' character), too

vague (after the '@' character), and too lax (allowing comments, whitespace characters, and quoted

valid e-mail address list is a set of comma-separated tokens, where

tokens from a valid e-mail address list, an implementation must split the string on commas.

The input element represents a one line plain text edit control for

user to change the date represented by its value, as obtained by parsing a

User agents must not allow the user to set the value to a non-empty string that is not a valid date

If the user agent provides a user interface for selecting a date, then the value must be set

agent cannot convert to a valid date string, the control is suffering from bad

the difference between the input format and submission format for date, time, and number form

The value sanitization algorithm is as follows: If the value of the element is not a valid date string, then

When the element is suffering from a step mismatch, the user agent may round the

element's value to the nearest date for which the element would not suffer from a step mismatch.

number, given a string input, is as follows: If parsing a date from input results in an

UTC on the morning of 1970-01-01 (the time represented by the value '1970-01-01T00:00:00.0Z') to midnight UTC on the morning of the parsed date, ignoring leap seconds.

UTC, is current input milliseconds after midnight UTC on the morning of

as follows: Return a valid date string that represents the date current at the time represented by input in the UTC

user to change the month represented by its value, as obtained by parsing a

User agents must not allow the user to set the value to a non-empty string that is not a valid month

If the user agent provides a user interface for selecting a month, then the value must be

set to a valid month string representing the user's selection.

agent cannot convert to a valid month string, the control is suffering from bad

the difference between the input format and submission format for date, time, and number form

The value sanitization algorithm is as follows: If the value of the element is not a valid month string,

When the element is suffering from a step mismatch, the user agent may round the

element's value to the nearest month for which the element would not suffer from a step mismatch.

number, given a string input, is as follows: If parsing a month from input results in an

new Date object representing midnight UTC on the morning of the first day of

as follows: Return a valid month string that represents the month current at the time represented by input in the UTC

user to change the week represented by its value, as obtained by parsing a

User agents must not allow the user to set the value to a non-empty string that is not a valid week

If the user agent provides a user interface for selecting a week, then the value must be set

agent cannot convert to a valid week string, the control is suffering from bad

the difference between the input format and submission format for date, time, and number form

The value sanitization algorithm is as follows: If the value of the element is not a valid week string, then

When the element is suffering from a step mismatch, the user agent may round the

element's value to the nearest week for which the element would not suffer from a step mismatch.

number, given a string input, is as follows: If parsing a week string from input results in

UTC on the morning of 1970-01-01 (the time represented by the value '1970-01-01T00:00:00.0Z') to midnight UTC on the morning of the Monday of the

UTC, is current input milliseconds after midnight UTC on the morning of

Date object, given a string input, is as follows: If parsing a week from input results in an error, then

as follows: Return a valid week string that represents the week current at the time represented by input in the UTC

user to change the time represented by its value, as obtained by parsing a

User agents must not allow the user to set the value to a non-empty string that is not a valid time

If the user agent provides a user interface for selecting a time, then the value must be set

agent cannot convert to a valid time string, the control is suffering from bad

the difference between the input format and submission format for date, time, and number form

The value sanitization algorithm is as follows: If the value of the element is not a valid time string, then

When the element is suffering from a step mismatch, the user agent may round the

element's value to the nearest time for which the element would not suffer from a step mismatch.

number, given a string input, is as follows: If parsing a time from input results in an

input milliseconds after midnight on a day with no time changes.

as follows: Return a valid time string that represents the UTC time component that is represented by input.

value to a string representing a local date and time, with no time-zone offset

selecting a local date and time, then the value must be set to a valid normalized local date and time

agent cannot convert to a valid normalized local date and time string, the control is

the difference between the input format and submission format for date, time, and number form

The value sanitization algorithm is as follows: If the value of the element is a valid local date and time

string, then set it to a valid normalized local date and time string

attribute, if specified, must have a value that is a valid local date and time

When the element is suffering from a step mismatch, the user agent may round the

element's value to the nearest local date and time for which the element would not suffer from a step mismatch.

number, given a string input, is as follows: If parsing a date and time from input results in an error, then return an error;

milliseconds elapsed from midnight on the morning of 1970-01-01 (the time represented by the value

'1970-01-01T00:00:00.0') to the parsed local date and time, ignoring leap seconds.

valid normalized local date and time string that represents the date and time that is

input milliseconds after midnight on the morning of 1970-01-01 (the time

obtained from applying the rules for parsing floating-point number values to it.

provides a user interface for selecting a number, then the value must be set to the best representation of the number representing the user's

agent cannot convert to a valid floating-point number, the control is suffering

user agent vendors are encouraged to consider what would best serve their users' needs.

example, a user agent in Persian or Arabic markets might support Persian and Arabic numeric input

realistically) a user agent designed for the French market might display the value with

apostrophes between thousands and commas before the decimals, and allow the user to enter a value

in that manner, internally converting it to the submission format described above.

The value sanitization algorithm is as follows: If the value of the element is not a valid floating-point

When the element is suffering from a step mismatch, the user agent may round the

there are two such numbers, user agents are encouraged to pick the one nearest positive

number, given a string input, is as follows: If applying the

rules for parsing floating-point number values to input results

is not appropriate for input that happens to only consist of numbers but isn't strictly speaking a

simple way of determining whether to use type=number is to consider whether

Getting a credit card number wrong by 1 in the last digit isn't a minor mistake, it's as

When a spinbox interface is not appropriate, type=text is probably the right choice (possibly with a pattern attribute).

caveat that the exact value is not important, letting UAs provide a simpler interface than they

obtained from applying the rules for parsing floating-point number values to it.

user agent cannot convert to a valid floating-point number, the control is

The value sanitization algorithm is as follows: If the value of the element is not a valid floating-point

number, then set it to the best representation, as a floating-point number, of the default value.

The default value is the minimum plus half the difference between the minimum and the maximum, unless the maximum is less than the minimum, in which case the default value is the minimum.

When the element is suffering from an overflow, if the maximum is not less than the minimum, the user agent must set the element's value to a valid floating-point number that

mismatch, and which is greater than or equal to the minimum, and, if the maximum is not less than the minimum, which is less than or equal to the maximum, if there is a number that matches these constraints.

If two numbers match these constraints, then user agents must use the one nearest to positive

string, given a number input, is as follows: Return the best representation, as a

of using the rules for serializing simple color values to the user's selection.

agent cannot convert to a valid lowercase simple color, the control is

The value sanitization algorithm is as follows: If the value of the element is a valid simple color, then

The control is never a true tri-state control, even if the element's indeterminate IDL attribute is set to true.

event named input at the element, with the bubbles attribute initialized to true, and then fire an event named change

represents the selected control in the group, and if it is false, it indicates a control in the

tree must not contain an input element whose radio button group contains only that element.

When any of the following phenomena occur, if the element's checkedness state is true after the occurrence, the checkedness state of all the other elements in the same radio

button group must be set to false: The input activation behavior is to fire an

event named input at the element, with the bubbles attribute initialized to true, and then fire an event named change

The input element represents a list of selected files, each file consisting of a file

in the case that a user has selected an entire directory hierarchy or multiple files with the same

The element's input activation behavior is to run the following steps: If the element is mutable, the user agent should allow the

fire an event named change at the input element, with the bubbles attribute initialized to true.

Constraint validation: If the element is required and the list of selected files is empty, then the element is

agent could offer the user the option of using a local camera or selecting a photograph from their

are reminded that, as usual, data received from a client should be treated with caution, as it may

not be in an expected format even if the user is not hostile and the user agent fully obeyed the

typically depends on the button's label, the button's width can leak a few bits of fingerprintable

select a coordinate and submit the form, or alternatively a button from which the user can submit

The coordinate is sent to the server during form submission by sending two entries for the element, derived from the name

attribute's value is the empty string, the user agent must parse the value of the src

then: Fetching the image must delay the load event of the element's node document until the

networking task source once the resource has been fetched (defined below) has been

supported image type, and the image is a valid image of that type, then the image is said to be

completely downloaded, each task that is queued by the networking task source while the image is being fetched

rules to determine the type of the image, with the image's associated Content-Type headers giving the official

queue a task to fire an event named load at the input element;

process fails without a response from the remote server, or completes but the image is not a valid

If the src attribute is set, and the image is available and the user agent is configured to display that image,

then: The element represents a control for selecting a coordinate from the image specified by the

if the element is mutable, the user agent should allow the user to select this coordinate, and the element's input

element's node document is fully active, take the user's selected coordinate, and submit the input element's form owner

element's node document is fully active, set the selected coordinate to (0,0), and submit the input element's form

represent the position relative to the edge of the image, with the coordinate space having the

x in the range −(borderleft+paddingleft) ≤ x ≤ width+borderright+paddingright, where width is the rendered width of the image, borderleft is the width of the border on the left of the image, paddingleft is the width of the padding on the left of the

y in the range −(bordertop+paddingtop) ≤ y ≤ height+borderbottom+paddingbottom, where

height is the rendered height of the image, bordertop is the width of the border above the image, paddingtop is the width of the padding above the image, borderbottom is the width of the border below the image, and paddingbottom is the width of the padding below the image, with

typically depends on the button's label, the button's width can leak a few bits of fingerprintable

The formats shown to the user in date, time, and number controls is independent of the format

browser, configured to use the British English locale, only showed the date 03/02 in the ticket purchase date picker.

JavaScript string length of the value of the element's value attribute must be equal to or less than the element's

characters that, in a visual rendering, the user agent is to allow the user to see while editing

non-negative integers, and if the result is a number greater than zero, then the user agent

IDL attribute applies and is in the mode value, and the element is mutable, and the element's value is the empty string, then the element is suffering

with only the 'u' flag specified, compiles successfully, then the resulting regular expression is the element's

Constraint validation: If the element's value is not the empty string, and either the element's multiple attribute is not specified or it does not apply to the input element given its type attribute's current state, and the element has a

compiled pattern regular expression but that regular expression does not match the

Constraint validation: If the element's value is not the empty string, and the element's multiple attribute is specified and applies to the input element, and the element has

a compiled pattern regular expression but that regular expression does not match the

its start anchored to the start of the string and its end anchored to the end of the string.

attribute is matched against the entire value, not just any subset (somewhat as if it implied a

attribute specified, authors should include a title attribute to give a description of the pattern.

Some form controls can have explicit constraints applied limiting the allowed range of values

form control's broadest possible range is finite, and authors can specify explicit ranges within

Specifically, the broadest range of a type=time control is midnight to midnight (24 hours), and

authors can set both continuous linear ranges (such as 9pm to 11pm) and discontinuous ranges

type attribute's current state defines a default minimum, then that is the minimum;

type attribute's current state defines a default maximum, then that is the maximum;

max attribute's value (the maximum) must not be less than the min attribute's value (its minimum).

domain has a maximum that is less than its minimum, then so long as the element has a value, it will either be suffering from an underflow

reversed range, and the result of applying the algorithm to convert a string to a number to

reversed range, and the result of applying the algorithm to convert a string to a number to

convert a string to a number to the string given by the element's value is a number, and the number obtained from that algorithm

defines the default step, the step scale factor, and in some cases the default step base, which are used in processing the

value that is a valid floating-point number that parses to a number that is greater than zero, or must have a

algorithm: Constraint validation: When the element has an allowed value step, and the result of applying the algorithm to convert a string to a number to

the user agent is allowing the user to edit the input element's value, the user agent should offer the suggestions represented by

User agents are encouraged to filter the suggestions represented by the suggestions source element when the number of suggestions is

threshold is defined, but capping the list at four to seven values is reasonable.

based on the user's input, user agents should use substring matching against both the suggestions'

this has historically been an area of confusion for implementers, web developers, and users alike,

accepting a single value only, or whether it accepts multiple values: When the user selects a suggestion, the input element's value must be set to the selected suggestion's value, as if the user had written that value themself.

When the user selects a suggestion, the user agent must either add a new entry to the

existing entry in the input element's values to have the value given by the selected

an entry with that value, or edited an existing entry to be that value.

applied depends on the user interface in a user-agent-defined manner.

the short hint given in the placeholder attribute is shown before the user enters a

User agents should present this hint to the user, after having stripped newlines from it, when the element's value is the empty string, especially if the control is not

focused, then the user agent should nonetheless show the hint for the control if it

set to any value other than the empty string when the control is a file upload control.

attribute is in one of the following modes, which define its behavior: On getting, return the current value of the

On setting, if the new value is the empty string, empty the list of selected files;

On getting, if the valueAsDate attribute does not apply, as defined for the input element's type attribute's current state, then return null.

On setting, if the valueAsDate attribute does not apply, as defined for the input element's type attribute's current state, then throw an

otherwise if the new value is null or a Date object representing the NaN time value,

On getting, if the valueAsNumber attribute does not apply, as defined for the input element's type attribute's current state, then return a Not-a-Number (NaN)

Otherwise, if the valueAsNumber attribute does not apply, as defined for the input element's type attribute's current state, then throw an

(which is the case for all input controls other than buttons and those with the type attribute in the Hidden state), the events are fired to indicate that the

(This is the case for all input controls with the type attribute in the Checkbox state, the Radio Button state, or the File Upload state.) For input elements without a defined input activation behavior, but

interface involves both interactive manipulation and an explicit commit action, then when the user

queue a task to fire an event named input at the input element, with the bubbles attribute initialized to true, and any time the user

commits the change, the user agent must queue a task to fire an event named change

interface involves an explicit commit action but no intermediate manipulation, then any time the

the bubbles attribute initialized to true, and then fire an event named change

An example of a user interface with a commit action would be a Color control that consists of a single button that brings

Another example of a user interface with a commit action would be a Date control that allows both text-based user input and user

selection from a drop-down calendar: while text input might not have an explicit commit step,

Examples of a user changing the element's value would include the user typing into a text control, pasting

cause changes to the value, e.g., hitting the 'delete' key in an empty text control, or replacing

When the user agent is to change an input element's value on behalf of the user (e.g.

feature), the user agent must queue a task to first update the value accordingly, then fire an

the bubbles attribute initialized to true, then fire an event named change

lists the keywords and states for the attribute — the keywords in the left column map to the

the following list for the current state of this element's type attribute, if this element is not disabled, and do nothing otherwise:

The formaction, formenctype, formmethod, formnovalidate, and formtarget must not be specified if the element's type attribute is not in the Submit Button state.

select element represents a control for selecting a single option from

result of applying the rules for parsing non-negative integers to the value of

If applying those rules to the attribute's value is not successful, or if the size attribute is absent, then the element's display size is 4 if the element's multiple content attribute is present, and 1 otherwise.

option elements in the select element's list of options have their selectedness set to true, or the only

option element in the select element's list of options with its selectedness set to true is the placeholder label

through a click, or through unfocusing the element after changing its value, or through a menu command, or through any other mechanism), and before the

click event), the user agent must set the selectedness of the picked option element

option element in the select element's list of options has its selectedness set to true, and whenever an

agent should also allow the user to request that the option whose selectedness is true, if any, be unselected.

request being conveyed to the user agent, and before the relevant user interaction event is queued (e.g.

before the click event), the user agent must set the selectedness of that option element to

If nodes are inserted or nodes are removed causing the list of options to gain or lose one or more

option elements, or if an option element in the list of options asks for

a reset, then, if the select element's multiple attribute is absent, the user agent must run the

be changed (from true to false or false to true), the dirtiness of the element must be set to true, and the

a task, using the user interaction task source, to run these steps: The reset algorithm for select

elements is to go through all the option elements in the element's list of options, set their selectedness to true if the option

The form attribute is used to explicitly associate the select element with its form owner.

The disabled attribute is used to make the control non-interactive and to prevent its value from being submitted.

The autocomplete attribute controls how the user agent provides autofill behavior.

When set to a greater number, adds new blank option elements to the

The before argument can be a number, in which case element is inserted before the item with that number, or an element from the

list of options, in which case element is inserted before that element.

return the string 'select-one' if the multiple attribute is absent, and the string 'select-multiple' if the multiple

is equal to the given new value, if any, must have its selectedness set to true and its dirtiness set to true.

For historical reasons, the default value of the size IDL attribute does not return the actual size used, which, in

option elements are provided inside a select element inside the

The datalist element is hooked up to an input element using the list attribute on the input element.

prevent any click events that are queued on the user interaction task source from being dispatched on the

or fewer arguments, overrides the initial state of the selectedness state to always be false even if the third

The fourth argument can be used to explicitly set the initial selectedness state when using the constructor.

On setting, it must set the element's selectedness to the new value, set its dirtiness to true, and then cause the element to

perform the following steps: The textarea element represents a multiline plain text edit

boolean attribute used to control whether the text can be edited by the user or

should allow the user to edit, insert, and remove text, and to insert and remove line breaks in

Any time the user causes the element's raw value to change, the user agent must queue a

task to fire an event named input at the textarea element, with the bubbles attribute initialized to true.

could wait for the user to have not hit a key for 100ms, so as to only fire the event when the

be set to true whenever the user interacts with the control in a way that changes the raw value.

elements must propagate the raw value and dirty value flag from the node being cloned to the copy.

elements is to set the dirty value flag back to false, and

attribute is specified, its value must be a valid non-negative integer greater than

the attribute's value results in a number greater than zero, then the element's character width is that value;

The user agent may use the textarea element's character width as a hint to the user as to how many

applying the rules for parsing non-negative integers to the attribute's value results

Visual user agents should set the height of the control to the number of lines given by character height.

attribute with two keywords and states: the soft keyword which maps to the Soft state, and the hard keyword which maps to the Hard state.

textarea is to have newlines added by the user agent so that the text is wrapped when

FEED (CRLF) character pairs, and in addition, if necessary given the element's wrap attribute, additional line breaks are inserted to wrap the

normalization transformation is the following algorithm, as applied to a string: The element's value is defined to be the element's raw value with the textarea wrapping

algorithm, as applied to a string: The maxlength attribute is a form control maxlength attribute.

Constraint validation: If the element has its required attribute specified, and the element is mutable, and the element's value is the empty string, then the element is suffering

a short hint (a word or short phrase) intended to aid the user with data entry when the

the short hint given in the placeholder attribute is shown before the user enters a

User agents should present this hint to the user when the element's value is the empty string and the control is not

When the value mode flag is in mode default, the contents of the element represent both

When the value mode flag is in mode value, the contents of the element represent the

Whenever the element's descendants are changed in any way, if the value mode flag is in mode default, the element's default value must be set to the value of the

elements is to set the element's value mode flag to default and then to set the element's

textContent IDL attribute to the value of the element's default value (thus replacing the element's child

On setting, the attribute must set the element's default value, and, if the element's value mode flag is in the mode default, set the element's textContent IDL

waiting for a remote host to respond), or the progress is a number in the range zero to a maximum,

To make a determinate progress bar, add a value attribute with the current progress (either a number from

inside the element, so that the progress is made available to users of legacy user agents.

greater than zero, and less than or equal to the value of the max attribute, if present, or 1.0, otherwise.

If the progress bar is a determinate progress bar and the element has a max attribute, the user agent must parse the max attribute's value according to the rules for parsing

error, or if the parsed value was less than or equal to zero, then the maximum value of the progress bar is 1.0.

If the progress bar is a determinate progress bar, user agents must parse the value attribute's value according to the rules for

If the progress bar is a determinate progress bar, then the current value is the maximum value, if value is greater than the maximum value, and value otherwise.

indeterminate progress bar, and in the former case, should indicate the relative position of the

For a determinate progress bar (one with known current and maximum values), returns the

result of dividing the current value by the maximum value.

If the progress bar is an indeterminate progress bar, then the position IDL attribute must return −1.

If the progress bar is an indeterminate progress bar, then the value IDL attribute, on getting, must return 0.

setting, the given value must be converted to the best representation of the number as a

when the corresponding content attribute is absent would change the progress bar from an

reflect the content attribute of the same name, limited to numbers greater than

range — for example, it would be wrong to use this to report a weight, or height, unless

The other three attributes can be used to segment the gauge's range into 'low', 'medium', and

The following inequalities must hold, as applicable: If no minimum or maximum is specified, then the range is assumed to be 0..1, and

When used with microdata, the meter element's value attribute provides the element's machine-readable value.

User agent requirements: User agents must parse the min, max, value, low, high, and optimum

candidate optimum point is the midpoint between the minimum value and the maximum value.

All of which will result in the following inequalities all being true: UA requirements for regions of the gauge: If the optimum point is equal to the

and high boundaries of the gauge must be treated as the optimum region, and the low and high

boundary, then the region between the minimum value and the low boundary must be treated as the

optimum region, the region from the low boundary up to the high boundary must be treated as a

between the high boundary and the maximum value must be treated as the optimum region, the region

from the high boundary down to the low boundary must be treated as a suboptimal region, and the

element to the user, the UA should indicate the relative position of the actual value to the

minimum and maximum values, and the relationship between the actual value and the three regions of

fieldset if it matches any of the following conditions: The form attribute is used to explicitly associate the

legend has a fieldset element as its parent, then the form IDL attribute must return the same value as the form IDL attribute on that fieldset element.

For instance, if a user enters the word 'three' into a numeric field that expects digits, the user's input would

textarea element, all form control with a value also have an algorithm for obtaining an API value.

that rely on whether an element is so designated) whether or not the user can modify the value or checkedness of a

elements, it is quite possible (e.g., using a script that performs DOM manipulation) to generate

element element, it must run the following steps: Returns the element's form owner.

IDL attribute, which, on getting, must return the element's form owner, or null if

form control, as used in form submission and in the form element's elements object.

avoid problematic reinterpretations in legacy user agents, the name isindex

The name _charset_ is special: if used as the name of a Hidden control with no value attribute, then during submission the value attribute is automatically given a value consisting of the

If an element has its form control maxlength attribute specified, the attribute's value must be a valid

parsing non-negative integers to its value results in a number, then that number is the

length, its dirty value flag is true, its value was last changed by a user edit (as opposed to a change

made by a script), and the JavaScript string length of the element's API value is greater than the element's maximum allowed

User agents may prevent the user from causing the element's API value to be set to a value whose JavaScript string

applied before the maximum allowed value length is checked (whereas the

If an element has its form control minlength attribute specified, the attribute's value must be a valid

parsing non-negative integers to its value results in a number, then that number is the

value length, the minimum allowed value length must be smaller than or equal

length, its dirty value flag is true, its value was last changed by a user edit (as opposed to a change

The corresponding attributes for form submission that may be specified on submit buttons are formaction, formenctype, formmethod, formnovalidate, and formtarget.

formaction attribute, if the element is a submit button and has such an attribute, or the value of its

The method and formmethod content attributes are enumerated attributes with the following keywords and

element is a submit button and has a formmethod attribute, then the element's method is that attribute's state;

The enctype and formenctype content attributes are enumerated attributes with the following keywords and

If the element is a submit button and has a formenctype attribute, then the element's enctype is that attribute's state;

element is a submit button and the element's formnovalidate attribute is present, or if the element's

content attribute is missing or its value is the empty string, the element's node

author to indicate that a control is to be focused as soon as the page is loaded or as soon as the

dialog within which it finds itself is shown, allowing the user to just start typing

An element's nearest ancestor autofocus scoping root element is the element itself

should run the following steps: This handles the automatic focusing during document load.

User agents sometimes have features for helping users fill forms in, for example prefilling the

When wearing the autofill anchor mantle, the autocomplete attribute describes the meaning of the given

When wearing the autofill expectation mantle, the autocomplete attribute, if specified, must have a value that

is an ordered set of space-separated tokens consisting of either a single token that

mantle, the autocomplete attribute, if specified, must have a value that is an ordered set of

Autofill detail tokens are the following, in the order given below: As noted earlier, the meaning of the attribute and its keywords depends on the mantle that the

that the control's input data is particularly sensitive (for example the activation code for a

bank login) and the user will therefore have to explicitly enter the data each time, instead of

autocomplete mechanism and does not want the user agent to provide autocompletion values.

user agent is allowed to provide the user with autocompletion values, but does not provide any

further information about what kind of data the user might be expected to enter.

The autofill field listed above indicate that the user agent is allowed to

provide the user with autocompletion values, and specifies what kind of value is expected.

value corresponding to the state of the element's form owner's autocomplete attribute is used instead (either 'on' or 'off').

listed on a row of this table corresponds to the meaning given in the cell for that row in the

credit card expiry date can be expressed as one field giving both the month and year of expiry

the broader fields cover multiple rows, in which the narrower fields are defined.

common in some Western cultures to have a given name and a family name, in that order (and thus

does not belong to the group listed for that autofill field in the fifth column of

The groups correspond to controls as follows: Address levels: The 'address-level1' – 'address-level4' fields are used to describe

example, the US uses two levels (state and town), the UK uses one or two depending on the address

prefecture (level 1) precedes the city (level 2) which precedes the district (level 3).

are encouraged to provide forms that are presented in a way that matches the country's conventions

(hiding, showing, and rearranging fields accordingly as the user changes the country).

Each input element to which the autocomplete attribute applies, each select element, and each textarea element, has an

autofill hint set, an autofill scope, an autofill field name, and

The autofill field name specifies the specific kind of data expected in the field,

The autofill hint set identifies what address or contact information type the user

The autofill scope identifies the group of fields whose information concerns the

These values are defined as the result of running the following algorithm: For the purposes of autofill, a control's data depends on the kind of control: How to process the autofill hint set, autofill scope, and

autofill field name depends on the mantle that the autocomplete attribute is wearing.

data, and may offer previously stored values to the user.

determine the most appropriate values to offer the user, e.g.

When the autofill field name is one of the names of the autofill fields described above, the user agent should provide suggestions that

match the meaning of the field name as given in the table earlier in this section.

autofill hint set should be used to select amongst multiple possible suggestions.

subsequent forms only the first address would be suggested for form controls whose autofill

however, for address-related form controls whose autofill hint set does not contain

act as if the user had specified the control's data for the given autofill

hint set, autofill scope, and autofill field name

owner and autofill scope, and the user agent has a value for the country' field(s), then the 'country-name' field(s) must be filled using a

Suppose a user agent knows of two phone numbers, +1 555 123 1234 and +1 555 666

It would not be conforming for the user agent to fill a field with autocomplete='shipping tel-local-prefix' with the value '123' and another field

Similarly, if a form for some reason contained both a 'cc-exp' field and a 'cc-exp-month' field, and the user agent

user agents must not attempt to derive meaning from the precise values of these tokens.

user agent prefilling a form control must not discriminate between form controls that are

suffer from being too short, suffer from an underflow, suffer from an overflow, or suffer from a step mismatch.

A user agent prefilling a form control's value must not cause that control to suffer from a pattern mismatch either.

control's constraints, user agents must use the format given as canonical in the aforementioned

user agent may allow the user to override an element's autofill field name, e.g.

name of form controls that match the description given in the first column of the following

table, when their autofill field name is either 'on' or 'off', with the value given in the second cell of that

descriptions below refer to form controls being preceded or followed by others, they mean in the

is omitted, it will be reset to be the platform default (none or forward).

To set the selection direction of an element to a given direction, update the element's

selection direction to the given direction, unless the direction is 'none' and the platform does not support that direction;

null or the special value infinity end, and optionally a string direction,

selection or a text entry cursor position at all times (even for elements that are not being

constraint validation if it is an object element.) An element can have a custom validity error message defined.

agent should use the custom validity error message when alerting the user to the

result (there are invalid controls) along with a (possibly empty) list of elements that are

invalid and for which no script has claimed responsibility: If a user agent is to interactively validate the constraints of form

element form, then the user agent must run the following steps: Returns true if the element will be validated when the form is submitted;

message to be shown to the user when reporting the problem to the user.

Returns true if the user has provided input in the user interface that the user agent is

true if the corresponding condition given in the following list is true, and false otherwise.

be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user

For example, take the following form: If the user types in 'cats' in the first field and 'fur' in the second, and then hits the

On the other hand, consider this form: Given the same user input, the result on submission is quite different: the user agent instead

form element's default button is the first submit button in tree order whose form

If the user agent supports letting the user submit a form implicitly (for example, on some

platforms hitting the 'enter' key while a text control is focused implicitly submits

form owner is that form element and whose type attribute is in one of the following states:

(typically a button), optionally with a submitted from submit() method flag set, the user agent must run the

following steps: The algorithm to construct the form data set for a form

form data set and encoding, is as follows: For details on how to interpret multipart/form-data payloads, see RFC 7578.

set and encoding, is as follows: Payloads using the text/plain format are intended to be human readable.

When a form element form is reset, run these steps: Each resettable element defines its own reset algorithm.

these algorithms do not count as changes caused by the user (and thus, e.g., do not cause input events to fire).

child summary element, the user agent should provide its own legend (e.g.

The user agent should allow the user to request that the additional information be shown or

To honor a request for the details to be shown, the user agent must set the open attribute on the element to the empty string.

request for the information to be hidden, the user agent must remove the open attribute from the element.

a details element, the user agent must queue a task that runs the

following steps, which are known as the details notification task steps, for this

Commands are defined to have the following facets: User agents may expose the commands that match the following criteria: User agents are encouraged to do this especially for commands that have Access Keys, as a way to advertise those keys to the

the element or one of its ancestors is inert, or if the element's disabled state is set, and false otherwise.

the element or one of its ancestors is inert, or if the element's disabled state is set, and false otherwise.

If the option's nearest ancestor select element has a multiple attribute, the Action of the command is to toggle the option element.

label element in tree order whose labeled control is the

steps: The dialog element represents a part of an application that a user interacts with

default rendering implement this requirement using the CSS rules described in the rendering section.

the user agent must run the following steps: The dialog focusing steps for a dialog element subject are as follows: If at any time a dialog element is removed from a Document, then if that dialog is in that

When a dialog element subject is to be closed, optionally with a return value result, the user agent

it is in that mode and has new rendering boxes created, the user agent must set up the element

dialog element's parent changes block flow direction, then the user

agent must recreate the element's boxes, recalculating its edge that corresponds to this

alignment must remain the element's static position of that edge until its boxes are

'static'.) User agents in visual interactive media should allow the user to pan the viewport

The script element allows authors to include dynamic script and data blocks in

scripts may either be embedded inline or may be imported from an external file using the

inline script elements, or the external script resource, must conform with the

This allows selective execution of module scripts in modern user agents and classic scripts in older user agents, as shown

attribute has no effect on module scripts.) This is all summarized in the following schematic diagram:

below (in this section) describe the core of this processing, but these algorithms reference and

are referenced by the parsing rules for script start and end tags in HTML, in foreign content,

The defer attribute may be specified even if the async attribute is specified, to cause legacy Web browsers that

only support defer (and not async) to fall back to the defer behavior instead of the blocking behavior that

it controls whether error information will be exposed, when the script is obtained from other origins.

[SRI] Changing the src, type, nomodule, async, defer, crossorigin, and integrity attributes dynamically has no direct effect;

content attribute must be removed if the IDL attribute's new value is false, and must be set to

steps for script elements must set the 'already started' flag on the copy if

addition, whenever a script element whose 'non-blocking' flag is set

experiences one of the events listed in the following list, the user agent must

continues blocking that parser until the condition that causes it to be blocking the parser no

parser until the style sheets are all loaded, at which time the script executes and the parser is

if a language other than JavaScript comes along and gets similar wide adoption by web browsers.

The easiest and safest way to avoid the rather strange restrictions described in

this section is to always escape '<!--' as '<\!--', '<script' as '<\script', and '</script' as '<\/script' when these sequences appear in literals in scripts (e.g.

strings, regular expressions, or comments), and to avoid writing code that uses such constructs in

triggering: namely, that, for historical reasons, parsing of script blocks in HTML is

for implementers, based on existing implementations: The main distinction between the first two cases and the last case is that the first two

markup to user agents that support scripting and those that don't support scripting, by affecting

that running the following algorithm results in a conforming document with no

noscript elements and no script elements, and such that no step in the

algorithm throws an exception or causes an HTML parser to flag a parse

error: All these contortions are required because, for historical reasons, the

is created, the user agent must run the following steps to establish the template

The name attribute is used to assign slots to other elements: a slot element with a

name attribute creates a named slot to which any element is assigned if that element has a slot attribute whose

method, when invoked, must run these steps: The canvas element provides scripts with a resolution-dependent bitmap canvas,

which can be used for rendering graphs, game graphics, art, or other visual images on the fly.

render a page heading: if the desired presentation of the heading is graphically intense, it

should be marked up using appropriate elements (typically h1) and then styled using

visual medium and is now being printed, or if some script that ran during the page layout process

canvas keyboard-accessible: authors should have a one-to-one mapping of interactive regions to focusable areas in the fallback content.

effect on mouse interaction events.) [UIEVENTS] An element whose nearest canvas element ancestor is being rendered

The user agent must use a square pixel density consisting of one pixel of image data per

what kind of rendering context it is, a canvas also has a canvas context mode, which is initially none but can be changed to either placeholder, 2d, bitmaprenderer, or webgl by algorithms defined in this specification.

an intrinsic height equal to the numeric value of the element's height attribute, those values being interpreted in CSS pixels, and being updated as the attributes are set, changed, or

paint source whose width is the element's intrinsic width, whose height

redundantly set to the value they already have, then the user agent must perform the action

from the row of the following table that corresponds to the canvas element's context mode.

initialized with another context type (e.g., trying to get a '2d' context after getting a 'webgl' context).

quality (such as 'image/jpeg'), and is a number in the range 0.0 to 1.0 inclusive

indicating the desired quality level for the resulting image.

was really returned in the requested format by checking to see if the returned string starts

which case the result might simply be 'data:,'.) Creates a Blob object representing a file containing the image in the canvas,

quality (such as 'image/jpeg'), and is a number in the range 0.0 to 1.0 inclusive

indicating the desired quality level for the resulting image.

placeholder for an OffscreenCanvas object, its intrinsic size can no longer be

when invoked, must run these steps: To maintain compatibility with existing Web content, user agents need to

provided and set to false, then the canvas is forced to always be opaque.

fixed to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any

always results in opaque black pixels, every fourth byte from getImageData() is always 255, the putImageData() method effectively ignores every

Cartesian surface whose origin (0,0) is at the top left corner, with the coordinate space having

x values increasing when going right, and y values increasing when going

instance, the user agent may internally use bitmaps with four device pixels per unit in the

similarly be implemented using oversampling with bitmaps of a higher resolution than the final

canvas element) and options, consists of running these steps: When the user agent is to set bitmap

dimensions to width and height, it must run these steps: The canvas attribute must return the

a point is considered to be outside a shape if the number of times a half-infinite straight

line drawn from that point crosses the shape's path going in one direction is equal to the

number of times it crosses the path going in the other direction.

a point is considered to be outside a shape if the number of times a half-infinite straight

line drawn from that point crosses the shape's path is even.

implementations can, instead of updating this bitmap, merely remember the sequence of drawing

or to enable double buffering so that graphics updates, like page scrolling for example, can be

Drawing states consist of: The current default path and the rendering context's bitmaps are not

must pop the top entry in the drawing state stack, and reset the drawing state it describes.

clear the drawing state stack and everything that drawing state consists of to

setting, zero, negative, infinite, and NaN values must be ignored, leaving the value unchanged;

When the lineJoin attribute has the value 'miter', strokes use the miter limit ratio to decide how to render joins.

invoked, it must return a sequence whose values are the values of the object's dash

(defined in this section) that control how text is laid out (rasterized or outlined) by the

value (but without supporting property-independent style sheet syntax like 'inherit'), and

forced to 'normal', with the 'font-size' component converted to CSS pixels, and with system fonts being computed to explicit values.

new value is syntactically incorrect (including using property-independent style sheet syntax like

any fonts embedded using @font-face or loaded using FontFace objects that are visible to the

is used before it is fully loaded, or if the font style source object does not have

[CSSFONTS] [CSSFONTLOAD] On getting, the font attribute must return the serialized form of the current font of the context (with

set to lengths using percentages, 'em' or 'ex' units, or the 'larger' or

'font-size' property of the font style source object at the time that

The keywords map to these alignment points as follows: The direction attribute's allowed keywords are

space, a physical alignment whose value is one of left, right, and

curved line segments, and a flag indicating whether the subpath is closed or not.

flag is set, certain APIs create a new subpath rather than extending the previous one.

Adds an arc with the given control points and radius to the current subpath, connected to the

described by the arguments, starting at the given start angle and ending at the given end angle,

going in the given direction (defaulting to clockwise), is added to the path, connected to the

described by the arguments, starting at the given start angle and ending at the given end angle,

going in the given direction (defaulting to clockwise), is added to the path, connected to the

interfaces, the points passed to the methods, and the resulting lines added to current

default path by these methods, must be transformed according to the current transformation matrix before being added to

method, when invoked, must run these steps: When the user agent is to ensure there is a subpath for a coordinate (x,

does, then the user agent must create a new subpath with the point (x, y) as

closed, create a new subpath whose first point is the same as the previous subpath's first point,

equivalent to adding a straight line connecting the last point back to the first point of the last

y2, radius) method, when invoked, must run these steps: The arc(x, y, radius,

h) method, when invoked, must run these steps: Path2D objects can be used to declare paths that are then later used on

described in earlier sections, Path2D objects have methods to combine paths, and to

canvas, followed by a rotation transformation that rotates drawing operations by a quarter turn,

and a rectangle twice as wide as it is tall is then drawn on the canvas, the actual result will be

taken in particular with the order of the second and third arguments (b and

This union type allows objects implementing any of the following interfaces to be used as image

CanvasRenderingContext2D APIs, and the source image's dimensions must be the intrinsic width and intrinsic height of the media resource

rendered and that element has been resized, the original image data of the source image

parsing the value results in failure, then it must be ignored, and the attribute must retain its

value is a string, computed as follows: if it has alpha equal to 1.0, then the string is a

lowercase six-digit hex value, prefixed with a '#' character (U+0023 NUMBER SIGN), with the first

two digits representing the red component, the next two digits representing the green component,

and the last two digits representing the blue component, the digits being ASCII lower hex digits.

the red component (using ASCII digits in the shortest form possible), a literal

greater than zero then a U+002E FULL STOP (representing the decimal point), if the alpha value is

the level of precision necessary for the alpha value, when reparsed, to be interpreted as the same

linear gradient that paints along the line given by the

radial gradient that paints along the cone given by the circles

y0, x1, y1) method takes four arguments that

represent the start point (x0, y0) and end point (x1,

crosses the start and end points have the color at the point where those two lines cross (with the

The points in the linear gradient must be transformed as described by the current transformation matrix when rendering.

takes six arguments, the first three representing the start circle with origin (x0,

y0) and radius r0, and the last three representing the end circle with

Radial gradients must be rendered by following these steps: This effectively creates a cone, touched by the two circles defined in the

creation of the gradient, with the part of the cone before the start circle (0.0) using the color

of the first offset, the part of the cone after the end circle (1.0) using the color of the last

offset, and areas outside the cone untouched by the gradient (transparent black).

The resulting radial gradient must then be transformed as described by the current transformation matrix when rendering.

repetition) method, when invoked, must run these steps: Modifying the image used when creating a CanvasPattern object

when invoked, must run these steps: When a pattern is to be rendered within an area, the user agent must run the following steps to

determine what is rendered: If a radial gradient or repeated pattern is used when the transformation matrix is singular,

second two give the width w and height h of the rectangle, respectively.

applied to the following four coordinates, which form the path that must then be closed to get the

specified rectangle: (x, y), (x+w, y), (x+w, y+h), (x, y+h).

w, h) method, when invoked, must run these steps: If either height or width are zero, this method has no effect, since the set of

w, h) method, when invoked, must run these steps: If both w and h are zero, the path has a single subpath

thus has no effect (the trace a path algorithm returns an empty path in that

a single subpath consisting of two points, with coordinates (x, y) and (x+w, y+h), in that order, connected by a single straight line.

Otherwise, the path has a single subpath consisting of four points, with coordinates (x, y), (x+w, y), (x+w,

provided, the text will be scaled to fit that width if necessary.

are invoked, the user agent must run these steps: The measureText() method takes one

canvas element (even if 'using a font' means just checking if that font has a

particular glyph in it before falling back to another font), then the method, when invoked, must

particular with slanted fonts where characters overhang their advance width.

The distance parallel to the baseline from the alignment point given by the textAlign attribute to the right side of the bounding

indicating a distance going right from the given alignment point.

bounding rectangle of all the fonts used to render the text, in CSS

a consistent height even if the exact text being rendered changes.

its corresponding attribute for the descent) are useful when drawing a bounding box around

the given text is just a single comma ',' would likely (unless the font is

font size (the em square size) and the width returned by measureText() (the text width).

current fill style, obeying the given fill rule.

path, using the given fill rule to determine what points are in the path.

path, using the given fill rule to determine what points are in the path.

current default path or the given path, given the current stroke style.

must empty the list of subpaths in the context's current default path so that the it

overlapping parts of the paths in one stroke operation are treated as if their union was what was

of transformations is described above and varies based on which path is being used.) The clip() method, when invoked, must

create a new clipping region by calculating the intersection of the current clipping

region and the area described by the intended path, using the fill rule indicated by

passed to the method, when treated as coordinates in the canvas coordinate space unaffected by the

current transformation, is inside the intended path as determined by the fill rule

be implicitly closed when computing the area inside the path, without affecting the actual

passed to the method, when treated as coordinates in the canvas coordinate space unaffected by the

current transformation, is inside the path that results from tracing the intended path, using the nonzero winding rule, and using the

default path or the given path, following the platform conventions for focus rings.

useful on devices with small screens, where the whole canvas might not be visible at once.

method, when invoked, must run these steps: User agents should not implicitly close open subpaths in the intended path when drawing the

axis-aligned bounding rectangle around the points in the intended path, then whether the subpaths

focus rings are to be drawn: user agents are expected to honor their platform's native

method, when invoked, must run these steps: 'Inform the user', as used in this section, does not imply any persistent state

technologies such as magnification tools so that the user's magnifier moves to the given area of

needs to be exactly the width times the height times 4.

data and dimensions can't be interpreted consistently, or if either dimension is zero.

well as the shadow attributes, are ignored for the purposes of this method call;

canvas are replaced wholesale, with no composition, alpha blending, no shadows, etc.

and its second and optional third arguments being numeric arguments sw and

absolute magnitude of sw, and parameter rows set to the absolute magnitude

object passed as the argument, and the rows parameter set to the value of the

Set the pixel values of the image data of the newly created ImageData object to

whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx,

positive integer number of rows rows, a positive integer number of pixels per row

steps, given value and serialized, are: Their deserialization steps, given serialized and value,

by row top to bottom, starting with the top left, with each pixel's red, green, blue, and alpha

this array must be in the range 0..255, representing the 8 bit value for that component.

components must be assigned consecutive indices starting with 0 for the top left pixel's red

values 0, 0, the width member of the imagedata structure, and the height

The method, when invoked, must act as follows: Due to the lossy nature of converting to and from premultiplied alpha color

their pixels don't line up exactly with the display, when scaling images up.

set to the new value, except if the value is infinite or NaN, in which case the new value must be

to the new value, except if the value is negative, infinite or NaN, in which case the new value

When shadows are drawn, they must be rendered as follows: If the current composition operation is copy, then shadows

if the new value is 'none' (not the empty string, null, or undefined), filters must be disabled

syntax like 'inherit' or 'initial' is considered an invalid value, then it must be ignored, and

equivalent to one SVG user space unit and to one canvas coordinate space unit.

lengths using percentages or using 'em' or 'ex' units, these must be

of the font style source object at the time that the attribute is set, if it is an

SVG filter in the same document, and this SVG filter changes, then the changed filter is used for

filter has finished loading, authors might wish to determine whether such a filter

When a shape or image is painted, user agents must follow these steps, in the order given (or

act as if they do): When compositing onto the output bitmap, pixels that would fall outside of the

fallback content corresponding to each focusable part of the canvas, as in the example above.

When rendering focus rings, to ensure that focus rings have the appearance of native focus

Doing so has a large number of disadvantages: This is a huge amount of work, and authors are most strongly encouraged to avoid doing any of

canvas, for example, would result in two copies of the decoded image existing in memory at the

provided and set to false, then the canvas is forced to always be opaque.

is bound with a transparent black bitmap whose size corresponds to the width and height

opaque black bitmap of the same size using the source-over composite operation.

method, when invoked, must run these steps: OffscreenCanvas objects are used to create rendering contexts, much like an

whose bitmap's size is determined by the width and height arguments.

trying to get a '2d' context after getting a

has a context mode, which is initially none but can be changed to either 2d, webgl or detached by algorithms defined in this

array of transparent black pixels of the dimensions specified by width and

invoked, must run these steps: These attributes return the dimensions of the OffscreenCanvas object's bitmap.

new, transparent black bitmap of the specified dimensions (effectively resizing

new transparent black bitmap and reset the rendering context to its default

The new bitmap's dimensions are equal to the new values of the width and height attributes.

field specifies the file format and has a default value of 'image/png';

quality (such as 'image/jpeg'), then the quality field is a number in the range 0.0

to 1.0 inclusive indicating the desired quality level for the resulting image.

when invoked, must run the following steps: The OffscreenCanvasRenderingContext2D object is a rendering context for drawing to

OffscreenCanvasRenderingContext2D object has its alpha flag set to false, then its alpha channel must be

fixed to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any pixel

must run the following steps: Implementations are encouraged to short-circuit the graphics update steps of

to a graphics buffer that is mapped to the physical display location of the placeholder canvas element.

similar short-circuiting approaches can significantly reduce display latency, especially in cases

images with their own gamma correction and color space information onto a bitmap, to convert the

In user agents that support CSS, the color space used by a canvas element must

The gamma correction and color space information of images must be handled in such a way that

an image rendered directly using an img element would use the same colors as one

of images that have no color correction information (such as those returned by the toDataURL() method) must be rendered with no color

Thus, in the 2D context, calling the drawImage() method to render the output of the toDataURL() method to the canvas, given the appropriate

quality, it must create an image file in the format given by type, or if

[PNG] The image file's pixel data must be the bitmap's pixel data scaled to one image pixel per

coordinate space unit, and if the file format used supports encoding resolution metadata, the

user agent track how the bitmap was generated, an unlikely, though potentially awesome,

If the user agent does not support the requested type, then it must create the file using the PNG

image composited onto a solid black background using the source-over operator.

0.0 to 1.0 inclusive, the user agent must treat quality as the desired quality level.

is outside that range, the user agent must use its default quality value, as if the

destination canvas element's bitmap will have its origin-clean flags set to false by drawImage if the source image is an

documents, with application-specific behavior added after the fact by scripting or similar, such

fully explaining the behaviors of HTML's existing elements, we hope to shrink this gap over

define a custom element that encapsulates rendering a small icon for a country flag.

The parser, whenever it sees the flag-icon tag, will construct a new instance of our FlagIcon class, and tell our code about its new country

attribute, which we then use to set the element's internal state and update its rendering (when

existing behaviors of HTML elements can unfortunately not be duplicated by using purely autonomous custom elements.

custom construction behavior, lifecycle hooks, and prototype chain onto existing elements,

because user agents and other software key off an element's local name in order to identify the

In this example, we'll be creating a customized built-in element named plastic-button, which behaves like a normal button but gets fancy animation

this time we extend HTMLButtonElement instead of HTMLElement: When defining our custom element, we have to also specify the extends

option: In general, the name of the element being extended cannot be determined simply by looking at

the is attribute on a button element: Trying to use a customized built-in element as an autonomous custom

form of createElement(): And as before, the constructor will also work: Note that when creating a customized built-in element programmatically, the is attribute will not be present in the DOM, since it was not explicitly

apply to such 'plastic buttons' as well: their focus behavior, ability to participate in form submission, the disabled attribute, and so on.

existing HTML elements defined in this specification, and cannot extend legacy elements such as

element was defined that extended a currently-unknown element, for example combobox, this would prevent this specification from defining a combobox element in the future, as consumers of the derived customized

As specified below, and alluded to above, simply defining and using an element called

or accessibility technology will not automatically treat the resulting element as a button just

autonomous custom element, a number of techniques would need to be employed: With these points in mind, a full-featured taco-button that took on the

responsibility of conveying button semantics (including the ability to be disabled) might look

there is no way to specify default accessibility semantics or focus behavior for custom elements,

nontrivial behavior and semantics that build on top of existing elements of HTML, customized built-in elements will be easier to

asynchronously: The definition for the img-viewer element here is loaded using a

Once the script loads, it will define the img-viewer element, and the existing img-viewer element on

the page will be upgraded, applying the custom element's definition (which presumably includes

applying an image filter identified by the string 'Kelvin', enhancing the image's visual

authors are bound by the following conformance requirements: Several of these requirements are checked during element

done inside a constructor-initiated microtask, as a microtask checkpoint can occur immediately after construction.

element definition: An autonomous custom element does not have any special meaning: it

the element's author, may be specified on an autonomous custom element, so long as

will return either a custom element definition or null: Each Window object is associated with a unique instance of a

specification look up elements in the registry by any of name, local name, or constructor.

options) method must run these steps: When invoked, the get(name) method must run these

element, run the following steps: To try to upgrade an element, given as

are invoked is done with special care, to avoid running author code during the middle of delicate

composite operations (like cloning, or range manipulation), they will instead be delayed until after all

the relevant user agent processing steps have completed, and then run together as a batch.

element reaction code can perform its own mutations, it is not possible to give a global

ordering guarantee across multiple elements.) Each unit of related similar-origin browsing contexts has a custom element

(The elements are not necessarily custom yet, since this queue is used for upgrades as well.) Each custom element reactions stack has an associated backup element

item in the custom element reaction queue is of one of two types: This is all summarized in the following schematic diagram:

element, run the following steps: To enqueue a custom element callback reaction, given a custom

arguments args, run the following steps: To enqueue a custom element upgrade reaction, given an element

following steps: To invoke custom element reactions in an element queue

queue, run the following steps: To ensure custom element reactions are

steps in order to appropriately track and invoke custom element reactions.

Operations, attributes, setters, or deleters annotated with the [CEReactions] extended attribute must run the following steps in place

of the ones specified in their description: Any nonstandard APIs introduced by the user agent that could modify the DOM in such a way as to

custom element upgrade reaction, for example by modifying any attributes or child elements,

The main content of a page — not including headers and footers, navigation links,

sidebars, advertisements, and so forth — can be marked up in a variety of ways, depending on

Another way to think of this is that the body elements marks up the main content of

are encouraged to either mark up such lists using ul elements with explicit inline

counts that are then hidden and turned into a presentational effect using a style sheet, or to use

minutes, chat transcripts, dialogues in screenplays, instant message logs, and other situations

currently discouraged as many user agents do not expose the attribute in an accessible manner as

tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a

is one of the following: This definition is used to determine what elements can be focused and which elements match the :enabled and :disabled

This includes: Selectors defines that ID and class selectors (such as #foo and .bar), when matched against elements in documents

attribute, all area elements that have an href attribute, and all link elements that have

HTML user agent must use the first relevant entry in the following list.

element by pressing the space bar, the element would match this pseudo-class in

between the time that the element received the keydown

event and the time the element received the keyup event.

begins to indicate an intent to trigger the element's activation behavior and

either the time the user stops indicating an intent to trigger the element's activation

behavior, or the time the element's activation behavior has finished

element using a pointing device while that pointing device is in the 'down' state (e.g.

mouse, between the time the mouse button is pressed and the time it is depressed;

in a multitouch environment, while the finger is touching the display surface).

must consider an element as being one that the user designates if it is: For the purposes of the CSS :focus

context has the system focus, it is not itself a browsing context container,

and it is one of the elements listed in the focus chain of the currently focused area of the

optgroup, option, or fieldset element that is not actually disabled.

element falling into one of the following categories: The :indeterminate pseudo-class

must match any element falling into one of the following categories: The :default pseudo-class must match any

element falling into one of the following categories: The :invalid pseudo-class must match any

element falling into one of the following categories: The :in-range pseudo-class must match

any element falling into one of the following categories: The :optional pseudo-class must match

any element falling into one of the following categories: The :read-write pseudo-class must

match any element falling into one of the following categories, which for the purposes of

This specification does not define when an element matches the :lang() dynamic pseudo-class, as it is defined in

allow generic scripts to provide services that are customized to the page, or to enable content

allows nested groups of name-value pairs to be added to documents, in parallel with the existing

Similarly, for date- and time-related data, the time element and its datetime attribute can be used instead.

Properties can also themselves be groups of name-value pairs, by putting the itemscope attribute on the element that declares the property.

Properties that are not descendants of the element with the itemscope attribute can be associated with the item using the itemref attribute.

This attribute takes a list of IDs of elements to crawl in addition to crawling the children of

contexts where other authors and readers are able to cooperate to make new uses of the markup.

The type for an item is given as the value of an itemtype attribute on the same element as the itemscope attribute.

class of an individual, while a property named 'class' given for an item with the type

be given for a single item by listing the URLs as a space-separated list in the attribute' value.

identifier in an unambiguous way by expressing the global identifiers as URLs given in an itemid attribute.

When designing new vocabularies, identifiers can be created either using URLs, or, for properties, as plain words (with no dots or colons).

plain words, they are not intended to be globally unique, and are instead only intended for

item types, or otherwise deconstruct them, in order to determine how to process

support global identifiers for items may also have an itemid attribute specified, to give a global identifier for

its element's itemid attribute, if it has one, parsed relative to the node document of the element on

with an itemscope attribute whose itemtype attribute specifies a vocabulary that does not support

global identifier (whether on the same page or on different pages) are allowed to exist, and what

the processing rules for that vocabulary are with respect to handling the case of multiple items

allows authors to mark up data in a table so that each column defines a separate item, while keeping the properties in the cells.

Every HTML element may have an itemprop attribute specified, if doing so adds one or more properties to one or more items (as defined below).

The property names of an element are the tokens that the element's itemprop attribute is found to contain when its value is split on ASCII whitespace, with the order

matching case in the following list: The value is the item created by the element.

The value is the resulting URL string that results from parsing the value of the element's src attribute relative to

the node document of the element at the time the attribute is set, or the empty

The value is the resulting URL string that results from parsing the value of the element's href attribute relative to

the node document of the element at the time the attribute is set, or the empty

The value is the resulting URL string that results from parsing the value of the element's data attribute relative to

the node document of the element at the time the attribute is set, or the empty

'books whose titles look like URLs' which had a 'title' property defined to take a URL, then the

such that there are no cycles in the graph formed from representing each item in the Document as a node in the graph and each

property of an item whose value is another item as an edge in the graph connecting

The value must be an item with zero or more of each of the family-name, given-name, additional-name, honorific-prefix, and honorific-suffix properties.

Any number of properties with the name family-name may be present within the item that forms the value of the n property of

may be present within the item that forms the value of the n property of

Any number of properties with the name additional-name may be present within the item that forms the value of the n property of

Any number of properties with the name honorific-prefix may be present within the item that forms the value of the n property of

Any number of properties with the name honorific-suffix may be present within the item that forms the value of the n property of

post-office-box, extended-address, and street-address properties, and optionally a locality property, optionally a region property, optionally a postal-code property, and optionally a country-name property.

If no type properties are present within an item that forms the value of an adr property

of an item with the type http://microformats.org/profile/hcard, then the address type string work is

present within the item that forms the value of an adr property

of an item with the type http://microformats.org/profile/hcard, but within each such adr property item there must only

Any number of properties with the name post-office-box may be present within the item that forms the value of an adr property

Any number of properties with the name extended-address may be present within the item that forms the value of an adr property

Any number of properties with the name street-address may be present within the item that forms the value of an adr property

present within the item that forms the value of an adr property

present within the item that forms the value of an adr property

be present within the item that forms the value of an adr property

may be present within the item that forms the value of an adr property

interpreted as a telephone number as defined in the CCITT specifications E.163 and X.121, or an

item with zero or more type properties and exactly one value property.

[E163] [X121] If no type properties are present within an item that forms the value of a tel property

present within the item that forms the value of a tel property

of an item with the type http://microformats.org/profile/hcard, but within each such tel property item there must only

present within the item that forms the value of a tel property

following syntax: Any number of properties with the name tz may be present

following syntax: The optional components marked with an asterisk (*) should be included, and should have six

location north and south of the equator as a positive or negative real number, respectively.

Exactly one property with the name organization-name must be present within the item that forms the value of an org property

Any number of properties with the name organization-unit may be present within the item that forms the value of the org

present within each item with the type http://microformats.org/profile/hcard if the item also has a property with the name kind whose value is 'group'.

present within the item that forms the value of a related

present within the item that forms the value of a related

by those nodes (only the first vCard is returned): When the above algorithm says that the user agent is to add a vCard line consisting

of a type type, optionally some parameters, and a value value to a string output, it must run the following steps: When the steps above require the user agent to obtain the result of collecting vCard

agent must run the following steps: When the steps above require the user agent to obtain the result of collecting the first

agent must run the following steps: When the above algorithms say the user agent is to escape the vCard text string value, the user agent must use the

following steps: This algorithm can generate invalid vCard output, if the input does not conform to

following syntax: The optional components marked with an asterisk (*) should be included, and should have six

location north and south of the equator as a positive or negative real number, respectively.

with the name dtstart whose value is a valid date

property must be text that is a valid global date and time string.

within each item with the type http://microformats.org/profile/hcalendar#vevent, so long as that http://microformats.org/profile/hcalendar#vevent does not have a

valid date string or a valid global date and time string.

present within each item with the type http://microformats.org/profile/hcalendar#vevent, so long as that http://microformats.org/profile/hcalendar#vevent does not have a

valid date string or a valid global date and time string.

string is a valid vevent duration string if it matches the following pattern: Given a list of nodes nodes in a Document, a user agent must

represented by those nodes: When the above algorithm says that the user agent is to add an iCalendar line

an annotation, to a string output, it must run the following steps: This algorithm can generate invalid iCalendar output, if the input does not

conform to the rules described for the http://microformats.org/profile/hcalendar#vevent item type and defined property names.

into a JSON form: This algorithm returns an object with a single property that is an array, instead

longer, directly relevant to the page's current state, or that it is being used to declare content

have to take care when writing their style sheets to make sure that the attribute is still styled

For example, it is incorrect to use hidden to hide panels in a tabbed dialog, because the tabbed interface

is merely a kind of overflow presentation — one could equally well just show all the form

content just from one presentation — if something is marked hidden, it is hidden from all presentations, including, for instance,

is inert, then the user agent must act as if the node was absent for the purposes of

targeting user interaction events, may ignore the node for the purposes of text search user

interfaces (commonly known as 'find in page'), and may prevent the user from selecting text in

does not 'protect' a node from being marked inert.) The dialog element's showModal() method causes this mechanism to trigger, by adding the dialog element to its node

behavior, for instance using keyboard or voice input, or through mouse clicks.

user triggers an element with a defined activation behavior in a manner other than

clicking it, the default action of the interaction event must be to fire a click event at the element.

controls, scrollable regions, links, dialog boxes, browser tabs, and so forth.

iframe) is a focusable area, but key events routed to a browsing context

is always a 1-to-1 mapping of control groups to control group owner objects.) Each focusable area belongs to a single control group as follows.

the dialog element's nearest ancestor control group owner object.

its nearest ancestor control group owner object, then that control group owner

control group are ordered relative to their CSS box's relative positions in a pre-order,

[CSS] The currently focused area of a top-level browsing context at any particular time is

the focusable area or dialog returned by this algorithm: An element that is the DOM anchor of a focusable area is said to gain focus when that focusable area becomes the currently

focusable area of the currently focused area of a top-level browsing context,

element that is being rendered be not focusable at all without disabling it or making it inert.) The tabindex attribute, if specified, must have a value

navigation order, and negative numbers indicate that the control is to be unreachable by

Developers should use caution when using values other than 0 or −1 for their tabindex attributes as this is complicated to do correctly.

thereof, must be interpreted as follows: The user agent should follow platform conventions to determine if the element's

tabindex focus flag is set and, if so, whether the element and any focusable areas that have the element as their DOM anchor can

be reached using sequential focus navigation, and if so, what their relative

tabindex focus flag be set: The user agent must set the element's tabindex focus flag, but should omit the

allow the author to lead to the element would be if the user's only mechanism for moving the

click on a text control with a negative tabindex, so that

user's user agent would be well justified in allowing the user to tab to the control

The user agent must set the element's tabindex focus flag, should allow the

DOM anchor to be reached using sequential focus navigation, following

platform conventions to determine the element's relative position in the sequential focus

The user agent must set the element's tabindex focus flag, should allow the

DOM anchor to be reached using sequential focus navigation, and should place the element

— referenced as candidate below — and the aforementioned focusable areas in the sequential focus navigation

sequential focus navigation order, they are: An element with the tabindex attribute specified is

follows: When the currently focused area of a top-level browsing context is somehow

unfocused without another element being explicitly focused in its stead, the user agent must

example, if the currently focused area of a top-level browsing context is a

Focus fixup rule one: When the designated focused area of a control group is removed from that control group in

control group to be the new focused area of the control group, if any;

control group to be the new focused area of the control group regardless

removing, disabling, or hiding that button would cause the page's new focused area to be the viewport of the

Focus fixup rule three: When the designated focused dialog of a dialog group is removed from that dialog

it stops being rendered, it loses its open attribute, it becomes expressly inert, etc),

starts being inert, the user agent must run the following steps: The focus update steps, given an old chain, a new chain, and a new focus target respectively, are as

follows: To fire a focus event named e at an element t and with a given

target, are as follows: Each control group has a sequential focus navigation order, which orders some

omitted from the sequential focus navigation order of its control group, then

of pressing the tab key), or when the user requests that focus sequentially move to a

the user agent must use the following algorithm: The sequential navigation search algorithm consists of the following steps.

to focus the viewport, call the focus() method on

use a CSS rule to override the 'outline' property, and provide a different way to

available, the page will be significantly less usable for people who primarily navigate pages

using a keyboard, or those with reduced vision who use focus outlines to help them navigate the

Document objects must return the value returned by the following steps: The hasFocus() method on the

context is a top-level browsing context, user agents are encouraged to trigger

some sort of notification to indicate to the user that the page is attempting to gain focus.

being used to remove the focus ring for aesthetics reasons, the page would become unusable by

keyboard, what keyboard shortcuts already exist on the platform, and what other shortcuts have

been specified on the page, using the information provided in the accesskey attribute as a guide.

In order to ensure that a relevant keyboard shortcut is available on a wide variety of input

string representing the actual key combination assigned by the user agent.

by the user agent as a guide for creating a keyboard shortcut that activates or focuses the

or removed, the user agent must update the element's assigned access key by running

the following steps: Once a user agent has selected and assigned an access key for an element, the user agent should

not change the element's assigned access key unless the accesskey content attribute is changed or the element is moved to

(enabled), the element is in a document that has a browsing context, and neither the element nor any of its

In addition, there is a third state, the inherit state, which is the missing value default (and the invalid value default).

getting, must return the string 'true' if the content attribute is set to

the true state, 'false' if the content attribute is set to the false state,

being enabled, the user agent must immediately reset the document's active range's

Authors are encouraged to set the 'white-space' property on editing hosts and on markup that was originally created through these editing

editing, and line wrapping will not work correctly in some corner cases if

three possible default behaviors for each element: The spellcheck attribute is an enumerated

addition, there is a third state, the default state, which is the missing value default (and the invalid value default).

default behavior, possibly based on the parent element's own spellcheck state, as defined below.

content attribute is in the default state and the element's default behavior is true-by-default, or if the element's spellcheck content attribute is in the default state and the

otherwise, if none of those conditions applies, then the attribute must instead return false.

algorithm: If the checking is enabled for a word/sentence/text, the user agent should indicate spelling

UAs should use input element attributes such as pattern to ensure that the resulting value is valid, where

If checking is disabled, the user agent should not indicate spelling or grammar errors for that

A user agent could offer on-demand checking, could perform continuous checking while the

Some methods of entering text, for example virtual keyboards on mobile devices, and also voice

autocapitalization might automatically switch to showing uppercase letters (but allow the user to

Other types of input, for example voice input, may perform autocapitalization in a way that does

autocapitalization to be enabled for input elements whose type attribute is in one of the URL, E-mail, or Password states.

their state mappings are as follows: The invalid value default is the sentences state.

state from a form element, this will return the autocapitalization state of the

form element, but for an element in an editable region, this will not return the

autocapitalization state of the editing host (unless this element is, in fact, the editing

attribute (and thereby change the autocapitalization behavior for the element).

getting, must return the string value corresponding to own autocapitalization hint of

User agents that support customizable autocapitalization behavior for a text input method and

wish to allow web developers to control this functionality should, during text input into an

using the following algorithm: User agents can support the inputmode attribute on form

supported by the user agent), the user agent should determine the default virtual keyboard to be

On a visual medium with a pointing device, a drag operation could be the default action of a

mousedown event that is followed by a series of mousemove events, and the drop could be triggered by the mouse

explicitly indicate their intention to perform a drag-and-drop operation, stating what they wish

mouse was clicked, or the start of the selection or element that was selected for the drag), may

have any number of intermediate steps (elements that the mouse moves over during a drag, or

elements that the user picks as possible drop points as they cycle through possibilities), and must

either have an end point (the element above which the mouse button was released, or the element

possible drop point before the drop occurs (so if the operation is not canceled, there must be at

For example: To accept a drop, the drop target has to listen to the following events: For example: To remove the original element (the one that was dragged) from the display, the dragend event can be used.

For our example here, that means updating the original markup to handle that event: The data that underlies a drag-and-drop operation, known as the drag data store,

consists of the following information: When a drag data store is created, it

must be initialized such that its drag data store item list is empty, it has no

drag data store default feedback, it has no drag data store bitmap and

drag data store hot spot coordinate, its drag data store mode is protected mode, and its drag data store allowed effects

'copy', 'copyLink', 'copyMove', 'link', 'linkMove', 'move', 'all', and 'uninitialized', Returns a DataTransferItemList object, with the drag data.

of the DataTransfer object's drag data store item list change, or when

invoked, must return a newly created DataTransfer object initialized as follows: The dropEffect attribute controls

On setting, if the new value is one of 'none', 'copy', 'link', or 'move', then the attribute's current value must be

used in the drag-and-drop processing model to initialize the dropEffect attribute during the dragenter and dragover events.

store's mode is the read/write mode and the new value is one of 'none', 'copy', 'copyLink', 'copyMove', 'link', 'linkMove', 'move', 'all', or 'uninitialized', then the attribute's

x, y) method must run the following steps: The types attribute must return this

data) method must run the following steps: The clearData() method must run the

affect whether any files were included in the drag, so the types attribute's list might still not be empty after

with a drag data store and that drag data store's drag data store

it must return the string given in the cell from the second column of the following table from the

row whose cell in the first column contains the drag data item kind of the item

it must return the drag data item type string of the item represented by the

method must run the following steps: The drag-and-drop processing model involves several events.

using a particular drag data store, and optionally with a specific related

target, the user agent must run the following steps: When the user attempts to begin a drag operation, the user agent must run the following steps.

User agents must act as if these steps were run even if the drag actually started in another

document or application and the user agent was not aware that the drag was occurring until it

During the drag operation, the element directly indicated by the user as the drop target is

changes, based on the results of event listeners in the document, as described below.

User agents must, as soon as the drag operation is initiated and every 350ms (±200ms) thereafter for as long as the drag

operation is ongoing, queue a task to perform the following steps in sequence: User agents are encouraged to consider how to react to drags near the edge of

on a long page, it might make sense to scroll the page so that the user can drop the link lower on

the events are fired as described above and the rest of the processing model runs as

Not shown in the above table: all these events bubble, are composed, and the effectAllowed attribute always has the value it had

on the content attribute's in the way described below, controls whether or not the element is

Generally, only text selections are draggable, but elements whose draggable IDL attribute is true become draggable as well.

element that represents an image, or an a element with an href content attribute, the draggable IDL attribute must return true;

dragstart event available to scripts until the drop event, because otherwise, if a user were to drag sensitive

information from one document to a second document, crossing a hostile third document in the

specifically ended the drag operation — if any scripts end the drag operation, it must be

because otherwise UAs could cause data to be dragged from sensitive sources and dropped into

optionally given noopener: Certain elements (for example, iframe elements) can instantiate further browsing contexts.

context container container is the result of the following algorithm: Returns the WindowProxy for the top-level browsing context.

must run the following algorithm: It is possible to create new browsing contexts that are related to a top-level browsing

second browsing context B if the following algorithm returns true: An element has a browsing context scope origin if its Document's

are directly reachable browsing contexts forms a unit of related browsing

similar-origin browsing contexts (though several units of related similar-origin browsing contexts can

browsing context of the one the link or script is in, 'new' means a new top-level

browsing context or auxiliary browsing context is to be created, subject to

various user preferences and user agent policies, 'none' means that nothing will happen, and

choosing a browsing context, given a browsing context name name, a

key-value pairs from the map where part of the key is www.example.com, as that can never be part

compatibility with existing Web content.) [JAVASCRIPT] The reason the property descriptors are non-enumerable, despite this mismatching

change in exactly one case: when the navigate algorithm initializes a new Document object for the first page loaded

The target argument gives the name of the new window.

When the method is invoked, the user agent must run the window open steps with

To normalize a feature name name, switch on name: The name attribute of the Window object

browsing context that was created by a script (as opposed to by an action of the user), or

contexts of a Window object W is the number of document-tree child browsing contexts of

Indexed access to document-tree child browsing contexts is defined through the [[GetOwnProperty]] internal method of the

this API can vary over time, as new features are added to the Web platform, for example.

name property set of a Window object window is the return value of

window at any moment consist of the following, in tree order according to

the element that contributed them, ignoring later duplicates: To determine the value of a named property

name in a Window, the user agent must return the value obtained using the

Document, the user agent must run the following steps: Whenever a Document object is discarded, it is also removed from the owner set of each worker

To close a browsing context browsingContext, run these steps: User agents should offer users the ability to arbitrarily close any top-level browsing context.

To allow Web pages to integrate with Web browsers, certain Web browser interface elements are

true or a value determined by the user agent to most accurately represent the visibility state of

polymorphic dispatch on its target's internal methods as a real proxy would, due to a desire to

origin origin is computed as follows: Various specification objects are defined to have an origin.

origin origin: The serialization of ('https', 'xn--maraa-rta.example', null, null) is 'https://xn--maraa-rta.example'.

same origin-domain if the following algorithm returns true: Returns the current domain used for security checks.

Can be set to a value that removes subdomains, to change the origin's domain to allow pages on other subdomains of the same

iframes.) To determine if a string hostSuffixString is a registrable domain suffix of or is equal to a host originalHost, run these steps: The domain attribute's getter must run

flags, which are used to restrict the abilities that potentially untrusted resources have: This flag prevents content from navigating browsing contexts other

than the sandboxed browsing context itself (or browsing contexts further nested inside it),

by the sandboxed auxiliary navigation browsing context flag defined next), and the

top-level browsing context (which is protected by the sandboxed top-level

navigation without user activation browsing context flag and sandboxed top-level

navigation with user activation browsing context flag defined below).

certain cases the restrictions nonetheless allow popups (new top-level browsing contexts) to be opened.

when the browsing context is created, which allows the browsing context that

context flag would prevent them from being navigated even if they were opened.) This flag prevents content from creating new auxiliary browsing

browsing context and prevents content from closing their

flag is not set, content can navigate its top-level browsing

protected by the sandboxed navigation browsing context flag and possibly

the sandboxed auxiliary navigation browsing context flag.

browsing context and prevents content from closing their

flag, this flag only affects the top-level browsing context;

using the embed element, the object element, or through navigation of a nested browsing context, unless

This flag blocks features that trigger automatically, such as automatically playing a video or automatically focusing a form control.

auxiliary browsing context it creates inherits the content's

dialogs: This flag disables the ability to lock the screen orientation.

string input, a sandboxing flag set output, it must run the

following steps: Every top-level browsing context has a popup sandboxing flag set, which

set are set at any particular time is determined by the iframe element's sandbox attribute.

populate document's active sandboxing flag set with the union of the flags

Each browsing context, including nested browsing contexts, has a distinct session history.

context's session history consists of a flat list of session history entries.

a title, a Document object, form data, a scroll restoration mode, a

scroll position, a browsing context name, and other information associated with

sometimes informally refer to 'state objects', which are the objects representing user interface

state supplied by the author, or alternately the objects created by deserializing (via

This prevents values from being displayed incorrectly after a history traversal when the user had

An entry's scroll restoration mode indicates whether the user agent should

mode may be one of the following: If unspecified, the scroll restoration mode of a new entry must be set to

script, reloading the pages afresh when the user or script navigates back to such pages.

Can be set, to change the scroll restoration mode of the current entry in the session history.

the entries that are current entries in their respective session histories removed except for the current entry of

different event loop, the actual state of the joint session history can

the user agent must traverse the history by a delta whose value is

the following algorithm, known as the session history event loop for that

top-level browsing context, in parallel: The session history event loop helps coordinate cross-browsing-context transitions

particular time, have a different event loop (this can happen if the user agent has

consisting of running the following steps: When the user navigates through a browsing context, e.g.

and forward buttons, the user agent must traverse the history by a delta equivalent

When either of these methods is invoked, the user agent must run the following steps: The title is purely advisory.

User agents may limit the number of state objects added to the session history per page.

page hits the UA-defined limit, user agents must remove the entry immediately after the first

Similarly, a page containing two iframes has a history object distinct from the iframes' history objects, despite the fact that typical Web browsers present the

the UA provide the user with a way to jump back to the previous page (rather than just going back

two 'back' commands, one that goes back to the previous state, and one that jumps straight back to

algorithm explicitly allows user agents to ignore any such calls when appropriate.

In particular, the valueOf, @@toPrimitive, and [Unforgeable] stringifier mitigations ensure that code such as foo[location] = bar or location + '' cannot be

navigate algorithm, which given a url, runs these steps: To Location-object navigate, given a url and

replacement flag, run these steps: The href attribute's getter must run these

steps: The href attribute's setter must run these steps: The href attribute setter intentionally

steps: The host attribute's setter must run these steps: The hostname attribute's getter must

steps: The port attribute's setter must run these steps: The pathname attribute's getter must

steps: The hash attribute's setter must run these steps: Unlike the equivalent API for the a and area elements,

be reloaded through a user interface element, the user agent should navigate the browsing context to the same resource as that

override flag is set, then the user agent may instead perform an overridden

A user agent may provide various ways for the user to explicitly cause a browsing

form submission, and the window.open() and location.assign() methods can all cause a browsing context to

resource resource, optionally with an exceptions enabled flag, the user agent must run these steps: To process a navigate fetch, given a request request, browsing context

string navigationType, run these steps: To process a navigate response, given null or a request request, a response response, a string navigationType,

reservedEnvironment, run these steps: To process a navigate URL scheme, given a URL url and

browsing context browsingContext, run these steps: When a resource is handled by passing its URL or

data to an external software package separate from the user agent (e.g.

processor), user agents should attempt to mitigate the risk that this is an attempt to exploit the

handler which a hostile page would attempt to exploit by tricking a user into clicking a link.

Some of the sections below, to which the above algorithm defers in certain cases, require the

object of the current entry, not the new one) to run the following steps: The task source for this task is the

queue a task to create a Document object, mark it as being an HTML document, set its content type to 'text/html',

task queue while fetching runs must then fill the parser's input byte

to process the implied EOF character, which eventually causes a load event to be fired.

When faced with displaying an XML file inline, user agents must follow the requirements defined

above, is found to be an html element with an attribute manifest whose value is not the empty string, then, as soon as

to that element's node document, and if that is successful, must apply the URL serializer algorithm to the resulting URL

record with the exclude fragment flag set to obtain manifest URL, and

parsing its value fails, then as soon as the document element is inserted into the document, the user agent must run the application cache selection algorithm with no manifest, and

processing instructions before the document element (such as <?xml-stylesheet?> PIs) will be fetched from the network and cannot be

If such processing is to take place, abort the steps in this section, and jump to the next step (labeled non-document content) in the

must queue a task to create a Document object, mark it as being an HTML document, set its content type to the computed MIME type of the resource (type in the

tokenizer had emitted a start tag token with the tag name 'pre' followed by a single U+000A LINE

source places on the task queue while fetching runs must then fill the

The rules for how to convert the bytes of the plain text document into actual characters, and

the rules for actually rendering the text to the user, are defined by the specifications for the

Upon creation of the Document object, the user agent must run the application cache selection algorithm with no manifest, and

to process the implied EOF character, which eventually causes a load event to be fired.

parsing, the user agent must update the session history with the new page.

e.g., linking to a style sheet, providing script, or giving the document a title.

feature of RFC 3676 then the user agent would need to apply extra styling to cause the text to

browsing context, the user agent must parse the resource using the rules for

[RFC2046] For each body part obtained from the resource, the user agent must run process a navigate

response using the new body part and the same browsing context, with

replacement enabled if a previous body part from the same resource resulted in a

resources, the user agent must act as if there were no more bytes for those resources whenever the

Thus, load events (and for that matter unload events) do fire for each body part loaded.

user agent should create a Document object, mark it as being an HTML document, set its content

html element, append an element host element for the media, as described

host element, as described below, to the address of the image, video, or audio

the table below in the second cell of the row whose first cell describes the media.

Upon creation of the Document object, the user agent must run the application cache selection algorithm with no manifest, and

fully loading, the user agent must update the session history with the new page.

attributes to the element host element, e.g., to link to a style sheet, to provide a

Upon creation of the Document object, the user agent must run the application cache selection algorithm with no manifest, and

fully loading, the user agent must update the session history with the new page.

flag set has its sandboxed plugins browsing context flag set, the synthesized

When the user agent is to display a user agent page inline in a browsing context,

the user agent should create a Document object, mark it as being an HTML document, set its content type to 'text/html',

Upon creation of the Document object, the user agent must run the application cache selection algorithm with no manifest,

completely set up, the user agent must update the session history with the new

then the user agent must run the following steps: If the scrolling fails because the relevant ID has

take care of the scrolling instead, as the last few steps of its update the session history

the scrolling position of the document using the following algorithm, or perform some other action

To find a potential indicated element given a string fragment, run these

with the non-blocking events flag set, the user agent must act as follows.

This algorithm is not just invoked when explicitly going back or forwards in the session history — it is also invoked

When the user agent is to restore persisted user state from a history entry, it must

run the following steps immediately: This can even include updating the dir attribute

of textarea elements or input elements whose type attribute is in either the Text state or the Search state, if the persisted state includes the

assume any particular scroll position but rather are urged to set it to what they want it to

make the page unsalvageable) the page might be reused if the user navigates back to this

true, a fired unload flag, which must initially be false, and a page showing

scripts receive pageshow and pagehide events in a consistent manner (e.g.

object document and optionally a recursiveFlag, run these steps: When a user agent is to unload a document, it must run the following

document.open() method.) This specification defines the following unloading document cleanup

The BeforeUnloadEvent interface is a legacy interface which allows prompting to unload to be controlled not only by canceling the

Any value besides the empty string will be treated as a request to ask the user for

run the following steps: User agents may allow users to explicitly invoke the abort a

is a long process that takes many years.) Using any of the offline Web application features at

of their ISP's coverage area — authors can provide a manifest which lists the files that are

needed for the Web application to work offline and which causes the user's browser to keep a copy

To illustrate this, consider a simple clock applet consisting of an HTML page 'clock1.html', a CSS style sheet 'clock.css', and a

Before adding the manifest, these three files might look like this: If the user tries to open the 'clock1.html' page while offline, though,

The author can instead provide a manifest of the three files, say 'clock.appcache': With a small change to the HTML file, the manifest (served as text/cache-manifest)

is linked to the application: Now, if the user goes to the page, the browser will cache the files and make them available

The application cache feature works best if the application logic is separate from the

application and user data, with the logic (markup, scripts, style sheets, images, etc) listed in

the manifest and stored in the application cache, with a finite number of static HTML pages for

This model results in a fast experience for the user: the application immediately loads, and

fresh data is obtained as fast as the network will allow it (possibly while stale data shows).

content is cached, it would result in the user always seeing the stale data from the previous time

resources used by the HTML page you want to have work offline in an application cache manifest, use the manifest attribute to select that manifest from the HTML file,

and then add the following line at the bottom of the manifest: This causes the application cache to only be used for master entries when the user is offline, and causes the

application cache to be used as an atomic HTTP cache (essentially pinning resources listed in the

manifest), while allowing all resources not listed in the manifest to be accessed normally when

When the user visits a page that declares a manifest, the browser will try to update the cache.

to keep the script updated as to the state of the cache update, so that the user can be notified

An application cache is a set of cached resources consisting of: Each application cache has a completeness flag, which is either complete or

caches, identified by the absolute URL of a resource manifest which is used to populate the caches in the

another if it was created after the other (in other words, application caches in an application cache group have a chronological

the application cache download process to ensure that new master entries are cached

An application cache group can be marked as obsolete, meaning that it must be ignored when looking at

cache, but can become associated with one early during the page load process, when steps in the parser and in the navigation

If the user agent is to select an application cache from a list of relevant application caches that contain a resource, the

there exists a relevant application cache whose manifest's URL has the same origin as the

a fallback namespace can match more than one application cache at a time, but only matches one

An application cache manifest is a text file, whose text is encoded using UTF-8.

[ENCODING] This is a willful violation of RFC 2046, which requires all text/* types to only allow CRLF line breaks.

characters, followed by a single U+0023 NUMBER SIGN character (#), followed by zero or more

TABULATION (tab) characters, followed by one of the names above (including the U+003A COLON

TABULATION (tab) characters, a valid URL string identifying a resource other than

TABULATION (tab) characters, a valid URL string identifying a resource other than

another valid URL string identifying a resource other than the manifest itself, and

safelist section, data lines must consist of zero or more U+0020 SPACE and U+0009

CHARACTER TABULATION (tab) characters, either a single U+002A ASTERISK character (*) or a valid URL string identifying a

Namespaces that the user agent is to put into the online safelist must all be specified in online safelist sections.

When a user agent is to parse a manifest, it means that the user agent must run the

following steps: When the user agent is required (by other parts of this specification) to start the

cache group, potentially given a particular cache host, and potentially given

fired during the application cache download process allow the script to override the

seamless update mechanisms, hiding from the user the mechanics of the application cache mechanism.

prominent update progress notifications for applications that cancel the relevant events.

The cache failure steps are as follows: Attempts to fetch resources as part of the application cache download process may

allows user agents to keep caches primed and to update caches even before the user visits a

tasks that is used to delay events fired by the algorithm above until the document's load event has fired.

applicable set of steps from the following list: Mark the entry for the resource from which document was taken in the

algorithm, undoing any changes that were made as part of the initial load (changes can be

avoided by ensuring that the step to update the session history with the new page

document's own metadata, to aid in application development.

that application cache's application cache group, with document as the cache host.

Invoke, in the background, the application cache download process for manifest URL, with document as the cache host

are identified by a URL with the same origin as the URL of document, and that have this URL as one of their entries, excluding entries

When a cache host is associated with an application cache whose completeness flag is complete, any and all

loads for resources related to that cache host other than those for child browsing contexts must go through the following steps

instead of immediately invoking the mechanisms appropriate to that resource's scheme: The above algorithm ensures that so long as the online safelist wildcard flag is

blocking, resources that are not present in the manifest will always fail to load (at least, after the

As a general rule, user agents should not expire application caches, except on request from the

site can identify the user when providing the cache, it can store data in the cache that can be

in a manner related to HTTP cookies, allowing caches to be expunged together with cookies and

clears all cookies, application caches, local storage, databases, etc, from an origin all at

User agents should consider applying constraints on disk usage of application caches, and care should be taken to ensure that the restrictions cannot

agents are encouraged to provide features such as allowing a user to indicate that certain sites

The main risk introduced by offline application caches is that an injection attack can be

manifest consisting of just a fallback entry pointing to the second file, which is an HTML page

file, all subsequent accesses to any file covered by the given fallback namespace while either the

attacks or cookie bombing attacks (where the client is made to send so many cookies that the

server refuses to process the request) can be used to ensure that the site appears offline.

clear the problem, since the next time the manifest is updated, a 404 error will be seen, and the

the user or server is ongoing, such that connections from an affected user to the affected site

are blocked, the user agent will simply assume that the user is offline and will continue to use

Calling this method is not usually necessary, as user agents will generally take care of

mail application might stay open in a browser tab for weeks at a time.

in case the user wants to stop the update (e.g.

suddenly get reloaded and style sheets and scripts do not get reparsed or reevaluated.

change is that subsequent requests for cached resources will obtain the newer copies.

this, applications have to be able to bring the new features into play;

reload the entire page at a time suitable for the user, using location.reload().

agent must invoke the application cache download process, in the background, for the

or if its application cache group is marked as obsolete, then the method must throw an

agent must send a signal to the current application cache download process

The following are the event handlers (and their corresponding event handler event types) that must be

ApplicationCache interface: Returns false if the user agent is definitely offline (disconnected from the network).

false if the user agent will not contact the network when the user follows links or when a script

requests a remote page (or knows that such an attempt would fail), and must return true

that it is never null, so we use null to signal that no error has occurred.

The active script is determined by the following algorithm: An environment is an object that identifies the settings of a

script, this execution context becomes the top of the JavaScript execution context

stack, on top of which another execution context specific to the script in question is

of the new browsing context's Window object will be set to the

responsible document is used to set the URL of the Document after it has been reset

weak set and an about-to-be-notified rejected promises list, used to track

rejected promises weak set must not create strong references to any of its members, and

This section introduces a number of algorithms for fetching scripts, taking various necessary

empty string, parser metadata is 'not-parser-inserted', credentials mode is 'omit', and referrer

fetch options are a new script fetch options whose items all have the same values, except for the integrity metadata, which is instead the

for all classic script fetches, and for the initial fetch when fetching a module script graph or fetching a module worker script graph, but not for the fetches resulting from

graph given a url, a fetch client settings object, a

The following algorithms are meant for internal use by this specification only as part of fetching a module script graph or preparing a script, and should not be used directly by other specifications.

To perform the internal module script graph fetching procedure given a

options, a module map settings object, a visited set, a

settings object, a referrer, and a top-level module fetch flag, run

script, given a destination and an optional visited set, run these

options, and an optional muted errors boolean: To create a module script, given a

options options: To run a classic script given a classic script

script and an optional rethrow errors boolean: To run a module script given a module script

script, with an optional rethrow errors boolean: The steps to check if we can run script with an environment settings

object settings are as follows: The steps to clean up after running script with an environment

settings object settings are as follows: These algorithms are not invoked by one script directly calling another, but they

realms, global objects, and environment settings objects: When defining algorithm steps throughout this specification, it is often important to indicate

all existing uses from the platform: see issue #1430 for incumbent, and issue #1431 for entry.

In general, web platform specifications should use the relevant concept, applied to the object being operated

The rest of this section deals with formally defining the entry, incumbent, current, and relevant concepts.

pushed item in the JavaScript execution context stack that is a realm execution context.

In the process of preparing to run a callback and cleaning up after running a callback, this value will be incremented and

settings object when no author code is on the stack, but author code is responsible for the

The process of preparing to run a callback and cleaning up after running a callback manipulate this stack.

track relevant data for determining the incumbent settings object: To prepare to run a callback with an environment settings

settings object settings: Here, the topmost script-having execution context is the topmost entry of the

mechanisms contribute to the definition of the incumbent concept: The JavaScript specification defines the current Realm Record, sometimes

defined as follows: The relevant settings object for a non-global platform object

o is the environment settings object whose global object is the global object of the

[JAVASCRIPT] User agents may impose resource limitations on scripts, for example CPU quotas, memory limits,

User agents are encouraged to allow users to disable scripting whenever the user is prompted

User agents may allow users to specifically disable scripts just for the purposes of closing a

user with a mechanism to just close the page entirely, without running any unload event handlers.

However, the end result is a mass of messy indirection and workarounds that essentially bypasses

the job queue infrastructure entirely, albeit in a way that is technically sanctioned within the

following algorithm must be used in place of JavaScript's EnqueueJob: The JavaScript specification defines a syntax for modules, as well as some host-agnostic parts

module system is bootstrapped, via the script element with type attribute set to 'module', and how

module map is a map of URL records to values that are either a module script, null (used to

User agents must use the following implementation: [JSIMPORT] The import.meta proposal contains an implementation-defined HostGetImportMetaProperties abstract operation.

has a better handle on lifetimes, we define five types of agents that

An agent whose [[CanBlock]] is false and whose set of realms consists of all realms of Window objects whose

relevant settings object's responsible browsing context is in the same

instance if they are each in their own unit of related similar-origin browsing

memory with any dedicated worker agent whose single realm's global object's owner

In addition, any agent A can share memory with: The agent cluster concept is crucial for defining the JavaScript memory model, and

position line:col, using a particular target target, it must run these steps, after which the error is either handled or not

agent must report the error for the relevant script, with the problematic position (line number and column

number) in the resource containing the script, using the global object specified by the script's

environment settings object settings object, it must run these steps: This algorithm results in promise rejections being marked as handled or not handled.

To coordinate events, user interaction, scripts, rendering, networking, and so forth, user

task queue is an ordered list of tasks, which are algorithms that are responsible for such work as: Dispatching an Event object at a particular

user agent could then give keyboard and mouse events preference over other tasks three quarters of

the time, keeping the interface responsive but not starving other task queues, and never

microtasks have to take extra care to wrap callbacks to handle spinning the event

performing a microtask checkpoint flag is false, then the user agent must run the

following steps: If, while a compound microtask is running, the user agent is required to

execute a compound microtask subtask to run a series of steps, the user

agent must run the following steps: When an algorithm running in parallel is to await a stable state, the

user agent must queue a microtask that runs the following steps, and must then stop

executing (execution of the algorithm resumes when the microtask is run, as described in the

When an algorithm says to spin the event loop until a condition goal is met, the user agent must run the following steps: Some of the algorithms in this specification, for historical reasons, require the user agent to

This means running the following steps: The following task sources are used by a number of mostly

things that happen in a non-blocking fashion when an element is inserted into the document.

perform that would otherwise block the event loop must instead be performed in

thread.) Doing so would create data races observable to JavaScript code, since after all, your

Event handler IDL attributes, on setting, must set the corresponding event handler to their new value, and on getting, must return the

is set, execute the following steps: When an event handler content attribute is removed, the user agent must set the corresponding

with type set to the event handler event type corresponding to

H and callback set to the result of creating a Web IDL EventListener instance representing a reference to a function of

one argument that executes the steps of the event handler processing algorithm, given

callback, the algorithm defined below, which takes care of invoking the right callback, and

order of event listeners for a particular event type will always be first the event listeners

The interfaces implemented by the event object do not influence whether an event handler is triggered or not.

follows: The EventHandler callback function type represents a callback used for event

different return value: An internal raw uncompiled handler is a tuple with the following information: When the user agent is to get the

current value of the event handler H, it must run these steps: The following are the event handlers (and their corresponding event handler event types) that must be

attributes: The following are the event handlers (and their corresponding event handler event types) that must be

and frameset elements that are owned by that Window object's associated Document: The following are the event handlers (and their corresponding event handler event types) that must be

and frameset elements that are owned by that Window object's associated Document: The following are the event handlers (and their corresponding event handler event types) that must be

supported by all Document objects, as event handler IDL attributes: The following are the event handlers (and their corresponding event handler event types) that must be

supported on Document objects as event handler IDL attributes: Certain operations and methods are defined as firing events on elements.

U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF respectively, and

exception if the input string contains any out-of-range characters.

decodes it, and returns a string consisting of characters in the range U+0000 to U+00FF, each

representing a binary byte with values 0x00 to 0xFF respectively, corresponding to that binary

user agent must convert data to a byte sequence whose nth byte is the

method, when invoked, must run the following steps: APIs for dynamically inserting markup into the document interact with the parser,

If the replace argument is present and has the value 'replace', the existing entries in the session history for the

parser is currently executing a custom element constructor.

name, features) method must run these steps: Closes the input stream that was opened by the document.open() method.

parser is currently executing a custom element constructor.

affect the state of the HTML parser while the parser is running, resulting in a DOM

the call can clear the current page first, as if document.open() had been called.

exact behavior of this method can in some cases be dependent on network latency, which can lead to failures that are very hard to debug.

parser is currently executing a custom element constructor.

parser is currently executing a custom element constructor.

by the timer initialization steps, passing them the method's arguments, the object on

by the timer initialization steps, passing them the method's arguments, the object on

and returns true if the user clicks OK and false if the user clicks Cancel.

Displays a modal text control prompt with the given message, waits for the user to dismiss

method, when invoked, must run the following steps: Prompts the user to print the page.

which represents the identity and state of the user agent (the client), and allows Web pages to

register themselves as potential protocol handlers: These interface mixins are defined separately so that WorkerNavigator can re-use

In certain cases, despite the best efforts of the entire industry, Web browsers have bugs and

is Gecko, then the user agent must also support the following partial interface: The taintEnabled() method must

Must return a frozen array of valid BCP 47 language tags representing either one

returned until the user agent needs to return different values, or values in a different order.

or WorkerGlobalScope object return a new set of language tags, the user agent must

queue a task to fire an event named languagechange at the Window or

WorkerGlobalScope object and wait until that task begins to be executed before

To determine a plausible language, the user agent should bear in mind the following: To avoid introducing any more fingerprinting vectors, user agents should use the same list for

allows Web sites to register themselves as possible handlers for particular schemes.

an online telephone messaging service could register itself as a handler of the sms: scheme, so that if the user clicks on such a link, they are given the

agent blocks the registration (this might happen if trying to register as a handler for 'http',

to add the site to a shortlist of handlers, or make the handlers their default, or cancel the

scheme must be compared in an ASCII case-insensitive manner by user agents for the

purposes of comparing with the scheme part of URLs that they consider against the list of

method is invoked with a scheme that is neither a safelisted scheme nor a scheme

whose value starts with the substring 'web+' and otherwise contains only

characters (including the 'web+' prefix), the user agent must throw a

used in man-in-the-middle attacks, by replacing pages that have frames with such content with

the url argument passed to one of these methods does not contain the exact literal

literal string '%s' in the url argument with an

escaped version of the absolute URL of the content in question (as defined below),

user agent must replace every character in that absolute URL that is not a

character in the URL default encode set with the result of UTF-8 percent encoding that character.

otherwise consider handing content to native plugins or helper applications.

argument gives the scheme and the second gives the string used to build the URL of

The second argument must be preprocessed as follows: These mechanisms can introduce a number of concerns, in particular privacy concerns.

any defaults, as this could lead the user to send data to remote hosts that the user is not

will attempt to register a large number of handlers, possibly from multiple domains (e.g., by

argument to the methods when presenting the registered handlers to the user, since sites could

against strings embedded in their interface, for example ensuring that markup or escape characters

in such strings are not executed, that null bytes are properly handled, that over-long strings do

secret Intranet URLs being leaked, in the following manner: No actual confidential file data is leaked in this manner, but the URLs themselves could

require authentication to access, as such sites would be unable to access the resources in

question without prompting the user for credentials themselves (a practice that would require the

user to know whether to trust the third-party handler, a decision many users are unable to make or

button and a 'deny' button, with the 'accept' binding containing the name of the handler, it's

important that a long name not cause the 'deny' button to be pushed off the screen.

return true if the user agent attempts to handle cookies according to the cookie specification,

[COOKIES] Updates the lists of supported plugins and MIME types for this page, and reloads the page if the lists have changed.

Returns the number of MIME types, represented by MimeType objects, supported by the plugins that the user agent reports.

PluginArray object represents none, some, or all of the plugins supported by the user agent, each of which is represented by a Plugin object.

unless it is an extremely rare plugin, it is likely that a site attempting to derive the list of

plugins can still determine whether the plugin is supported or not by probing for it by name (the

set of plugins represented by the objects must not change once an object is created, except when

User agents are therefore encouraged to expose the same MIME types for all users of a plugin, regardless of the

numbers from zero to the number of non-hidden plugins represented by the object, if any.

supported property indices, and otherwise must return the result of running the

following steps, using the method's argument as index: It is important for

the update, though naturally now the data is stale and may appear inconsistent (for example, an

The set of MIME types represented by the objects must not change once an object is created, except

number of MIME types explicitly supported by non-hidden plugins represented by the

supported property indices, and otherwise must return the result of running the

following steps, using the method's argument as index: It is important for

The item() method of a Plugin object must return null if the argument is not one of the

object's supported property indices, and otherwise must return the result of running

the following steps, using the method's argument as index: It is important for

be returned each time, except that the strings returned may change when the PluginArray.refresh() method updates the object.

same string must be returned each time, except that the strings returned may change when the PluginArray.refresh() method updates the object.

object represents when this object was last created or updated by PluginArray.refresh(), whichever happened most

image data is not actually an image, then the promise is rejected instead.

source image is cropped to the given pixels, with any pixels missing in the original replaced by

DOMException if the source image is not in a valid state (e.g., an img

[[Detached]] internal slot value is true, an ImageData object whose

slot is detached, or a Blob whose data cannot be interpreted as a bitmap

DOMException if the script is not allowed to access the image data of the source

are: Their transfer steps, given value and dataHolder, are: Their transfer-receiving steps, given dataHolder and value,

when invoked, must run these steps: When the steps above require that the user agent crop bitmap data to the source rectangle with formatting,

the user agent must run the following steps: When the close() method is called, the

user agent must run these steps: The width attribute's getter must run

initially empty, and an animation frame callback identifier, which is a number which

the user agent must run the following steps: When the user agent is to run the animation frame callbacks for a

messaging, and the MessagePort being attached, in the connect event fired at

message (typically the scheme, hostname, and port of the document, but not its path or fragment).

To enable servers to push data to Web pages over HTTP or using dedicated server-push protocols,

messages in the following form, with the text/event-stream MIME type: Authors can separate events by using different event types.

and removeHandler are functions that take one argument, the event): The default event type is 'message'.

iframe allows the user agent to make better use of network resources in cases where

the user agent implementer and the network operator are able to coordinate in advance.

other benefits, this can result in significant savings in battery life on portable devices.

event stream is set to 'include', and false otherwise.

eventSourceInitDict) constructor, when invoked, must run these steps: The url attribute's getter must return the

The following are the event handlers (and their corresponding event handler event types) that must be supported,

user agent begins parsing the contents of the stream, the user agent must announce the

(but does not apply when fetching is canceled by the user agent, e.g., in response to window.stop(), since in those cases the final task is actually discarded).

and not themselves in parallel.) When a user agent is to fail the connection, the user agent must queue a

block buffering or line buffering with different expected line endings can cause delays in event

Process the field using the steps described below, using field as the field name and value as the field value.

whole line as the field name, and the empty string as the field value.

the middle of an event, before the final empty line, the incomplete event is not dispatched.) The steps to process the field given a field name and a

field value depend on the field name, as given in the following list.

event, the user agent must process the data buffer, the event type buffer, and the last event ID buffer using steps

For Web browsers, the appropriate steps to dispatch the event are as follows: If an event doesn't have an 'id' field, but an earlier event did set the event

implementation dependent, but at a minimum they must set the data and event type buffers to the empty string before returning.

Legacy proxy servers are known to, in certain cases, drop HTTP connections after a short

To protect against such proxy servers, authors can include a comment line (one starting

previously served might find that relying on IP addresses doesn't work, as individual clients can

have multiple IP addresses (due to having multiple proxy servers) and individual IP addresses can

Authors can avoid this using the relatively complex mechanism of using unique domain names

functionality on a per-page basis, or by sharing a single EventSource object using a

a situation, the user agent for the purposes of conformance is considered to include both the

defined by this specification and in more distributed ways as described above, formats of event

permanently), the user agent must abort any instances of the fetch algorithm started for this EventSource object,

objects a page has created, each listing the constructor's arguments, whether there was a network

names have to match the requirements for elements that comprise the value of Sec-WebSocket-Protocol fields as defined by the

to zero once the connection closes.) Returns the extensions selected by the server, if any.

the array form of the constructor's second argument to perform subprotocol negotiation.

protocols) constructor, when invoked, must run these steps: The url attribute's getter must return this

reason) method, when invoked, must run these steps: The close() method does not discard

previously sent messages before starting the WebSocket closing handshake — even if, in

practice, the user agent is still busy sending those messages, the handshake will only start after

return the number of bytes of application data (UTF-8 text and binary data) that have been queued

includes any text sent during the execution of the current task, regardless of whether the user

agent is able to transmit text in the background in parallel with script execution.) This does not include

framing overhead incurred by the protocol, or buffering done by the operating system or network

how to handle incoming binary data: if the attribute is set to 'blob', it is safe to spool it to disk, and if it is set to

user agent has received the data but before the user agent has fired the event for it.

must run the appropriate set of steps from the following list: If the WebSocket connection is

handshake has not yet started, then the user agent must send a WebSocket Message comprised of the data argument using

the buffer is full, the user agent must flag the

Message comprised of data using a binary frame opcode;

Blob argument that does not throw an exception must increase the bufferedAmount attribute by the size of the

Message comprised of data using a binary frame opcode;

argument that does not throw an exception must increase the bufferedAmount attribute by the length of the

Message comprised of data using a binary frame opcode;

data stored in the section of the buffer described by the ArrayBuffer object that data references.

invocation of this method with this kind of argument that does not throw an exception must

[WSP] The following are the event handlers (and their corresponding event handler event types) that must be supported,

user agent must queue a task to run these steps: Since the algorithm above is queued as a task,

connection being established and the script setting up an event listener for the open event.

with type type and data data, the user agent must queue a task

to follow these steps: [WSP] User agents are encouraged to check if they can perform the above steps

For example, if the binaryType attribute was set to 'blob' when the data arrived, and the user agent spooled all

this particular message the script switched binaryType to 'arraybuffer', the user agent would want to page the

started, the user agent must queue a task to change the readyState attribute's value to CLOSING (2).

(If the close() method was called, the readyState attribute's value will already be set to CLOSING (2) when this task runs.) [WSP] When the WebSocket connection is

closed, possibly cleanly, the user agent must queue a task to run the

following substeps: The task source for all tasks queued in this section is the WebSocket task source.

keep-alive, heart-beats, network status probing, latency instrumentation, and so forth.

User agents may send ping and unsolicited pong frames as desired, for example in an

attempt to maintain local network NAT mappings, to detect failed connections, or to display

the last time the event loop reached step 1 must not be garbage collected if there

are any event listeners registered for open events, message events, error events, or

the event loop reached step 1 must not be garbage collected if there are any event

last time the event loop reached step 1 must not be garbage collected if there are

ensure that messages are only accepted from domains that they expect to receive messages from.

Otherwise, bugs in the author's message handling code could be exploited by hostile sites.

Otherwise, if the source of the event has been attacked using a cross-site scripting flaw, further

unchecked processing of information sent using the postMessage() method could result in the attack being

argument in messages that contain any confidential information, as otherwise there is no way to

performs expensive computation or causes network traffic to be sent for each such message, the

employ rate limiting (only accepting a certain number of messages per minute) to make such attacks

without needing to explicitly state the origin, set the target origin to '/'.

transfer array contains duplicate objects or if message could not be

receiving its intended recipient: the scripts in the target browsing context have to

announcing their readiness to receive messages, and for the parent to wait for this message before

constructor is called: One of the ports is kept as the local port, and the other port is sent to the remote code, e.g.

the port is used: To receive messages, one listens to message events: Data sent on a port can be structured data;

are merely used as a convenient model within a particular origin, or as a strong capability model,

the user's e-mail contacts provider (an address book site, from a second origin), and in a second

Now suppose the game wanted to add a contact to the user's address book, and that the social

has a number of difficulties: it requires the social site to either completely trust the game site

not to abuse the privilege, or it requires that the social site verify each request to make sure

it's not a request that it doesn't want to allow (such as adding multiple contacts, reading the

possibility of multiple games simultaneously trying to interact with the contacts provider.

When the game tells the social site that it wants to add a contact, the social site can

ask the contacts provider not for it to add a contact, but for the capability to add a

contacts provider then have a direct connection, and the contacts provider knows to only honor a

service's iframe, an evolution of the service might instead want to use a shared worker with a single WebSocket connection.

to allow multiple simultaneous independent sessions, the service implementation can switch from

called, it must run the following algorithm: The port1 and port2 attributes must return the values they were

transferred, not just cloned, meaning that they are no longer usable on the sending side.

transfer array contains duplicate objects or the source or target ports, or if

have scripts whose settings objects specify responsible documents that are not fully

specifies that event loop as the responsible event loop, in the order in

unshipped port message queue is used instead.) The has been shipped flag is set to true when a port, its twin, or

has been shipped flag is true, its port message queue acts as a

local port that is entangled with another port, must cause the user agent to

The following are the event handlers (and their corresponding event handler event types) that must be supported,

MessagePort interface: The first time a MessagePort object's onmessage IDL attribute is set, the port's port

transient memory usage since garbage collection is not necessarily performed promptly, especially

send notifications to each other, for example 'hey, the user logged in over here, check your

For simple cases, though, where a shared worker would be an unreasonable overhead, authors can

settings object is the incumbent settings object, and whose closed flag is false.

when invoked on a BroadcastChannel object, must run the following steps: While a BroadcastChannel object whose closed flag is false has an event listener

listener and without closing them can lead to an apparent memory leak, since the objects will

continue to live for as long as they have an event listener (or until their page or worker is

The following are the event handlers (and their corresponding event handler event types) that must be supported,

or other user interactions, and allows long tasks to be executed without yielding to keep the page

In this example, the main document spawns a worker to (naïvely) compute prime numbers, and

The main page is as follows: The Worker() constructor call creates a worker and returns a

The worker itself is as follows: The bulk of this code is simply an unoptimized search for a prime number.

The main page is as follows: The worker file is then: Which imports the file filters.js: View this example online.

using addEventListener() instead of an event handler IDL attribute, and second, a message is sent to the

principle would apply to an entirely separate page in a separate top-level browsing

All the windows share the same map information, with a single worker coordinating all the viewers.

The main page isn't interesting, it merely provides a way to open the viewers: The viewer is more involved: There are several key things worth noting about the way the viewer is written.

here attaches multiple event listeners, each one performing a quick check to see if it is relevant

to collaborate using a single port to communicate with a worker, it would allow for independent

expensive task that is to be performed for every number from 1 to 10,000,000 is farmed out to ten

The main page is as follows, it just reports the result: The worker itself is as follows: It consists of a loop to start the subworkers, and then a handler

The subworkers are implemented as follows: They receive two numbers in two events, perform the computation for the range of numbers thus

Suppose that a cryptography library is made available that provides three tasks: The library itself is as follows: Note that the crypto functions here are just stubs and don't do real cryptography.

For generating key pairs: For encrypting: For decrypting: Notice how the users of the API don't have to even know that this is happening — the API

a worker is then created and returned: If you want your worker script to be interpreted as a module script instead of

the same features, such as sending structured data, transferring binary data, and transferring

To receive a message inside the worker, the onmessage event handler IDL attribute is used.

Inside the shared worker, new clients of the worker are announced using the connect event.

hand, are named, and once created any script running in the same origin can obtain a

The following are the event handlers (and their corresponding event handler event types) that must be supported,

The following are the event handlers (and their corresponding event handler event types) that must be supported,

DedicatedWorkerGlobalScope interface: For the purposes of the application cache networking model, a dedicated worker is

The following are the event handlers (and their corresponding event handler event types) that must be supported,

o when creating or obtaining a worker, the relevant owner to add depends on

owner set is not empty or: The second part of this definition allows a shared worker to survive for a short

time while a page is loading, in case that page is going to contact the shared worker again.

can be used by user agents as a way to avoid the cost of restarting a shared worker used by a site

processing model defined above): User agents may invoke the terminate a worker algorithm when a worker stops being

an active needed worker and the worker continues executing even after its closing flag was set to true.

did not occur while handling a previous script error, the user agent must

report the error for that script, with the position (line number and column number) where the

queue a task to run these steps: If the implicit port connecting the worker to its Worker object has been

The following are the event handlers (and their corresponding event handler event types) that must be supported,

AbstractWorker interface: When the user agent is required to set up a worker environment settings object,

Worker objects must act as if, when invoked, it immediately invoked the method of the same name on the port, with the same

The following are the event handlers (and their corresponding event handler event types) that must be supported,

getter must return a number between 1 and the number of logical processors potentially available

User agents should err toward exposing the number of logical processors available, using lower

ticket the user was buying, then as the user clicked from page to page in both windows, the ticket

The second storage mechanism is designed for storage that spans multiple windows, and lasts

data, such as entire user-authored documents or a user's mailbox, on the client side for

key/value pair if none existed for key previously.

for the site, or if the quota has been exceeded.) Removes the key/value pair with the given key from the list associated with the

object, if a key/value pair with the given key exists.

defined, but must be consistent within an object so long as the number of keys doesn't change.

changing the value of an existing key must not.) If n is

key/value pair currently present in the list associated with the object, in the order that the

The setItem(key, value) method must first check if a key/value pair with the given key already exists in the list associated with the object.

If it does not, then a new key/value pair must be added to the list, with the given key and with its value set to value.

method must cause the key/value pair with the given key to be removed from the

set of storage areas specific to the current top-level browsing context.

Each top-level browsing context has a unique set of session storage areas, one for

User agents should not expire data from a browsing context's session storage areas, but may do

therefore permanently inaccessible to the user) the data stored in its session storage areas can

user agent process itself, as the user agent can support resuming sessions after a restart.

While creating a new browsing context, the session storage area is sometimes copied over.

When the setItem(), removeItem(), and clear() methods are called on a Storage object x that is associated with a session storage area, if the methods did not throw an

origin or if the request violates a policy decision (e.g.

configured to not allow the page to persist data).

User agents should expire data from the local storage areas only for security reasons or when

contexts in a multiprocess user agent, and authors are encouraged to assume that there is no

value, then write it back out, using the new value as a unique identifier for the session;

site does this twice in two different browser windows at the same time, it might end up using the

If the event is being fired due to an invocation of the setItem() or removeItem() methods, the event must have its key attribute initialized to the name of the key in question,

value of the key in question, or null if the key is newly added, and its newValue attribute initialized to the new value of the

User agents should limit the total amount of space allowed for storage areas, because hostile

authors could otherwise use this feature to exhaust the user's available disk space.

User agents may prompt the user when quotas are reached, allowing the user to grant a site more

sites) could use a unique identifier stored in its local storage area to track a user across

multiple sessions, building a profile of the user's interests to allow for highly targeted

e-commerce site that requires authenticated credentials), this could allow oppressive groups to

target individuals with greater accuracy than in a world with purely anonymous Web usage.

There are a number of techniques that can be used to mitigate the risk of user tracking: User agents may restrict access to the localStorage

objects to scripts originating at the domain of the active document of the top-level browsing

context, for instance denying access to the API for pages from other domains running in

For example, a user agent could be configured to treat third-party local storage areas as

session-only storage, deleting the data once the user had closed all the browsing contexts that could access it.

to track the user across multiple sessions when they authenticate with the site itself (e.g.

also put the user's data at risk, if the user does not fully understand the implications of data

stored in the local storage area, sites can defeat those attempts by using the two features as

a way that helps users to understand this possibility and enables them to delete data in all

an unrestricted manner, but require the user to authorize access

content from third-party origins that caused data to be stored.

it would allow the user to make informed decisions about which parts of the persistent storage

data again'), the user can restrict the use of persistent storage to sites that they trust.

whatsoever, for instance by using session identifiers in URLs, a technique already commonly used

for e-mails, calendar appointments, health records, or other confidential documents to be stored

To this end, user agents should ensure that when deleting data, it is promptly deleted from the

using TLS can be sure that only the user, software working on behalf of the user, and other pages

Different authors sharing one host name, for example users hosting content on the now defunct

security model would make it trivial to bypass this protection and access the data from any

sites read information from other domains, and letting hostile sites write information that is

information leakage, For example, a user's shopping wishlist on one domain could be used

Letting third-party sites write data to the persistent storage of other domains can result in

order: The various types of content mentioned above are described in the next few sections.

elements, escapable raw text elements, foreign elements, and

a start tag to indicate where they begin, and an end tag to indicate where they end.

either have a start tag and an end tag, or a start tag that is marked as self-closing, in which

element's end tag (as with other elements), and may consist of any text, character references, elements, and comments, but

allowed to hold, beyond the restrictions imposed by the content model and those described in this

Start tags must have the following format: End tags must have the following format: Attributes for an element are expressed inside the

ASCII whitespace, followed by a single U+003D EQUALS SIGN character, followed by

zero or more ASCII whitespace, followed by the attribute value, which, in addition to the requirements

given above for attribute values, must not contain any literal ASCII whitespace,

characters (>), or U+0060 GRAVE ACCENT characters (`), and must not be the empty string.

by the optional U+002F SOLIDUS character (/) allowed in step 6 of the start tag syntax above, then there must be ASCII

ASCII whitespace, followed by a single U+003D EQUALS SIGN character, followed by

addition to the requirements given above for attribute values, must not contain any literal

ASCII whitespace, followed by a single U+003D EQUALS SIGN character, followed by

addition to the requirements given above for attribute values, must not contain any literal

attributes given by the local name and namespace of the first and second cells of a row from the

following table, it must be written using the name given by the third cell from the same row.

elements are technically allowed inside table elements according to the content

table in the markup, it will in fact imply a tbody start tag before

single newline may be placed immediately after the start tag of pre and textarea elements.

there are three possible kinds of character references: The numeric character reference forms described above are allowed to reference any code point

In the common case, the data handled by the tokenization stage comes from the network, but

construction stage, but the tree construction stage is reentrant, meaning that while the tree

construction stage is handling one token, the tokenizer might be resumed, causing further tokens

set to zero, and a parser pause flag, which must be initially set to false.

processing rules described throughout this specification), but user agents, while parsing an HTML

parse error conditions exist in the document and must not report parse error conditions if none

checking for parse errors, conformance checkers will also verify that the document obeys all the

Some parse errors have dedicated codes outlined in the table below that should be used by

seen by the user agent as a stream of bytes (typically coming over the network or from the local

sequences are handled can result in, amongst other problems, script injection vulnerabilities

When the HTML parser is decoding an input byte stream, it uses a character encoding and a confidence.

real parser is started, using a tentative encoding derived from this pre-parse and other

sniffing algorithm, to determine the character encoding to use when decoding a document in

bytes available so far, and returns a character encoding and a confidence that is either tentative or

from this algorithm, at the same time as the user agent uses the returned value to select the

determine its encoding, given some defined end condition, then it must run the

point during these steps (including during instances of the get an attribute algorithm invoked by this

created in the first step below goes beyond the end of the byte stream obtained so far) or reaches

its end condition, then abort the prescan a byte stream to determine its

When the prescan a byte stream to determine its encoding algorithm says to get an attribute, it means doing this: For the sake of interoperability, user agents should not use a pre-scan algorithm that returns

that we can improve this algorithm and benefit everyone...) User agents must support the encodings defined in the WHATWG Encoding standard, including, but

failed to find a character encoding, or if it found a character encoding that was not the actual

of the input stream) where content inserted using document.write() is actually inserted.

relative to the position of the character immediately after it, it is not an absolute offset into

insertion mode that was most recently added to the stack of template insertion modes.

The algorithms in the sections below will push insertion modes onto this stack, meaning

that the specified insertion mode is to be added to the stack, and pop insertion modes from

the stack, which means that the most recently added insertion mode must be removed from the

topmost node on the stack is the first one added to the stack, and the bottommost node of the

stack is the most recently added node in the stack (notwithstanding when the stack is manipulated

'before html' insertion mode.) The html node, however it is created, is the topmost node of the stack.

Elements in the stack of open elements fall into the following categories: The following elements have varying levels of special parsing rules: HTML's

handled specifically, while ordinary elements' tokens fall into 'any other start tag'

and 'any other end tag' clauses, and some parts of the tree builder check if a particular element

elements (e.g., the option element) have their start or end tag tokens handled

The stack of open elements is said to have an element target node in a specific scope consisting of a

list of element types list when the following algorithm terminates in a match

that element in the specific scope consisting of the following element types: The stack of open elements is said to have a particular element in list item scope when it has that element in the specific scope consisting of the following

element types: The stack of open elements is said to have a particular element in button scope when it has that element in the specific scope consisting of the following element

types: The stack of open elements is said to have a particular element in table scope when it has that element in the specific scope consisting of the following element

types: The stack of open elements is said to have a particular element in select scope when it has that element in the specific scope consisting of all element types

steps: When the steps below require the UA to reconstruct the active formatting elements,

the UA must perform the following steps: This has the effect of reopening all the formatting elements that were opened in the current

element first and the most recently added element last (except for while steps 7 to 10 of the

When the steps below require the UA to clear the list of active formatting elements up to

the last marker, the UA must perform the following steps: Initially, the head element pointer and the form element pointer are both null.

make form controls associate with forms in the face of dramatically bad markup, for historical

which may have various side-effects, and either switches the state machine to a new state to

reconsume the current input character, or switches it to a new state to

is created, its name, public identifier, and system identifier must be marked as missing (which is

a distinct state from the empty string), and the force-quirks flag must be set to

Start and end tag tokens have a tag name, a self-closing flag, and a list of attributes, each of which has a

When a start or end tag token is created, its self-closing flag must be unset (its other state is that it be set), and its attributes

scripts executing and using the dynamic markup insertion APIs to insert characters

When a start tag token is emitted with its self-closing flag set, if the flag is not

An appropriate end tag token is an end tag token whose tag name matches the tag name

character reference is said to be consumed as part of an attribute if the return state is either attribute value (double-quoted) state,

buffer (in the order they were added to the buffer) user agent must append the code point

from the buffer to the current attribute's value if the character reference was consumed as part of an attribute, or emit the code point as a

Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: When the user agent leaves the attribute name state (and before emitting the tag token, if

Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character:

Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: If the six characters starting from the current input character are an

characters and switch to the after DOCTYPE system keyword state.

Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: U+0000 NULL characters are handled in the tree construction stage, as part of the

Consume the next input character: Consume the maximum number of characters possible, with the consumed characters matching one

attribute, and the last character matched is not a U+003B SEMICOLON character (;), and

ASCII alphanumeric, then, for historical reasons, flush code points consumed

Otherwise: Consume the next input character: Set the character reference code to

Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Consume the next input character: Check the character reference code: Set the temporary buffer to the empty string.

from the following list, known as the tree construction dispatcher: The next token is the token that is about to be processed by the tree

node is an HTML integration point if it is one of the following elements: If the node in question is the context element passed to the HTML fragment

parsing algorithm, then the start tag token for that element is the 'fake' token created

generated, or on the length of tag names, attribute names, attribute values, Text

While implementers are encouraged to avoid arbitrary limits, it is recognized that practical concerns will likely force user agents to impose nesting

override target, is the position in an element returned by running the following steps: When the steps below require the UA to create an

particular intended parent, the UA must run the following steps: When the steps below require the user agent to insert a foreign element for a token

in a given namespace, the user agent must run these steps: When the steps below require the user agent to insert an HTML element for a token,

of the following table, change the attribute's name to the name given in the corresponding cell in

(This fixes the case of SVG attributes that are not all lowercase.) When the steps below require the user agent to adjust foreign attributes for a

token, then, if any of the attributes on the token match the strings given in the first column of

given in the corresponding cell in the second column, the local name being the string given in the

corresponding cell in the third column, and the namespace being the namespace given in the

namespace.) When the steps below require the user agent to insert a character while processing a

token, the user agent must run the following steps: When the steps below require the user agent to insert a comment while processing a

comment token, optionally with an explicitly insertion position position, the

user agent must run the following steps: DOM mutation events must not fire for changes caused by the UA

If a step requires the UA to generate implied end tags but lists an element to exclude from the

element, an rtc element, a tbody element, a td element, a

When the user agent is to apply the rules for the 'initial' insertion mode, the user agent must handle the token as

If the DOCTYPE token's name is not a case-sensitive match for the string 'html', or the token's public identifier is not missing, or the token's system

identifier is neither missing nor a case-sensitive match for the string

Append a DocumentType node to the Document node, with the name attribute set to the name given in the DOCTYPE token, or the empty string

identifier given in the DOCTYPE token, or the empty string if the public identifier was missing;

token, or the empty string if the system identifier was missing;

specific to DocumentType objects set to null and empty lists as appropriate.

mode: Otherwise, if the document is not an iframe srcdoc document, and the DOCTYPE token matches one of

mode: The system identifier and public identifier strings must be compared to the values given in

value is the empty string is not considered missing for the purposes of the conditions

When the user agent is to apply the rules for the 'before html' insertion mode, the user agent must handle the token as

If the Document is being loaded as part of navigation of a browsing context, run these steps: Switch the insertion mode to 'before

If the Document is being loaded as part of navigation of a browsing context, then: run the application cache selection algorithm with no manifest,

When the user agent is to apply the rules for the 'before head' insertion mode, the user agent must handle the token as

head' insertion mode, the user agent must handle the token as follows: Insert the character.

attribute whose value is an ASCII case-insensitive match for the string 'Content-Type', and the element has a content attribute, and applying the algorithm for

extracting a character encoding from a meta element to that attribute's

template insertion modes so that it is the new current template insertion

When the user agent is to apply the rules for the 'in head noscript' insertion mode, the user agent must handle the

When the user agent is to apply the rules for the 'after head' insertion mode, the user agent must handle the token as

this point.) The head element pointer cannot be null at

body' insertion mode, the user agent must handle the token as follows: Parse error.

element, if the stack of open elements has only one node on it, or if there is a

template element on the stack of open elements, then ignore the token.

(fragment case) Otherwise, set the frameset-ok flag to 'not ok';

token, check to see if the attribute is already present on the body element (the

second element) on the stack of open elements, and if it is not, add the attribute

on the stack of open elements is not a body element, then ignore the

Otherwise, run the following steps: If the stack of template insertion modes is not empty, then process the token

Otherwise, follow these steps: If the stack of open elements does not have a body element in scope, this is a parse error;

dd element, a dt element, an li element, an

optgroup element, an option element, a p element, an

rb element, an rp element, an rt element, an

rtc element, a tbody element, a td element, a

tfoot element, a th element, a thead element, a

tr element, the body element, or the html element, then

dd element, a dt element, an li element, an

optgroup element, an option element, a p element, an

rb element, an rp element, an rt element, an

rtc element, a tbody element, a td element, a

tfoot element, a th element, a thead element, a

tr element, the body element, or the html element, then

p element in button scope, then close a p

p element in button scope, then close a p

tag name is one of 'h1', 'h2', 'h3', 'h4', 'h5', or 'h6', then this is a parse

a p element in button scope, then close a p

no template element on the stack of open elements, then this is a

a p element in button scope, then close a p

element on the stack of open elements, set the form element pointer to point to the element created.

p element in button scope, then close a p

last token ever seen other than character tokens (and the end-of-file token), because there is

run these substeps: If there is a template element on the stack of open

elements, then run these substeps instead: If the stack of open elements does not have a p element in button scope, then this is a parse

If the stack of open elements does not have an li element in list item scope, then this is a parse

element and whose tag name is one of 'h1', 'h2', 'h3', 'h4', 'h5', or 'h6', then this is

the list (or the start of the list if there is no marker on the list), then this is a parse

element from the list of active formatting elements and the stack of open

elements if the adoption agency algorithm didn't already remove it (it might

a element would be closed upon seeing the second one, and the 'x' character would

element is not in table scope (meaning that a regular </a> end tag at the start

a elements are indirectly nested inside each other — non-conforming markup

adoption agency algorithm for the token, then once again reconstruct the

p element in button scope, then close a p

attribute's value is not an ASCII case-insensitive match for the string 'hidden', then: set the frameset-ok flag to 'not ok'.

p element in button scope, then close a p

ask.) Run these steps: If the stack of open elements has a

p element in button scope, then close a p

table', 'in caption', 'in table body', 'in row', or 'in cell', then switch the

ruby element in scope, then generate implied end tags.

ruby element in scope, then generate implied end tags, except

attributes, in particular XLink in SVG.) Insert a foreign element for the token, in the SVG namespace.

Run these steps: When the steps above say the user agent is to close a p element, it

means that the user agent must run the following steps: The adoption agency algorithm, which takes as its only argument

steps: This algorithm's name, the 'adoption agency algorithm', comes from the way it

causes elements to change parents, and is in contrast with other possible algorithms for dealing

When the user agent is to apply the rules for the 'text' insertion mode, the user agent must handle the token as

cause some script to execute, which might cause new characters

to be inserted into the tokenizer, and might cause the tokenizer to output more tokens,

nesting level is zero, then set the parser pause flag to false.

This value might be the 'undefined' value.) At this stage, if there is a pending parsing-blocking

script, then: Set the parser pause flag to true, and abort the processing of any nested

invocations of the tokenizer, yielding control back to the caller.

when the caller returns to the 'outer' tree construction stage.) The tree construction stage of this particular parser is being called reentrantly, say from a call to document.write().

table' insertion mode, the user agent must handle the token as follows: Let the pending table character

If the stack of open elements does not have a table element in table scope, ignore the token.

attribute's value is not an ASCII case-insensitive match for the string 'hidden', then: act as described in the 'anything else' entry below.

the form element pointer is not null, ignore the

Otherwise: Insert an HTML element for the token, and set the form element pointer to point to the element created.

When the steps above require the UA to clear the stack back to a table context, it

When the user agent is to apply the rules for the 'in table text' insertion mode, the user agent must handle the token as

character tokens list are character tokens that are not ASCII whitespace,

then this is a parse error: reprocess the character tokens in the pending table character tokens list using the

caption' insertion mode, the user agent must handle the token as follows: If the stack of open elements does not have a caption element in table scope, this is a parse

When the user agent is to apply the rules for the 'in column group' insertion mode, the user agent must handle the token

When the user agent is to apply the rules for the 'in table body' insertion mode, the user agent must handle the token as

element with the same tag name as the token, this is a parse error;

When the steps above require the UA to clear the stack back to a table body context,

row' insertion mode, the user agent must handle the token as follows: Clear the stack back to a table row context.

If the stack of open elements does not have a tr element in table scope, this is a parse error;

If the stack of open elements does not have a tr element in table scope, this is a parse error;

element with the same tag name as the token, this is a parse error;

If the stack of open elements does not have a tr element in table scope, ignore the token.

When the steps above require the UA to clear the stack back to a table row context,

When the user agent is to apply the rules for the 'in cell' insertion mode, the user agent must handle the token as follows: If the stack of open elements does not have an element in table scope that is an HTML

element with the same tag name as the token, then this is a parse error.

Pop elements from the stack of open elements stack until an HTML element with the same tag name as the token has been popped from the

If the stack of open elements does not have a td or th element in table scope, then this

select' insertion mode, the user agent must handle the token as follows: Parse error.

element, then pop the current node from the stack of open

If the stack of open elements does not have a select element in select scope, ignore the token.

(fragment case) Otherwise: Pop elements from the stack of open elements until a select element

If the stack of open elements does not have a select element in select scope, ignore the token.

(fragment case) Otherwise: Pop elements from the stack of open elements until a select element

When the user agent is to apply the rules for the 'in select in table' insertion mode, the user agent must handle the

element with the same tag name as that of the token, then ignore the token.

template' insertion mode, the user agent must handle the token as follows: Process the token using the rules for the 'in body' insertion mode.

template insertion modes so that it is the new current template insertion

stack of template insertion modes so that it is the new current template

of template insertion modes so that it is the new current template insertion

insertion modes so that it is the new current template insertion mode.

insertion modes so that it is the new current template insertion mode.

When the user agent is to apply the rules for the 'after body' insertion mode, the user agent must handle the token as follows: Process the token using the rules for the 'in body' insertion mode.

case) Otherwise, switch the insertion mode to 'after after body'.

frameset' insertion mode, the user agent must handle the token as follows: Insert the character.

algorithm (fragment case), and the current node is no longer a

frameset element, then switch the insertion mode to 'after frameset'.

When the user agent is to apply the rules for the 'after frameset' insertion mode, the user agent must handle the token

When the user agent is to apply the rules for the 'after after body' insertion mode, the user agent must handle the token

When the user agent is to apply the rules for the 'after after frameset' insertion mode, the user agent must handle the

When the user agent is to apply the rules for parsing tokens in foreign content, the user agent

then act as described in the 'any other start tag' entry below.

(fragment case) Otherwise: Pop an element from the stack of open elements, and then keep popping more

elements from the stack of open elements until the current node is a

MathML text integration point, an HTML integration point, or an

that are not all lowercase.) If the adjusted current node is an element in the SVG namespace, and the

token's tag name is one of the ones in the first column of the following table, change the tag

name to the name given in the corresponding cell in the second column.

SVG elements that are not all lowercase.) If the adjusted current node is an element in the SVG namespace,

attributes, in particular XLink in SVG.) Insert a foreign element for the token, in the same namespace as the

flag, and then act as described in the steps for a 'script' end tag below.

SVG script element according to the SVG rules, if the user agent

inserted into the tokenizer, the parser will not be executed reentrantly, since the

nesting level is zero, then set the parser pause flag to false.

When the user agent is to abort a parser, it must run the following steps: Except where otherwise specified, the task source for the tasks mentioned in this section is the DOM manipulation task

For example, an XML toolchain might not be able to represent attributes with the name xmlns, since they conflict with the Namespaces in XML syntax.

If the XML API doesn't support attributes in no namespace that are named 'xmlns', attributes whose names start with 'xmlns:', or

attributes, then the tool may map all element and attribute local names that the API wouldn't

supported with the uppercase letter U and the six digits of the character's code point when

expressed in hexadecimal, using digits 0-9 and capital letters A-F as the symbols, in increasing

output by the HTML parser, though it is neither a legal HTML element name nor a

Used on a MathML element, it becomes, after being adjusted, an attribute with a prefix 'xlink' and a local

will be closed by a </a::> end tag, and never by a </aU00003AU00003A> end tag, even if the user agent is using the rules above to

The most-often discussed example of erroneous markup is as follows: The parsing of this markup is straightforward up to the '3'.

The next token is a character ('4'), triggers the reconstruction of the active formatting elements, in this case just

case similar to the previous one is the following: Up to the '2' the parsing here is straightforward: The interesting part is when the end tag token with the tag name 'b' is parsed.

moved to it: Finally, the new b element is appended to the p element, so that the

DOM looks like: The b element is removed from the list of active formatting elements

the following markup: The highlighted b element start tag is not allowed directly inside a table like

as it stands just after the table element's start tag has been seen: ...and then immediately after the b element start tag has been seen: At this point, the stack of open elements has on it the elements

The tr start tag causes the b element to be popped off the stack and

are then handled in a rather straight-forward manner, taking the parser through the 'in table body' and 'in row' insertion modes, after which the DOM looks as follows: Here, the stack of open elements has on it the elements html,

The td element start tag token, after putting a td element on the

are reconstructed, a b element is created and foster parented, and then the 'bbb' Text node is appended to it: The stack of open elements has on it the elements html,

doesn't affect the list of active formatting elements, so the 'ccc' character tokens

after the table result in yet another b element being created, this time after the

an iframe in another document with the URL https://example.com/outer: Up to the first 'script' end tag, before the script is parsed, the result is relatively

script is being downloaded, the element is moved to another document, the script continues to

The resulting DOM tree is as follows: Note how the second p element in the markup has no explicit b

three b elements with the class attribute, and two unadorned b elements)

needed to completely clear the list of active formatting elements, even though nine

Because of the special role of the is attribute in signaling the creation of customized built-in elements, in that it provides a mechanism for parsed

consists of running the following steps: The following steps form the HTML fragment parsing algorithm.

takes as input an Element node, referred to as the context element, which gives the context for

the parser, as well as input, a string to parse, and returns a list of zero or

that follows the rules given in the XML specification to map a string of bytes or characters into

regarding what happens when an element is inserted into a document or has its attributes set, and

[DOM] [UIEVENTS] Between the time an element's start tag is parsed and the time either the element's end tag is

parsed or the parser detects a well-formedness error, the user agent must act as if the element

when retrieving an external entity: the public identifiers given in the following list all

declarations for the names listed in the named character references section.) [XML] Furthermore, user agents should attempt to retrieve the above external entity's content when

motivated by a desire for user agents to all handle entities in an interoperable fashion without

element's end tag is subsequently parsed, the user agent must perform a microtask checkpoint, and

For Documents, the algorithm must return a string in the form of a document entity, if none of the error cases

For Elements, the algorithm must return a string in the form of an internal general parsed entity, if none of the

User agents may adjust prefixes and namespace declarations in the serialization (and indeed might

combination of regular text and character references to represent Text nodes in the

node's relevant child nodes are those that apply given the following rules: For Elements, if any of the elements in the serialization are in no namespace, the

default namespace in scope for those elements must be explicitly declared as the empty string.

algorithm is as follows: User agents are not required to present HTML documents in any particular way.

section provides a set of suggestions for rendering HTML documents that, if followed, are likely

to lead to a user experience that closely resembles the experience intended by the documents'

The suggestions in this section generally assume a visual output medium with a resolution of

User agents that do not honor author-level CSS style sheets are nonetheless expected to act as

used as part of the user-agent level style sheet defaults for all documents that contain

set, and parsing that attribute's value using the rules for parsing non-negative

integers doesn't generate an error, then the user agent is expected to use the parsed value

set, and parsing that attribute's value using the rules for parsing dimension values

doesn't generate an error, then the user agent is expected to use the parsed dimension as the

properties, with the value given as a pixel length if the dimension was a length, and

set, and parsing that attribute's value using the rules for parsing nonzero dimension

properties, with the value given as a pixel length if the dimension was a length, and

When a user agent is to align descendants of a node, the user agent is expected to

particular descendant, the most deeply nested such element is expected to override the others.

cannot be parsed successfully, then a default value of 8px is expected to be used for that

If the body element's node document's browsing context is a nested browsing context,

is potentially a security risk, as it might in some cases allow an attack to contrive a situation

in which a page is rendered not as the author intended, possibly for the purposes of phishing or

positioned and sized to fit inside the content box of its browsing context

frame or iframe element, and that element has a scrolling attribute, and that attribute's value is an ASCII

case-insensitive match for the string 'off', 'noscroll', or 'no', then the user agent is expected to

attribute set to a non-empty value, the new value is expected to be parsed relative to the element's node document, and if this is

successful, the user agent is expected to treat the attribute as a presentational hint setting the element's 'background-image' property

attribute set, the new value is expected to be parsed using the rules for parsing a legacy

color value, and if that does not return an error, the user agent is expected to treat the

value is expected to be parsed using the rules for parsing a legacy color value, and

if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the element's

value is expected to be parsed using the rules for parsing a legacy color value, and

if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the 'color' property

its value is expected to be parsed using the rules for parsing a legacy color value,

and if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the 'color' property

its value is expected to be parsed using the rules for parsing a legacy color value,

and if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the 'color' property

:active pseudo-class and either the :link pseudo-class or the :visited pseudo-class to the resulting color.

The following rules are also expected to apply, as presentational hints: In quirks mode, the following rules are also expected to apply: The center element, and the div element when it has an align attribute whose value is an ASCII

their 'text-align' property set to 'center' in a presentational hint, and to align descendants to the center.

attribute whose value is an ASCII case-insensitive match for the string 'left', is expected to left-align text within itself, as if it had its

'text-align' property set to 'left' in a presentational hint, and to align descendants to the left.

attribute whose value is an ASCII case-insensitive match for the string 'right', is expected to right-align text within itself, as if it had its

'text-align' property set to 'right' in a presentational hint, and to align descendants to the right.

attribute whose value is an ASCII case-insensitive match for the string 'justify', is expected to full-justify text within itself, as if it had its

'text-align' property set to 'justify' in a presentational hint, and to align descendants to the left.

presentational hints: For the purposes of the CSS ruby model, runs of children of ruby elements that are

distributed on both sides of the base text so as to minimize the stacking of ruby annotations on

expressed.) User agents that do not support correct ruby rendering are expected to render parentheses

attribute, its value is expected to be parsed using the rules for parsing a legacy color

value, and if that does not return an error, the user agent is expected to treat the

override the color of any text decoration that spans the text of the element to the

attribute, the user agent is expected to treat the attribute as a presentational hint setting the element's 'font-family' property to the

attribute, the user agent is expected to use the following steps, known as the rules for

parsing a legacy font size, to treat the attribute as a presentational hint setting the element's 'font-size' property: When an input element's dir attribute is in the

expected to act as if it had a user-agent-level style sheet rule setting the

additionally expected to apply, following those above: [ENCODING] This block is automatically generated from the Unicode Common Locale Data Repository.

:matches(article, aside, nav, section) The shorthand is used to keep this block at least mildly readable.

ordinal value of the li element to render the counter in the list item

The following rules are also expected to apply, as presentational hints: In quirks mode, the following rules are also expected to apply: For the purposes of the CSS table model, the col element is expected to be treated

attribute whose value is an ASCII case-insensitive match for either the string 'center' or the string 'middle', are expected to center

text within themselves, as if they had their 'text-align' property set to 'center' in

attribute whose value is an ASCII case-insensitive match for the string 'left', are expected to left-align text within themselves, as if they had their

'text-align' property set to 'left' in a presentational hint, and to align descendants to the left.

attribute whose value is an ASCII case-insensitive match for the string 'right', are expected to right-align text within themselves, as if they had their

'text-align' property set to 'right' in a presentational hint, and to align descendants to the right.

attribute whose value is an ASCII case-insensitive match for the string 'justify', are expected to full-justify text within themselves, as if they had

their 'text-align' property set to 'justify' in a presentational hint, and to align descendants to the left.

th elements that have a parent node whose computed value for the

'text-align' property is its initial value, whose declaration block consists of just

tr, td, or th element has a background attribute set to a non-empty value, the new value is

document, and if this is successful, the user agent is expected to treat the attribute as a

attribute set, the new value is expected to be parsed using the rules for parsing a legacy

color value, and if that does not return an error, the user agent is expected to treat the

attribute, its value is expected to be parsed using the rules for parsing a legacy color

value, and if that does not return an error, the user agent is expected to treat the

attribute is present but parsing the attribute's value using the rules for parsing

non-negative integers generates an error, a default value of 1px is expected to be used for

in the CSS block above is expected to only be applied if the border attribute mentioned in the selectors for the rule is not

only present but, when parsed using the rules for parsing non-negative integers, is

nowrap attribute but also has a width attribute whose value, when parsed using the rules for

parsing nonzero dimension values, is found to be a length (not an error or a number

classified as a percentage), is expected to have a presentational hint setting the element's 'white-space' property to

p, plaintext, pre, ul, xmp In quirks mode, any element

body, td, or th element and has no substantial previous siblings is expected to have a

user-agent level style sheet rule that sets its 'margin-block-start' property to

body, td, or th element, has no substantial previous siblings, and is blank, is expected to have a user-agent level style sheet

td or th element, has no substantial following siblings, and is blank, is expected to have a user-agent level style sheet

In quirks mode, any p element that is the child of a td or th element and has

to have a user-agent level style sheet rule that sets its 'margin-block-end' property

In quirks mode, the following rules are also expected to apply: Each kind of form control is also described in the Widgets section,

The following rules are also expected to apply, as presentational hints: If an hr element has either a color attribute

or a noshade attribute, and furthermore also has a size attribute, and parsing that attribute's value using the

agent is expected to use the parsed value divided by two as a pixel length for

attribute nor a noshade attribute, but does have a size attribute, and parsing that attribute's value using the

parsed value is one, then the user agent is expected to use the attribute as a presentational hint setting the element's

the user agent is expected to use the parsed value minus two as a pixel length for

value is expected to be parsed using the rules for parsing a legacy color value, and

if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the element's

direction over the border edge in the position given in the corresponding cell on the

replaced element about one line high, as wide as is necessary to expose the user

When an audio element is not exposing a user interface, the user agent is expected to force

Whether a video element is exposing a user interface is not expected to affect the size of the rendering;

controls are expected to be overlaid above the page content without causing any layout changes,

When a video element represents a poster frame or frame of video, the poster frame

or frame of video is expected to be rendered at the largest size that maintains the aspect ratio

interface for a video element, the user agent should run the rules for

tracks in the video element's list of text tracks that are showing and whose text track kind is one of subtitles or captions (e.g., for text

The following CSS rules are expected to apply: User agents are expected to render img elements and input elements

from the following list: The icons mentioned above are expected to be relatively small so as not to disrupt most text

animated image data is inserted into a document, it jumps to the point in the animation cycle that

same image data in that img element's node document are expected to restart

mode: The following CSS rules are expected to apply as presentational hints: When an embed, iframe, img, or object

attribute is in the Image Button state, has an align attribute whose value is an ASCII case-insensitive match for

agent is expected to act as if the element's 'vertical-align' property was set to a

value that aligns the vertical middle of the element with the parent element's baseline.

with a type attribute in the Image Button state has a border attribute whose value, when parsed using the rules for

parsing non-negative integers, is found to be a number greater than zero, the user agent is

expected to use the parsed value for eight presentational hints: four setting the

that the user expects will eventually represent an image, map to the dimension properties 'width' and 'height' on

elements independent of the original area element that happen to match the same style

Thus, for example, if an area element has a style attribute that sets the 'cursor' property to 'help',

property appropriately to achieve platform-native appearances for widgets, and are expected to

element's shadow tree is expected to take the element's first summary element child,

'inline-block' box depicting a text control that obscures data entry.

selection, the user agent is expected to queue a task, using the user

that attribute's value using the rules for parsing non-negative integers doesn't

generate an error, then the user agent is expected to use the attribute as a presentational hint for the 'width' property on

the element, with the value obtained from applying the converting a character width to

attribute, then the user agent is expected to act as if it had a user-agent-level style sheet rule

setting the 'width' property on the element to the value obtained from applying the

average character width of the primary font for the element for which the algorithm is being run,

(The element's 'letter-spacing' property does not affect the result.) An input element whose type attribute is in

render as an 'inline-block' box depicting a local date and time control.

horizontal slider, with the lowest value on the right if the 'direction' property on

control is taller than it is wide, it is expected to be a vertical slider, with the lowest value

attribute) are expected to be shown as tick marks on the slider, which the slider can snap to.

left-to-right ('ltr') horizontal control would have the lowest value on the left and the highest

attribute) are expected to be shown in the color picker interface, not on the color well

'inline-block' box containing a single radio button control, with no label.

'inline-block' box containing a span of text giving the file name(s) of the selected files, if any, followed by a button

'inline-block' box depicting a button, about one line high, containing the contents

expected to render in an animated fashion according to its attributes as follows: Slide the contents of the element in the direction described by the direction attribute as defined below, such that it begins

off the start side of the marquee, and ends flush with the inner end side.

contents would start such that their left edge are off the side of the right edge of the

marquee's content area, and the contents would then slide up to the

point where the left edge of the contents are flush with the left inner edge of the

on after this, then the user agent is expected to restart the animation.

Slide the contents of the element in the direction described by the direction attribute as defined below, such that it begins

off the start side of the marquee, and ends off the end side of the

contents would start such that their left edge are off the side of the right edge of the

marquee's content area, and the contents would then slide up to the

point where the right edge of the contents are flush with the left inner edge of the

on after this, then the user agent is expected to restart the animation.

attribute as defined below, such that it begins flush with the start side of the

marquee, and ends flush with the end side of the marquee.

When the marquee current loop index is odd, slide the contents of the element in

the opposite direction than that described by the direction attribute as defined below, such that it begins

flush with the end side of the marquee, and ends flush with the start side of the

contents would with their right edge flush with the right inner edge of the

marquee's content area, and the contents would then slide up to the

point where the left edge of the contents are flush with the left inner edge of the

on after this, then the user agent is expected to continue the animation.

in the following table: In any case, the animation should proceed such that there is a delay given by the marquee

attribute set, the value is expected to be parsed using the rules for parsing a legacy color

value, and if that does not return an error, the user agent is expected to treat the

horizontal gauge, with the minimum value on the right if the 'direction' property on

element is taller than it is wide, it is expected to depict a vertical gauge, with the minimum

element is wider than it is tall, the element is expected to be depicted as a horizontal progress

'spinner' progress indicator with square dimensions, which could be used when the element is

indeterminate, and what progress a determinate progress bar is to show, are included in the

'inline-block' box whose 'height' is the height necessary to contain as

size, or four rows if the attribute is absent, and whose 'width' is the

expected to render as a one-line drop down box whose width is the width of the

In either case (list box or drop-down box), the element's items are expected to be the

An option element is expected to be rendered by displaying the element's label, indented under its optgroup element if it

any alignment remains consistent whether the label is being displayed as part of the page or in a

when the user changes the current selection, the user agent is expected to queue a

task, using the user interaction task source, to fire an event named select

attribute's value using the rules for parsing non-negative integers doesn't generate

an error, then the user agent is expected to use the attribute as a presentational hint for the 'width' property on the element, with the

agent is expected to act as if it had a user-agent-level style sheet rule setting the

avg is the average character width of the primary font of the element, in CSS pixels, and sbw is the width of a scroll bar, in CSS pixels.

attribute's value using the rules for parsing non-negative integers doesn't generate

an error, then the user agent is expected to use the attribute as a presentational hint for the 'height' property on the element, with the

agent is expected to act as if it had a user-agent-level style sheet rule setting the

CSS pixels of the number of lines specified the element's character height, plus the height of a scrollbar in CSS pixels.

case-insensitive match for the string 'off', then the user agent is expected to treat the attribute as a presentational hint setting the element's

algorithm: The algorithm to convert a list of dimensions to a list of pixel values consists of

the following steps: User agents working with integer values for frame widths (as opposed to user agents that can

lay frames out with subpixel accuracy) are expected to distribute the remainder first to the last

entry whose unit is relative, then equally (not proportionally) to each entry whose unit is

User agents are expected to allow users to discover the destination of hyperlinks and of forms before triggering their

CHARACTER TABULATION (tab) characters are expected to render as a nonzero horizontal shift that

lines up the next glyph with the next tab stop, with tab stops occurring at points that are

replaced element with the vertical dimensions of the caret and with zero width for

interfaces, for example supporting the bidirectional algorithm in text shown in dialogs, title

[BIDI] When necessary, authors can enforce a particular direction for a given paragraph by starting it

conditions above stop applying, and thus a user agent following these requirements will switch to

The attribute should be entirely omitted instead (with the value 'JavaScript', it has no effect), or replaced with use of the type attribute.

language, this attribute was intended as a way to specify possible targets for fragments in URLs.

specification, specify the maxlength and size attributes on input elements whose type attributes are in the Number state.

regardless is to help legacy user agents that do not support input elements with

circumstances, conformance checkers must warn the user when the following features are used in a

distinguish between likely mistakes (regular conformance errors) and mere vestigial markup or

the certificate, and then export the certificate and key to allow the user to install them

Use text that begins in an unambiguous and terse manner, and include any more elaborate text after that.

The title attribute can also be useful in including more detailed text, so that the cell's contents can be made terse.

parsing its value using the rules for parsing non-negative integers does not return

for parsing integers does not return an error or a number less than 1, is the parsed value,

which must cause the following steps to be run: The following are the event handlers (and their corresponding event handler event types) that must be supported,

as event handler content attributes and event handler IDL attributes, by

marquee elements: The behavior, direction, height, hspace, vspace, and width IDL attributes must reflect the

loaded at the time of the new navigation, then the navigation must be completed with replacement enabled.

when the nested browsing context was created, then any navigation required of the user agent in that algorithm must be completed

loaded, the user agent must queue a task to fire an event named load at

frame element must reflect the element's longdesc content attribute, which for the purposes

browsing context, if the element's nested browsing context is non-null, or

URL, despite rules regarding its handling in the rendering section above.) The clear IDL attribute of the br

here as it was defined in a previous version of the DOM specifications.) The align, color, size,

iframe element must reflect the element's longdesc content attribute, which for the purposes of

img element must reflect the element's longdesc content attribute, which for the purposes of reflection

meta element as an extension of the element's name content attribute when processing a meta element

and instead process the value given to the metadata name as if it had been specified for each

The align, archive, border, code, declare, hspace, standby, and vspace IDL attributes of the object

object element must reflect the element's codebase content attribute, which for the purposes of

The align, border, frame, summary, rules, and width, IDL attributes of the table element

thead, and tfoot elements must reflect the elements' char content attributes.

td and th elements must reflect the elements' bgcolor content attributes.

name given in the corresponding cell in the second column on the same row, if the body

frameset element, the attributes must instead return the empty string on getting and

document's character encoding, overriding any character encoding declarations in the document other than a Byte Order

Some general concerns bear mentioning here, however: HTML is scripted language, and has a large number of APIs (some of which are described in

leakage, cross-site scripting attacks, cross-site request forgeries, and a host of other

correctly, a full implementation is a massive undertaking and, as with any software, user agents

are required for broad compatibility with legacy content but that expose the user to unfortunate

some other features as a way to effect a port scan from the user's location on the Internet.

This can expose local network topologies that the attacker would otherwise not be able to

It is critical, therefore, to ensure that any untrusted content that forms part of a site be

content can easily spoof any other page on the same origin, read data from that origin, cause

scripts in that origin to execute, submit forms to and from that origin even if they are

protected from cross-site request forgery attacks by unique tokens, and make use of any

third-party resources exposed to or rights granted to that origin.

either refer to the indicated part of the document or provide state information for

specific rules when populating a cache based on a cache manifest,

information leakage, cross-site scripting attacks, and the

the context of drag-and-drop, are the primary application class for this type.

restrictions to avoid depleting local resources because of an overabundance of information from

element whose content model contains the 'phrasing' category could be a parent of an

Part of the revision history of the custom elements feature can be found in the w3c/webcomponents repository, which

Don Norman and Mick McManus on "Design in the Age of AI: A design debate"

A Google TechTalk, 12/15/16, presented by Don Norman and Mickey McManus ABSTRACT: As the number of increasingly intelligent machines increases and their role shifts from automating labor to...

Doctoral Program Conference: #decoding, Session 1, Unsettling

3/11/16 Power inscribes order on space through codes. Bureaucratic codes measure and normalize dynamic ecologies and constitute the substrate of any infrastructural system, organization, and...

Active Matter Summit: Session 5

In recent decades, developments in software and hardware technologies have created dramatic shifts in design, manufacturing and research. Software technologies have facilitated automated process...

Google I/O'17: Channel 4

Technical sessions and deep dives into Google's latest developer products and platforms.