Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2017 21:59
Show Gist options
  • Save anonymous/244ddf8c107598d4e0a48a9d79fbd276 to your computer and use it in GitHub Desktop.
Save anonymous/244ddf8c107598d4e0a48a9d79fbd276 to your computer and use it in GitHub Desktop.
Http page html

Http page html


Http page html



How to Redirect a Web Page
Как создать страницу ошибки 404?
Как сделать редирект. Все виды.


























HTML meta refresh redirect is a client side redirect and is not permanent redirect. The HTML meta refresh with 0 seconds time interval, is considered by Google as a hint for redirect for pagerank transfer. If you want to do real permanent redirect, you can do it with PHP redirect after enabling PHP code in HTML files. HTML meta refresh redirect The redirection is done with the meta refresh in the head section. HTML meta refresh redirect test. The canonical link does not redirect to the preferred URL, but it can be an alternative to URL redirection for websites that most of the traffic arrives from search engines. HTML canonical link tag can be used when there are several pages with similar content and you want to tell the search engines which page you prefer to use in the search results. Add the canonical link tag to the pages that you prefer not to get search engines traffic to link to the preferred page. HTML redirection HTML redirect. HTML meta refresh redirection code. The link in the body section for fallback purposes. Replace old page with redirection code with the URL of the page you want to redirect to. HTML meta refresh redirect test HTML canonical link tag redirect The canonical link does not redirect to the preferred URL, but it can be an alternative to URL redirection for websites that most of the traffic arrives from search engines. Canonical link tag can link to the same domain and also cross-domain. Add the canonical link tag to the old page to link to the new page. Write how to improve this page.


Оптимальный redirect (META тег + JavaScript)


Please check the errata for any errors or issues reported since publication. This specification is also available as a single page HTML document. W3C liability , trademark and document use rules apply. This specification defines the 5th major revision of the core language of the World Wide Web: In this version, new features are introduced to help Web application authors, new elements are introduced based on research into prevailing authoring practices, and special attention has been given to defining clear conformance criteria for user agents in an effort to improve interoperability. This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http: This specification is the 28 October Recommendation. If you wish to make comments regarding this document in a manner that is tracked by the W3C, please submit them via our our public bug database open bugs. If you cannot do this then you can also e-mail feedback to public-html w3. All feedback is welcome. A comprehensive test suite for this specification is maintained and kept up to date as part of the WebPlatform Tests project. Work on evolutions of this specification proceeds at http: The HTML5 Recommendation represents a milestone in the development of HTML but far from being the end of the road and improvements are already well under way. It is possible that future versions will no longer be published as a monolithic specification but rather as a set of smaller modules. Irrespective of whether that is the case or not, http: Work on extending this specification typically proceeds through extension specifications which should be consulted to see what new features are being reviewed. The bulk of the text of this specification is also available in the WHATWG HTML Living Standard , under a license that permits reuse of the specification text. This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. This enhances the functionality and interoperability of the Web. Work on this specification is also done at the WHATWG. The W3C HTML working group actively pursues convergence of the HTML specification with the WHATWG living standard, within the bounds of the W3C HTML working group charter. There are various ways to follow this work at the WHATWG:. This document was produced by a group operating under the 5 February W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim s must disclose the information in accordance with section 6 of the W3C Patent Policy. This document is governed by the 14 October W3C Process Document. HTML was primarily designed as a language for semantically describing scientific documents, although its general design and adaptations over the years have enabled it to be used to describe a number of other types of documents. The main area that has not been adequately addressed by HTML is a vague subject referred to as Web Applications. This specification attempts to rectify this, while at the same time updating the HTML specifications to address issues raised in the past few years. This specification is intended for authors of documents and scripts that use the features defined in this specification , implementors of tools that operate on pages that use the features defined in this specification, and individuals wishing to establish the correctness of documents or implementations with respect to the requirements of this specification. This document is probably not suited to readers who do not already have at least a passing familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity for completeness. More approachable tutorials and authoring guides can provide a gentler introduction to the topic. In particular, familiarity with the basics of DOM is necessary for a complete understanding of some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML, Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not essential. This specification is limited to providing a semantic-level markup language and associated semantic-level scripting APIs for authoring accessible pages on the Web ranging from static documents to dynamic applications. The scope of this specification does not include providing mechanisms for media-specific 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 the language. The scope of this specification is not to describe an entire operating system. In particular, hardware configuration software, image manipulation tools, and applications that users would be expected to use with high-end workstations on a daily basis are out of scope. In terms of applications, this specification is targeted specifically at applications that would be expected to be used by users on an occasional basis, or regularly but from disparate locations, with low CPU requirements. Examples of such applications include online purchasing systems, searching systems, games especially multiplayer online games , public telephone books or address books, communications software e-mail clients, instant messaging clients, discussion software , document editing software, etc. For its first five years , HTML went through a number of revisions and experienced a number of extensions, primarily hosted first at CERN, and then at the IETF. A first abortive attempt at extending HTML in known as HTML 3. HTML4 quickly followed later that same year. The following year, the W3C membership decided to stop evolving HTML and instead begin work on an XML-based equivalent, called XHTML. This effort started with a reformulation of HTML4 in XML, known as XHTML 1. In parallel with this, the W3C also worked on a new language that was not compatible with the earlier HTML and XHTML languages, calling it XHTML2. These efforts then petered out, with some DOM Level 3 specifications published in but the working group being closed before all the Level 3 drafts were completed. In , the publication of XForms, a technology which was positioned as the next generation of Web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements for it. Shortly thereafter, Apple, Mozilla, and Opera jointly announced their intent to continue working on the effort under the umbrella of a new venue called the WHATWG. A public mailing list was created, and the draft was moved to the WHATWG site. The copyright was subsequently amended to be jointly owned by all three vendors, and to allow reuse of the specification. The WHATWG was based on several core principles, in particular that technologies need to be backwards compatible, that specifications and implementations need to match even if this means changing the specification rather than the implementations, and that specifications need to be detailed enough that implementations can achieve complete interoperability without reverse-engineering each other. The latter requirement in particular required that the scope of the HTML5 specification include what had previously been specified in three separate documents: HTML4, XHTML1, and DOM2 HTML. It also meant including significantly more detail than had previously been considered the norm. In , the W3C indicated an interest to participate in the development of HTML5 after all, and in formed a working group chartered to work with the WHATWG on the development of the HTML5 specification. Apple, Mozilla, and Opera allowed the W3C to publish the specification under the W3C copyright, while keeping a version with the less restrictive license on the WHATWG site. For a number of years, both groups then worked together under the same editor: In , the groups came to the conclusion that they had different goals: In mid , a new editing team was introduced at the W3C to take care of creating a HTML5 Recommendation and prepare a Working Draft for the next HTML version. Since then, the W3C HTML WG has been cherry picking patches from the WHATWG that resolved bugs registered on the W3C HTML specification or more accurately represented implemented reality in UAs. At time of publication of this document, patches from the WHATWG HTML specification have been merged until revision inclusive. The W3C HTML editors have also added patches that resulted from discussions and decisions made by the W3C HTML WG as well a bug fixes from bugs not shared by the WHATWG. A separate document is published to document the differences between the HTML specified in this document and the language described in the HTML4 specification. It must be admitted that many aspects of HTML appear at first glance to be nonsensical and inconsistent. Features have thus arisen from many sources, and have not always been designed in especially consistent ways. Furthermore, because of the unique characteristics of the Web, implementation bugs have often become de-facto, and now de-jure, standards, as content is often unintentionally written in ways that rely on them before they can be fixed. Despite all this, efforts have been made to adhere to certain design goals. These are described in the next few subsections. To avoid exposing Web authors to the complexities of multithreading, the HTML and DOM APIs are designed such that no script can ever detect the simultaneous execution of other scripts. Even with workers , the intent is that the behavior of implementations can be thought of as completely serializing the execution of all scripts in all browsing contexts. This specification interacts with and relies on a wide variety of other specifications. In certain circumstances, unfortunately, conflicting needs have led to this specification violating the requirements of these other specifications. Whenever this has occurred, the transgressions have each been noted as a " willful violation ", and the reason for the violation has been noted. HTML has a wide number of extensibility mechanisms that can be used for adding semantics in a safe manner:. This specification defines an abstract language for describing documents and applications, and some APIs for interacting with in-memory representations of resources that use this language. There are various concrete syntaxes that can be used to transmit resources that use this abstract language, two of which are defined in this specification. The first such concrete syntax is the HTML syntax. This is the format suggested for most authors. It is compatible with most legacy Web browsers. This specification defines version 5. The second concrete syntax is the XHTML syntax, which is an application of XML. Authors are reminded that the processing for XML and HTML differs; in particular, even minor syntax errors will prevent a document labeled as XML from being rendered fully, whereas they would be ignored in the HTML syntax. The DOM, the HTML syntax, and the XHTML syntax cannot all represent the same content. For example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM and in the XHTML syntax. Similarly, documents that use the noscript feature can be represented using the HTML syntax, but cannot be represented with the DOM or in the XHTML syntax. There are also some appendices, listing obsolete features and IANA considerations , and several indices. This specification should be read like all other specifications. First, it should be read cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be read by picking random sections from the contents list and following all the cross-references. As described in the conformance requirements section below, this specification describes conformance criteria for a variety of conformance classes. In particular, there are conformance requirements that apply to producers , for example authors and the documents they create, and there are conformance requirements that apply to consumers , for example Web browsers. They can be distinguished by what they are requiring: It might be that the consumers are in fact required to treat the attribute as an opaque string, completely unaffected by whether the value conforms to the requirements or not. It might be as in the previous example that the consumers are required to parse the value using specific rules that define how invalid non-numeric in this case values are to be processed. The defining instance of a term is marked up like this. Uses of that term are marked up like this or like this. The defining instance of an element, attribute, or API is marked up like this. References to that element, attribute, or API are marked up like this. In some cases, requirements are given in the form of lists with conditions and corresponding requirements. In such cases, the requirements that apply to a condition are always the first set of requirements that follow the condition, even in the case of there being multiple sets of conditions for those requirements. Such cases are presented as follows:. IP addresses do not perfectly match to a user; as a user moves from device to device, or from network to network, their IP address will change; similarly, NAT routing, proxy servers, and shared computers enable packets that appear to all come from a single IP address to actually map to multiple users. Technologies such as onion routing can be used to further anonymize requests so that requests from a single user at one node on the Internet appear to come from many disparate parts of the network. There are other mechanisms that are more subtle. Grouping requests in this manner, especially across multiple sites, can be used for both benign and even arguably positive purposes, as well as for malevolent purposes. An example of a 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 visits to participating sites. Since the malevolent purposes can be remarkably evil, user agent implementors are encouraged to consider how to provide their users with tools to minimize leaking information that could be used to fingerprint a user. More subtly, though, information such as how wide text is, which is necessary for many effects that involve drawing text onto a canvas e. In this case, by potentially exposing, via a brute force search, which fonts a user has installed, information which can vary considerably from user to user. Features in this specification which can be used to fingerprint the user are marked as this paragraph is. Other features in the platform can be used for the same purpose, though, including, though not limited to:. 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 the ways in which the elements can be nested. Elements can have attributes, which control how the elements work. In the example below, there is a hyperlink , formed using the a element and its href attribute:. Otherwise, it has to be quoted using either single or double quotes. HTML user agents e. Web browsers then parse this markup, turning it into a DOM Document Object Model tree. A DOM tree is an in-memory representation of a document. DOM trees contain several kinds of nodes, in particular a DocumentType node, Element nodes, Text nodes, Comment nodes, and in some cases ProcessingInstruction nodes. The markup snippet at the top of this section would be turned into the following DOM tree:. The root element of this tree is the html element, which is the element always found at the root of HTML documents. It contains two elements, head and body , as well as a Text node between them. However, for historical reasons not all of the spaces and line breaks in the original markup appear in the DOM. In 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 body. The head element contains a title element, which itself contains a Text node with the text "Sample page". Similarly, the body element contains an h1 element, a p element, and a comment. This DOM tree can be manipulated from scripts in the page. Scripts typically in JavaScript are small programs that can be embedded using the script element or using event handler content attributes. Each element in the DOM tree is represented by an object, and these objects have APIs so that they can be manipulated. For instance, a link e. 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. HTML documents represent a media-independent description of interactive content. HTML documents might be rendered to a screen, or through a speech synthesizer, or on a braille display. To influence exactly how such rendering takes place, authors can use a styling language such as CSS. For more details on how to use HTML, authors are encouraged to consult tutorials and guides. Some of the examples included in this specification might also be of use, but the novice author is cautioned that this specification, by necessity, defines the language with a level of detail that might be difficult to understand at first. A comprehensive study of this matter is beyond the scope of this document, and authors are strongly encouraged to study the matter in more detail. However, this section attempts to provide a quick introduction to some common pitfalls in HTML application development. The security model of the Web is based on the concept of "origins", and correspondingly many of the potential attacks on the Web involve cross-origin actions. When accepting untrusted input, e. Failing to do this can allow a 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 whitelist-based, allowing known-safe constructs and disallowing all other input. Blacklist-based 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 future. If the message was just displayed to the user without escaping, a hostile attacker could then craft a URL that contained a script element:. Such a script could do any number of hostile actions, limited only by what the site offers: There are many constructs that can be used to try to trick a site into executing code. Here are some that authors are encouraged to consider when writing whitelist filters:. Sites can prevent such attacks by populating forms with user-specific hidden tokens, or by checking Origin headers on all requests. A 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 activating the interface. 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 play a reaction game. To avoid this, sites that do not expect to be used in frames are encouraged to only enable their interface if they detect that they are not in a frame e. Scripts in HTML have "run-to-completion" semantics, meaning that the browser will generally run the script uninterrupted before doing anything else, such as firing further events or continuing to parse the document. On the other hand, parsing of HTML files happens asynchronously and incrementally, meaning that the parser can pause at any point to let scripts run. This is generally a good thing, but it does mean that authors need to be careful to avoid hooking event handlers after the events could have possibly fired. There are two techniques for doing this reliably: The latter is safe because, as mentioned earlier, scripts are run to completion before further events can fire. One way this could manifest itself is with img elements and the load event. The event could fire as soon as the element has been parsed, especially if the image has already been cached which is common. Here, the author uses the onload handler on an img element to catch the load event:. If the element is being added by script, then so long as the event handlers are added in the same script, the event will still not be missed:. Authors are encouraged to make use of conformance checkers also known as validators to catch common mistakes. The W3C provides a number of online validation services, including the Nu Markup Validation Service. Unlike previous versions of the HTML specification, this specification defines in some detail the required processing for invalid documents as well as valid documents. However, even though the processing of invalid content is in most cases well-defined, conformance requirements for documents are still important: This section details some of the more common reasons for still distinguishing between a conforming document and one with errors. The majority of presentational features from previous versions of HTML are no longer allowed. 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 technologies ATs with an acceptable experience e. 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. It is significantly easier to maintain a site written in such a way that the markup is style-independent. Presentational markup tends to be much more redundant, and thus results in larger document sizes. For those reasons, presentational markup has been removed from HTML in this version. This change should not come as a surprise; HTML4 deprecated presentational markup many years ago and provided a mode HTML4 Transitional to help authors move away from presentational markup; later, XHTML 1. The only remaining presentational markup features in HTML are the style attribute and the style element. Use of the style attribute is somewhat discouraged in production environments, but 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 would be inconvenient. Similarly, the style element can be useful in syndication or for page-specific styles, but in general an external style sheet is likely to be more convenient when the styles apply to multiple pages. It is also worth noting that some elements that were previously presentational have been redefined in this specification to be media-independent: Certain invalid syntax constructs, when parsed, result in DOM trees that are highly unintuitive. For example, the following markup fragment results in a DOM with an hr element that is an earlier sibling of the corresponding table element:. 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 encountering a parse error. To avoid interoperability problems with such user agents, any syntax resulting in such behavior is considered invalid. When a user agent based on XML is connected to an HTML parser, it is possible that certain invariants that XML enforces, such as comments never containing two consecutive hyphens, will be violated by an HTML file. Handling this can require that the parser coerce the HTML DOM into an XML-compatible infoset. Most syntax constructs that require such handling are considered invalid. Certain syntax constructs can result in disproportionally poor performance. To discourage the use of such constructs, they are typically made non-conforming. For example, the following markup results in poor performance, since all the unclosed i elements have to be reconstructed in each paragraph, resulting in progressively more elements in each paragraph:. There are syntax constructs that, for historical reasons, are relatively fragile. To help reduce the number of users who accidentally run into such problems, they are made non-conforming. For example, the parsing of certain named character references in attributes happens even with the closing semicolon being omitted. It is safe to include an ampersand followed by letters that do not form a named character reference, but if the letters are changed to a string that does form a named character reference, they will be interpreted as that character instead. To avoid this problem, all named character references are required to end with a semicolon, and uses of named character references without a semicolon are flagged as errors. 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. In certain legacy user agents, it is sometimes treated as a quote character. Another example of this is the DOCTYPE, which is required to trigger no-quirks mode , because the behavior of legacy user agents in quirks mode is often largely undocumented. For example, the restriction on using UTF-7 exists purely to avoid authors falling prey to a known cross-site-scripting attack using UTF Correcting these errors early makes later maintenance easier. For example, it is unclear whether the author intended the following to be an h1 heading or an h2 heading:. 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. This specification therefore usually considers it an error to use element names, attribute names, and so forth, that do not match the names defined in this specification. In order to allow the language syntax to be extended in the future, certain otherwise harmless features are disallowed. For example, "attributes" in end tags are ignored currently, but they are invalid, in case a future change to the language makes use of that syntax feature without conflicting with already-deployed and valid! Some authors find it helpful to be in the practice of always quoting all attributes and always including all optional tags, preferring the consistency derived from such custom over the minor benefits of terseness afforded by making use of the flexibility of the HTML syntax. To aid such authors, conformance checkers can provide modes of operation wherein such conventions are enforced. Beyond the syntax of the language, this specification also places restrictions on how elements and attributes can be specified. 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. For example, this specification disallows nesting a section element inside a kbd element, since it is highly unlikely for an author to indicate that an entire section should be keyed in. In the fragments below, for example, the semantics are nonsensical: Another example is the restrictions on the content models of the ul element, which only allows li element children. Certain elements have default styles or behaviors that make certain combinations likely to lead to confusion. Where these have equivalent alternatives without this problem, the confusing combinations are disallowed. For example, div elements are rendered as block boxes, and span elements as inline boxes. Putting a block box in an inline box is unnecessarily confusing; since either nesting just div 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. Another example would be the way interactive content cannot be nested. For example, a button element cannot contain a textarea element. This is because the default behavior of such nesting interactive elements would be highly confusing to users. Instead of nesting these elements, they can be placed side by side. For example, setting the disabled 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 value. There would be no benefit to allowing both, but it would 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 issues. Thus, the following markup results in two paragraphs , not one:. This is why, for instance, it is non-conforming to have two id attributes with the same value. Duplicate IDs lead to the wrong element being selected, with sometimes disastrous effects whose cause is hard to determine. Some constructs are disallowed because historically they have been the cause of a lot of wasted authoring time, and by encouraging authors to avoid making them, authors can save time in future efforts. To reduce this problem, this specification makes it non-conforming to have executable script in a script element when the src attribute is present. This means that authors who are validating their documents are less likely to waste time with this kind of mistake. Some authors like to write files that can be interpreted as both XML and HTML with similar results. Though this practice is discouraged in general due to the myriad of subtle 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 the difficulties. This makes it easier for authors to use this as a transitionary step when migrating between HTML and XHTML. For example, there are somewhat complicated rules surrounding the lang and xml: 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 XML. 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. For example, requiring that attributes that take media queries use only valid media queries reinforces the importance of following the conformance rules of that specification. Because Unicode contains such a large number of characters and incorporates the varied writing systems of the world, incorrect usage can expose programs or systems to possible security attacks. This is especially important as more and more products are internationalized. This document describes some of the security considerations that programmers, system analysts, standards developers, and users should take into account, and provides specific recommendations to reduce the risk of problems. Web Content Accessibility Guidelines WCAG 2. Following these guidelines will make content accessible to a wider range of people with disabilities, including blindness and low vision, deafness and hearing loss, learning disabilities, cognitive limitations, limited movement, speech disabilities, photosensitivity and combinations of these. Following these guidelines will also often make your Web content more usable to users in general. This specification provides guidelines for designing Web content authoring tools that are more accessible for people with disabilities. An authoring tool that conforms to these guidelines will promote accessibility by providing an accessible user interface to authors with disabilities as well as by enabling, supporting, and promoting the production of accessible Web content by all authors. This document provides guidelines for designing user agents that lower barriers to Web accessibility for people with disabilities. User agents include browsers and other types of software that retrieve and render Web content. A user agent that conforms to these guidelines will promote accessibility through its own user interface and through other internal facilities, including its ability to communicate with other technologies especially assistive technologies. Furthermore, all users, not just users with disabilities, should find conforming user agents to be more usable. A document that uses polyglot markup is a document that is a stream of bytes that parses into identical document trees with the exception of the xmlns attribute on the root element when processed as HTML and when processed as XML. Polyglot markup that meets a well defined set of constraints is interpreted as compatible, regardless of whether they are processed as HTML or as XHTML, per the HTML5 specification. Polyglot markup uses a specific DOCTYPE, namespace declarations, and a specific case — normally lower case but occasionally camel case — for element and attribute names. Polyglot markup uses lower case for certain attribute values. Further constraints include those on empty elements, named entity references, and the use of scripts and style. This is draft documentation mapping HTML elements and attributes to accessibility API Roles, States and Properties on a variety of platforms. It provides recommendations on deriving the accessible names and descriptions for HTML elements. It also provides accessible feature implementation examples. This specification refers to both HTML and XML attributes and IDL attributes, often in the same context. When it is not clear which is being referred to, they are referred to as content attributes for HTML and XML attributes, and IDL attributes for those defined on IDL interfaces. Similarly, the term "properties" is used for both JavaScript object properties and CSS properties. When these are ambiguous they are qualified as object properties and CSS properties respectively. Generally, when the specification states that a feature applies to the HTML syntax or the XHTML syntax , it also includes the other. When a feature specifically only applies to one of the two languages, it is called out by explicitly stating that it does not apply to the other format, as in "for HTML, This specification uses the term document to refer to any use of HTML, ranging from short static documents to long essays or reports with rich multimedia, as well as to fully-fledged interactive applications. The term is used to refer both to Document objects and their descendant DOM trees, and to serialized byte streams using the HTML syntax or XHTML syntax , depending on context. In the context of the DOM structures, the terms HTML document and XML document are used as defined in the DOM specification, and refer specifically to two different modes that Document objects can find themselves in. The term XHTML document is used to refer to both Document s in the XML document mode that contains element nodes in the HTML namespace , and byte streams labeled with an XML MIME type that contain elements from the HTML namespace , depending on context. For simplicity, terms such as shown , displayed , and visible might sometimes be used when referring to the way a document is rendered to the user. These terms are not meant to imply a visual medium; they must be considered to apply to other media in equivalent ways. When an algorithm B says to return to another algorithm A, it implies that A called B. Upon returning to A, the implementation must continue from where it left off in calling B. The term "transparent black" refers to the color with red, green, blue, and alpha channels all set to zero. The specification uses the term supported when referring to whether a user agent has an implementation capable of decoding the semantics of an external resource. A format or type is said to be supported if the implementation can process an external resource of that format or type without critical aspects of the resource being ignored. For example, a PNG image would be considered to be in a supported format if its pixel data could be decoded and rendered, even if, unbeknownst to the implementation, the image also contained animation data. What some specifications, in particular the HTTP specification, refer to as a representation is referred to in this specification as a resource. The term MIME type is used to refer to what is sometimes called an Internet media type in protocol literature. The term media type in this specification is used to refer to the type of media intended for presentation, as used by the CSS specifications. A string is a valid MIME type if it matches the media-type rule defined in section 3. In particular, a valid MIME type may include MIME type parameters. A string is a valid MIME type with no parameters if it matches the media-type rule defined in section 3. In other words, if it consists only of a type and subtype, with no MIME Type parameters. URL refers to URLs that use the data: To ease migration from HTML to XHTML, UAs conforming to this specification will place elements in HTML in the http: The term " HTML elements ", when used in this specification, refers to any element in that namespace, and thus refers to both HTML and XHTML elements. Except where otherwise stated, all elements defined or mentioned in this specification are in the HTML namespace " http: The term element type is used to refer to the set of elements that have a given local name and namespace. For example, button elements are elements with the element type button , meaning they have the local name " button " and implicitly as defined above the HTML namespace. Attribute names are said to be XML-compatible if they match the Name production defined in XML, they contain no ": If it does not have one then the Document has no root element. When it is stated that some element or attribute is ignored , or treated as some other value, or handled as if it was something else, this refers only to the processing of the node after it is in the DOM. A user agent must not mutate the DOM in such situations. A content attribute is said to change value only if its new value is different than its previous value; setting an attribute to a value it already has does not change it. The term empty , when used of an attribute value, Text node, or string, means that the length of the text is zero i. The construction "a Foo object", where Foo is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface Foo ". An IDL attribute is said to be getting when its value is being retrieved e. If a DOM object is said to be live , then the attributes and methods on that object must operate on the actual underlying data, not a snapshot of the data. In the contexts of events, the terms fire and dispatch are used as defined in the DOM specification: The term trusted event is used to refer to events whose isTrusted attribute is initialized to true. Typically such content handlers are provided by third parties, though a user agent can also designate built-in content handlers as plugins. One example of a plugin would be a PDF viewer that is instantiated in a browsing context when the user navigates to a PDF file. This would count as a plugin regardless of whether the party that implemented the PDF viewer component was the same as that which implemented the user agent itself. However, a PDF viewer application that launches separate from the user agent as opposed to using the same interface is not a plugin by this definition. This specification does not define a mechanism for interacting with plugins, as it is expected to be user-agent- and platform-specific. Some UAs might opt to support a plugin mechanism such as the Netscape Plugin API; others might use remote content converters or have built-in support for certain types. A plugin can be secured if it honors the semantics of the sandbox attribute. For example, a secured plugin would prevent its contents from creating pop-up windows when the plugin is instantiated inside a sandboxed iframe. Browsers should take extreme care when interacting with external content intended for plugins. When third-party software is run with the same privileges as the user agent itself, vulnerabilities in the third-party software become as dangerous as those in the user agent. Since different users having differents sets of plugins provides a fingerprinting vector that increases the chances of users being uniquely identified, user agents are encouraged to support the exact same set of plugins for each user. A character encoding , or just encoding where that is not ambiguous, is a defined way to convert between byte streams and Unicode strings, as defined in the Encoding standard. An ASCII-compatible character encoding is a single-byte or variable-length encoding in which the bytes 0x09, 0x0A, 0x0C, 0x0D, 0x20 - 0x22, 0x26, 0x27, 0x2C - 0x3F, 0x41 - 0x5A, and 0x61 - 0x7A , ignoring bytes that are the second and later bytes of multibyte sequences, all correspond to single-byte sequences that map to the same Unicode characters as those bytes in Windows It excludes UTF variants, as well as obsolete legacy encodings such as UTF-7, GSM The term a UTF encoding refers to any variant of UTF UTFLE or UTFBE, regardless of the presence or absence of a BOM. The term code unit is used as defined in the Web IDL specification: This is a narrower definition than the one used in Unicode, and is not the same as a code point. The term Unicode code point means a Unicode scalar value where possible, and an isolated surrogate code point when not. When a conformance requirement is defined in terms of characters or Unicode code points, a pair of code units consisting of a high surrogate followed by a low surrogate must be treated as the single code point represented by the surrogate pair, but isolated surrogates must each be treated as the single code point with the value of the surrogate. In this specification, the term character , when not qualified as Unicode character, is synonymous with the term Unicode code point. The term Unicode character is used to mean a Unicode scalar value i. The code-unit length of a string is the number of code units in that string. This complexity results from the historical decision to define the DOM API in terms of 16 bit UTF code units , rather than in terms of Unicode characters. All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative. The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC The key word "OPTIONALLY" in the normative parts of this document is to be interpreted with the same normative meaning as "MAY" and "OPTIONAL". For readability, these words do not appear in all uppercase letters in this specification. Requirements phrased in the imperative as part of algorithms such as "strip any leading space characters" or "return false and abort these steps" are to be interpreted with the meaning of the key word "must", "should", "may", etc used in introducing the algorithm. The former imperative style is generally preferred in this specification for stylistic reasons. Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. In particular, the algorithms defined in this specification are intended to be easy to follow, and not intended to be performant. This specification describes the conformance criteria for user agents relevant to implementors and documents relevant to authors and authoring tool implementors. Conforming documents are those that comply with all the conformance criteria for documents. For readability, some of these conformance requirements are phrased as conformance requirements on authors; such requirements are implicitly requirements on documents: In some cases, that author may itself be a user agent — such user agents are subject to additional rules, as explained below. For example, if a requirement states that "authors must not use the foobar element", it would imply that documents are not allowed to contain elements named foobar. There is no implied relationship between document conformance requirements and implementation conformance requirements. User agents are not free to handle non-conformant documents as they please; the processing model described in this specification applies to implementations regardless of the conformity of the input documents. User agents fall into several overlapping categories with different conformance requirements. Web browsers that support the XHTML syntax must process elements and attributes 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 overridden by other specifications. A conforming XHTML processor would, upon finding an XHTML script element in an XML document, execute the script contained in that element. However, if the element is found 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 part of the transform. Web browsers that support the HTML syntax must process documents labeled with an HTML MIME type as described in this specification, so that users can interact with them. Unless explicitly stated, specifications that override the semantics of HTML elements do not override the requirements on DOM objects representing those elements. For example, the script element in the example above would still implement the HTMLScriptElement interface. User agents that process HTML and XHTML documents purely to render non-interactive versions of them must comply to the same conformance criteria as Web browsers, except that they are exempt from requirements regarding user interaction. Typical examples of non-interactive presentation user agents are printers static UAs and overhead displays dynamic UAs. It is expected that most static non-interactive presentation user agents will also opt to lack scripting support. A non-interactive but dynamic presentation UA would still execute scripts, allowing forms to be dynamically submitted, and so forth. However, since the concept of "focus" is irrelevant when the user cannot interact with the document, the UA would not need to support any of the focus-related DOM APIs. User agents, whether interactive or not, may be designated possibly as a user option as supporting the suggested default rendering defined by this specification. This is not required. In particular, even user agents that do implement the suggested default rendering are encouraged to offer settings that override this default to improve the experience for the user, e. User agents that are designated as supporting the suggested default rendering must, while so designated, implement the rules in the rendering section that that section defines as the behavior that user agents are expected to implement. Implementations that do not support scripting or which have their scripting features disabled entirely are exempt from supporting the events and DOM interfaces mentioned in this specification. For the parts of this specification that are defined in terms of an events model or in terms of the DOM, such user agents must still act as if events and the DOM were supported. Scripting can form an integral part of an application. Conformance checkers must verify that a document conforms to the applicable conformance criteria described in this specification. This is only a "SHOULD" and not a "MUST" requirement because it has been proven to be impossible. The term "HTML validator" can be used to refer to a conformance checker that itself conforms to the applicable requirements of this specification. XML DTDs cannot express all the conformance requirements of this specification. Therefore, a validating XML processor and a DTD cannot constitute a conformance checker. Also, since neither of the two authoring formats defined in this specification are applications of SGML, a validating SGML system cannot constitute a conformance checker either. A conformance checker must check for the first two. A simple DTD-based validator only checks for the first class of errors and is therefore not a conforming conformance checker according to this specification. Applications and tools that process HTML and XHTML documents for reasons other than to either render the documents or check them for conformance should act in accordance with the semantics of the documents that they process. A tool that generates document outlines but increases the nesting level for each paragraph and does not increase the nesting level for each section would not be conforming. Authoring tools and markup generators must generate conforming documents. Conformance criteria that apply to authors also apply to authoring tools, where appropriate. Authoring tools are exempt from the strict requirements of using elements only for their specified purpose, but only to the extent that authoring tools are not yet able to determine author intent. However, authoring tools must not automatically misuse elements or encourage their users to do so. For example, it is not conforming to use an address element for arbitrary contact information; that element can only be used for marking up contact information for the author of the document or section. However, since an authoring tool is likely unable to determine the difference, an authoring tool is exempt from that requirement. In terms of conformance checking, an editor has to output documents that conform to the same extent that a conformance checker will verify. 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 i. However, an authoring tool must not claim that the output is conformant if errors have been so preserved. Authoring tools are expected to come in two broad varieties: The former is the preferred mechanism for tools that author HTML, since the structure in the source information can be used to make informed choices regarding which HTML elements and attributes are most appropriate. However, WYSIWYG tools are legitimate. WYSIWYG tools should use elements they know are appropriate, and should not use elements that they do not know to be appropriate. This might in 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 of the style attribute. All authoring tools, whether WYSIWYG or not, should make a best effort attempt at enabling users to create well-structured, semantically rich, media-independent content. User agents may impose implementation-specific limits on otherwise unconstrained inputs, e. For compatibility with existing content and prior specifications, this specification describes two authoring formats: Implementations must support at least one of these two formats, although supporting both is encouraged. Some conformance requirements are phrased as requirements on elements, attributes, methods or objects. Such requirements fall into two categories: Those in the former category are requirements on documents and authoring tools. Those in the second category are requirements on user agents. Similarly, some conformance requirements are phrased as requirements on authors; such requirements are to be interpreted as conformance requirements on the documents that authors produce. In other words, this specification does not distinguish between conformance criteria on authors and conformance criteria on documents. The Unicode character set is used to represent textual data, and the Encoding standard defines requirements around character encodings. This specification introduces terminology based on the terms defined in those specifications, as described earlier. The following terms are used as defined in the Encoding specification: The UTF-8 decoder is distinct from the UTF-8 decode algorithm. The latter first strips a Byte Order Mark BOM , if any, and then invokes the former. The decoder algorithm may produce an error, referred to in this specification as a decoder error. For readability, character encodings are sometimes referenced in this specification with a case that differs from the canonical case given in the encoding standard. For example, "UTFLE" instead of "utfle". Implementations that support the XHTML syntax must support some version of XML, as well as its corresponding namespaces specification, because that syntax uses an XML serialization with namespaces. The following terms are defined in the Cookie specification: The IDL blocks in this specification are conforming IDL fragments as defined by the WebIDL specification. The terms supported property indices , determine the value of an indexed property , support named properties , supported property names , determine the value of a named property , platform array objects , and read only when applied to arrays are used as defined in the Web IDL specification. The algorithm to convert a DOMString to a sequence of Unicode characters is similarly that defined in the Web IDL specification. When this specification requires a user agent to create a Date object representing a particular time which could be the special value Not-a-Number , the milliseconds component of that time, if any, must be truncated to an integer, and the time value of the newly created Date object must represent the resulting truncated time. For instance, given the time millionths of a second after If the given time is NaN, then the result is a Date object that represents a time value NaN indicating that the object does not represent a specific instant of time. Some parts of the language described by this specification only support JavaScript as the underlying scripting language. The term "JavaScript" is used to refer to ECMA, rather than the official term ECMAScript, since the term JavaScript is more widely known. The term JavaScript global environment refers to the global environment concept defined in the ECMAScript specification. The ECMAScript SyntaxError exception is also defined in the ECMAScript specification. The Document Object Model DOM is a representation — a model — of a document and its content. The DOM is not just an API; the conformance criteria of HTML implementations are defined, in this specification, in terms of operations on the DOM. Implementations must support DOM and the events defined in DOM Events, because this specification is defined in terms of the DOM, and some of the features are defined as extensions to the DOM interfaces. In particular, the following features are defined in the DOM specification: The term throw in this specification is used as defined in the DOM specification. The following DOMException types are defined in the DOM specification: For example, to throw a TimeoutError exception , a user agent would construct a DOMException object whose type was the string " TimeoutError " and whose code was the number 23, for legacy reasons and actually throw that object as an exception. The following features are defined in the DOM Events specification: The terms "name" and "type" for events are synonymous. The following features are defined in the DOM Parsing and Serialization specification: User agents are also encouraged to implement the features described in the HTML Editing APIs and UndoManager and DOM Transaction specifications. The following parts of the Fullscreen specification are referenced from this specification to define how the Fullscreen API interacts with the sandboxing features in HTML: The ArrayBuffer and ArrayBufferView interfaces and underlying concepts from the Typed Array Specification are used for several features in this specification. This specification uses the following features defined in the File API specification: This specification references the XMLHttpRequest specification in some non-normative notes and examples. The following features and terms are defined in the XMLHttpRequest specification: This specification references the Progress Events specification to describe how the two specifications interact and to use its ProgressEvent features. The following features and terms are defined in the Progress Events specification: The following terms are defined in Server-Sent Events: While support for CSS as a whole is not required of implementations of this specification though it is encouraged, at least for Web browsers , some features are defined in terms of specific CSS requirements. When parsing a CSS value, user agents are required by the CSS specifications to apply some error handling rules. These apply to this specification also. For example, user agents are required to close all open constructs upon finding the end of a style sheet unexpectedly. However, the similar construct " rgb 0,0, " with both a missing parenthesis and a missing "blue" value cannot be parsed, as closing the open construct does not result in a viable value. The term default object size is also defined in the CSS Image Values and Replaced Content specification. Support for the CSS Object Model is required for implementations that support scripting. The following features and terms are defined in the CSSOM specifications: The term CSS styling attribute is defined in the CSS Style Attributes specification. Implementations may support WebVTT as a text track format for subtitles, captions, chapter titles, metadata, etc, for media resources. The following terms are defined in the WebSocket protocol specification: The terms strong native semantics is used as defined in the ARIA specification. The term default implicit ARIA semantics has the same meaning as the term implicit WAI-ARIA semantics as used in the ARIA specification. This specification does not require support of any particular network protocol, style sheet language, scripting language, or any of the DOM specifications beyond those required in the list above. However, the language described by this specification is biased towards CSS as the styling language, JavaScript as the scripting language, and HTTP as the network protocol, and several features assume that those languages and protocols are in use. A user agent that implements the HTTP protocol must implement the Web Origin Concept specification and the HTTP State Management Mechanism specification Cookies as well. This specification might have certain additional requirements on character encodings, image formats, audio formats, and video formats in the respective sections. Vendor-specific proprietary user agent extensions to this specification are strongly discouraged. Documents must not use such extensions, as doing so reduces interoperability and fragments the user base, allowing only users of specific user agents to access the content in question. If such extensions are nonetheless needed, e. For markup-level features that can be limited to the XML serialization and need not be supported in the HTML serialization, vendors should use the namespace mechanism to define custom namespaces in which the non-standard elements and attributes are supported. For markup-level features that are intended for use with the HTML syntax , extensions should be limited to new attributes of the form " x- vendor - feature ", where vendor is a short string that identifies the vendor responsible for the extension, and feature is the name of the feature. New element names should not be created. Using attributes for such extensions exclusively allows extensions from multiple vendors to co-exist on the same element, which would not be possible with elements. Using the " x- vendor - feature " form allows extensions to be made without risk of conflicting with future additions to the specification. For instance, a browser named "FerretBrowser" could use "ferret" as a vendor prefix, while a browser named "Mellblom Browser" could use "mb". If both of these browsers invented extensions that turned elements into scratch-and-sniff areas, an author experimenting with these features could write:. Attribute names beginning with the two characters " x- " are reserved for user agent use and are guaranteed to never be formally added to the HTML language. For DOM extensions, e. For example, if a user agent called "Pleas old" were to add an event to indicate when the user is going up in an elevator, it could use the prefix " pleasold " and thus name the event " pleasoldgoingup ", possibly with an event handler attribute named " onpleasoldgoingup ". All extensions must be defined so that the use of extensions neither contradicts nor causes the non-conformance of functionality defined in the specification. When adding new reflecting IDL attributes corresponding to content attributes of the form " x- vendor - feature ", the IDL attribute should be named " vendor Feature " i. When vendor-neutral extensions to this specification are needed, either this specification can be updated accordingly, or an extension specification can be written that overrides the requirements in this specification. When someone applying this specification to their activities decides that they will recognize the requirements of such an extension specification, it becomes an applicable specification. The conformance terminology for documents depends on the nature of the changes introduced by such applicable specifications, and on the content and intended interpretation of the document. Applicable specifications MAY define new document content e. Whether a document is or is not a conforming HTML5 document does not depend on the use of applicable specifications: If the semantics or processing of a given otherwise conforming document is changed by use of applicable specification s , then it is not a conforming HTML5 document. For such cases, the applicable specifications SHOULD define conformance terminology. As a suggested but not required convention, such specifications might define conformance terminology such as: User agents must treat elements and attributes that they do not understand as semantically neutral; leaving them in the DOM for DOM processors , and styling them according to CSS for CSS processors , but not inferring any meaning from them. When support for a feature is disabled e. For example, if a particular feature is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted from the objects that implement that interface — leaving the attribute on the object but making it return null or throw an exception is insufficient. Implementations of XPath 1. A QName in the node test is expanded into an expanded-name using the namespace declarations from the expression context. This is the same way expansion is done for element type names in start and end-tags except that the default namespace declared with xmlns is not used: It is an error if the QName has a prefix for which there is no namespace declaration in the expression context. If the QName has a prefix, then there must be a namespace declaration for this prefix in the expression context, and the corresponding namespace URI is the one that is associated with this prefix. If the QName has no prefix and the principal node type of the axis is element, then the default element namespace is used. Otherwise if the QName has no prefix, the namespace URI is null. The default element namespace is a member of the context for the XPath expression. 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. 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. This change is a willful violation of the XPath 1. This requirement is a willful violation of the XSLT 1. Processors that serialize the output are unaffected. 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 elements into a stack of open elements. However, XSLT processors must stop parsing if they successfully complete, and must set the current document readiness first to " interactive " and then to " complete " if they are aborted. This specification does not specify how XSLT interacts with the navigation algorithm, how it fits in with the event loop , nor how error pages are to be handled e. There are also additional non-normative comments regarding the interaction of XSLT and HTML in the script element section , and of XSLT, XPath, and HTML in the template element section. Comparing two strings in a case-sensitive manner means comparing them exactly, code point for code point. LATIN SMALL LETTER A to LATIN SMALL LETTER Z are considered to also match. Comparing two strings in a compatibility caseless manner means using the Unicode compatibility caseless match operation to compare the two strings, with no language-specific tailoirings. Except where otherwise stated, string comparisons must be performed in a case-sensitive manner. LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z. LATIN SMALL LETTER A to LATIN SMALL LETTER Z. 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 parse them. Implementors are strongly urged to carefully examine any third-party libraries they might consider using to implement the parsing of syntaxes described below. For example, date libraries are likely to implement error handling behavior that differs from what is required in this specification, since error-handling behavior is often not defined in specifications that describe date syntaxes similar to those used in this specification, and thus implementations tend to vary greatly in how they handle errors. The uppercase ASCII letters are the characters in the range uppercase ASCII letters. The lowercase ASCII letters are the characters in the range lowercase ASCII letters. The ASCII digits are the characters in the range ASCII digits. The alphanumeric ASCII characters are those that are either uppercase ASCII letters , lowercase ASCII letters , or ASCII digits. Some of the micro-parsers described below follow the pattern of having an input variable that holds the string being parsed, and having a position variable pointing at the next character to parse in input. For parsers based on this pattern, a step that requires the user agent to collect a sequence of characters means that the following algorithm must be run, with characters being the set of characters that can be collected:. Let input and position be the same variables as those of the same name in the algorithm that invoked these steps. The step skip whitespace means that the user agent must collect a sequence of characters that are space characters. The collected characters are not used. When a user agent is to strip leading and trailing whitespace from a string, the user agent must remove all space characters that are at the start or end of the string. When a user agent has to strictly split a string on a particular delimiter character delimiter , it must use the following algorithm:. Let position be a pointer into input , initially pointing at the start of the string. While position is not past the end of input:. Collect a sequence of characters that are not the delimiter character. Advance position to the next character in input. For the special cases of splitting a string on spaces and on commas , this algorithm does not apply those algorithms also perform whitespace trimming. A number of attributes are boolean attributes. The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether. Here is an example of a checkbox that is checked and disabled. The checked and disabled attributes are the boolean attributes. Some attributes are defined as taking one of a finite set of keywords. Such attributes are called enumerated attributes. The keywords are each defined to map to a particular state several keywords might map to the same state, in which case some of the keywords are synonyms of each other; additionally, some of the keywords can be said to be non-conforming, and are only in the specification for historical reasons. In addition, two default states can be given. The first is the invalid value default , the second is the missing value default. If the attribute value matches none of the given keywords, but the attribute has an invalid value default , then the attribute represents that state. Otherwise, if the attribute value matches none of the keywords but there is a missing value default state defined, then that is the state represented by the attribute. Otherwise, there is no default, and invalid values mean that there is no state represented. When the attribute is not specified, if there is a missing value default state defined, then that is the state represented by the missing attribute. Otherwise, the absence of the attribute means that there is no state represented. The rules for parsing integers are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either an integer or an error. If position is past the end of input , return an error. If the character indicated by position is not an ASCII digit , then return an error. Collect a sequence of characters that are ASCII digits , and interpret the resulting sequence as a base-ten integer. Let value be that integer. If sign is "positive", return value , otherwise return the result of subtracting value from zero. A string is a valid non-negative integer if it consists of one or more ASCII digits. A valid non-negative integer represents the number that is represented in base ten by that string of digits. The rules for parsing non-negative integers are as given in the following algorithm. This algorithm will return either zero, a positive integer, or an error. Let value be the result of parsing input using the rules for parsing integers. A string is a valid floating-point number if it consists of:. If there is no E, then the exponent is treated as zero. The Infinity and Not-a-Number NaN values are not valid floating-point numbers. The best representation of the number n as a floating-point number is the string obtained from applying the JavaScript operator ToString to n. The JavaScript operator ToString is not uniquely determined. When there are multiple possible strings that could be obtained from the JavaScript operator ToString for a particular value, the user agent must always return the same string for that value though it may differ from the value used by other user agents. The rules for parsing floating-point number values are as given in the following algorithm. This algorithm must be aborted at the first step that returns something. This algorithm will return either a number or an error. If the character indicated by position is a ". Multiply value by that integer. If position is past the end of input , then jump to the step labeled conversion. If the character indicated by position is an ASCII digit , jump back to the step labeled fraction loop in these substeps. If the character indicated by position is not an ASCII digit , then jump to the step labeled conversion. Multiply exponent by that integer. Multiply value by ten raised to the exponent th power. Let rounded-value be the number in S that is closest to value , selecting the number with an even significand if there are two equally close values. The rules for parsing dimension values are as given in the following algorithm. This algorithm will return either a number greater than or equal to 1. Let value be that number. If position is past the end of input , return value as a length. If position is past the end of input , or if the character indicated by position is not an ASCII digit , then return value as a length. If position is past the end of input , then return value as a length. If the character indicated by position is an ASCII digit , return to the step labeled fraction loop in these substeps. In addition, there might be restrictions on the number of integers that can be given, or on the range of values allowed. The rules for parsing a list of integers are as follows:. Let numbers be an initially empty list of integers. This list will be the result of this algorithm. If position points to beyond the end of input , return numbers and abort. Let started be false. Let got number be false. This variable is set to true when the parser sees a number. Let finished be false. This variable is set to true to switch parser into a mode where it ignores characters until the next separator. If the character in the string input at position position is:. Advance position to the next character in input , or to beyond the end of the string if there are no more characters. If position points to a character and not to beyond the end of input , jump to the big Parser step above. If negated is true, then negate value. If got number is true, then append value to the numbers list. The rules for parsing a list of dimensions are as follows. These rules return a list of zero or more pairs consisting of a number and a unit, the unit being one of percentage , relative , and absolute. Split the string raw input on commas. Let raw tokens be the resulting list of tokens. If position is past the end of input , set unit to relative and jump to the last substep. If the character at position is an ASCII digit , collect a sequence of characters that are ASCII digits , interpret the resulting sequence as an integer in base ten, and increment value by that integer. If the character at position is a ". Collect a sequence of characters consisting of space characters and ASCII digits. Let s be the resulting sequence. Remove all space characters in s. Let length be the number of characters in s after the spaces were removed. Let fraction be the result of interpreting s as a base-ten integer, and then dividing that number by 10 length. Add an entry to result consisting of the number given by value and the unit given by unit. In the algorithms below, the number of days in month month of year year is: This takes into account leap years in the Gregorian calendar. When ASCII digits are used in the date and time syntaxes defined in this section, they express numbers in base ten. While the formats described here are intended to be subsets of the corresponding ISO formats, this specification defines parsing rules in much more detail than ISO Implementors are therefore encouraged to carefully examine any date parsing libraries before using them to implement the parsing rules described below; ISO libraries might not parse dates and times in exactly the same manner. Where this specification refers to the proleptic Gregorian calendar , it means the modern Gregorian calendar, extrapolated backwards to year 1. A date in the proleptic Gregorian calendar , sometimes explicitly referred to as a proleptic-Gregorian date , is one that is described using that calendar even if that calendar was not in use at the time or place in question. The use of the Gregorian calendar as the wire format in this specification is an arbitrary choice resulting from the cultural biases of those involved in the decision. See also the section discussing date, time, and number formats in forms for authors , implemention notes regarding localization of form controls , and the time element. A month consists of a specific proleptic-Gregorian date with no time-zone information and no date information beyond a year and a month. A 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. This will return either a year and month, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing. Parse a month component to obtain year and month. If this returns nothing, then fail. If position is not beyond the end of input , then fail. The rules to parse a month component , given an input string and a position , are as follows. This will return either a year and a month, or nothing. Collect a sequence of characters that are ASCII digits. If the collected sequence is not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the year. Otherwise, move position forwards one character. If the collected sequence is not exactly two characters long, then fail. Let that number be the month. A date consists of a specific proleptic-Gregorian date with no time-zone information, consisting of a year, a month, and a day. A string is a valid date string representing a year year , month month , and day day if it consists of the following components in the given order:. The rules to parse a date string are as follows. This will return either a date, or nothing. Parse a date component to obtain year , month , and day. Let date be the date with year year , month month , and day day. The rules to parse a date component , given an input string and a position , are as follows. This will return either a year, a month, and a day, or nothing. Let maxday be the number of days in month month of year year. Let that number be the day. Return year , month , and day. A yearless date consists of a Gregorian month and a day within that month, but with no associated year. A string is a valid yearless date string representing a month month and a day day if it consists of the following components in the given order:. In other words, if the month is " 02 ", meaning February, then the day can be 29, as if the year was a leap year. The rules to parse a yearless date string are as follows. This will return either a month and a day, or nothing. Parse a yearless date component to obtain month and day. The rules to parse a yearless date component , given an input string and a position , are as follows. If the collected sequence is not exactly zero or two characters long, then fail. Let maxday be the number of days in month month of any arbitrary leap year e. A time consists of a specific time with no time-zone information, consisting of an hour, a minute, a second, and a fraction of a second. A string is a valid time string representing an hour hour , a minute minute , and a second second if it consists of the following components in the given order:. The second component cannot be 60 or 61; leap seconds cannot be represented. The rules to parse a time string are as follows. This will return either a time, or nothing. Parse a time component to obtain hour , minute , and second. Let time be the time with hour hour , minute minute , and second second. The rules to parse a time component , given an input string and a position , are as follows. This will return either an hour, a minute, and a second, or nothing. Let that number be the hour. Let that number be the minute. If position is beyond the end of input , or at the last character in input , or if the next two characters in input starting at position are not both ASCII digits , then fail. Otherwise, let the collected string be second instead of its previous value. Interpret second as a base-ten number possibly with a fractional part. Let second be that number instead of the string version. Return hour , minute , and second. A floating date and time consists of a specific proleptic-Gregorian date , consisting of a year, a month, and a day, and a time, consisting of an hour, a minute, a second, and a fraction of a second, but expressed without a time zone. A string is a valid floating date and time string representing a date and time if it consists of the following components in the given order:. A string is a valid normalized floating 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 floating date and time string are as follows. This will return either a date and time, or nothing. A time-zone offset consists of a signed number of hours and minutes. A 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 In practice, however, right now the range of offsets of actual time zones is There is no guarantee that this will remain so forever, however; time zones are changed by countries at will and do not follow a standard. See also the usage notes and examples in the global date and time section below for details on using time-zone offsets with historical times that predate the formation of formal time zones. The rules to parse a time-zone offset string are as follows. This will return either a time-zone offset, or nothing. Parse a time-zone offset component to obtain timezone hours and timezone minutes. Return the time-zone offset that is timezone hours hours and timezone minutes minutes from UTC. The rules to parse a time-zone offset component , given an input string and a position , are as follows. This will return either time-zone hours and time-zone minutes, or nothing. Let s be the collected sequence. Interpret s as a base-ten integer. Let that number be the timezone hours. Let that number be the timezone minutes. Interpret the first two characters of s as a base-ten integer. Interpret the last two characters of s as a base-ten integer. Return timezone hours and timezone minutes. A global date and time consists of a specific proleptic-Gregorian date , consisting of a year, a month, and a day, and a time, consisting of an hour, a minute, a second, and a fraction of a second, expressed with a time-zone offset, consisting of a signed number of hours and minutes. A 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:. Time before the formation of time zones must be expressed and interpeted 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, London. The following are some examples of dates written as valid global date and time strings. The zone offset is not a complete time zone specification. When working with real date and time values, consider using a separate field for time zone, perhaps using IANA time zone IDs. A string is a valid normalized forced-UTC 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:. The rules to parse a global date and time string are as follows. This will return either a time in UTC, with associated time-zone offset information for round-tripping or display purposes, or nothing. If position is beyond the end of input , then fail. Let time be the moment in time at year year , month month , day day , hours hour , minute minute , second second , subtracting timezone hours hours and timezone minutes minutes. That moment in time is a moment in the UTC time zone. Let timezone be timezone hours hours and timezone minutes minutes from UTC. A week consists of a week-year number and a week number representing a seven-day period starting on a Monday. Each week-year in this calendaring system has either 52 or 53 such seven-day periods, as defined below. The seven-day period starting on the Gregorian date Monday December 29th is defined as week number 1 in week-year Consecutive weeks are numbered sequentially. The week before the number 1 week in a week-year is the last week in the previous week-year, and vice versa. A week-year with a number year has 53 weeks if it corresponds to either a year year in the proleptic Gregorian calendar that has a Thursday as its first day January 1st , or a year year in the proleptic Gregorian calendar that has a Wednesday as its first day January 1st and where year is a number divisible by , or a number divisible by 4 but not by All other week-years have 52 weeks. The week number of the last day of a week-year with 53 weeks is 53; the week number of the last day of a week-year with 52 weeks is The week-year number of a particular day can be different than the number of the year that contains that day in the proleptic Gregorian calendar. The first week in a week-year y is the week that contains the first Thursday of the Gregorian year y. For modern purposes, a week as defined here is equivalent to ISO weeks as defined in ISO A string is a valid week string representing a week-year year and week week if it consists of the following components in the given order:. The rules to parse a week string are as follows. This will return either a week-year number and week number, or nothing. Let that number be the week. Let maxweek be the week number of the last day of year year. Return the week-year number year and the week number week. A duration consists of a number of seconds. Since months and seconds are not comparable a month is not a precise number of seconds, but is instead a period whose exact length depends on the precise day from which it is measured a duration as defined in this specification cannot include months or years, which are equivalent to twelve months. Only durations that describe a specific number of seconds can be described. A string is a valid duration string representing a duration t if it consists of either of the following:. This, as with a number of other date- and time-related microsyntaxes defined in this specification, is based on one of the formats defined in ISO One or more duration time components , each with a different duration time component scale , in any order; the sum of the represented seconds being equal to the number of seconds in t. A duration time component is a string consisting of the following components:. One or more ASCII digits , representing a number of time units, scaled by the duration time component scale specified see below to represent a number of seconds. If the duration time component scale specified is 1 i. One of the following characters, representing the duration time component scale of the time unit used in the numeric part of the duration time component:. Zero or more space characters. This is not based on any of the formats in ISO It is intended to be a more human-readable alternative to the ISO duration format. The rules to parse a duration string are as follows. This will return either a duration or nothing. Let months , seconds , and component count all be zero. It is used to disambiguate the "M" unit in ISO durations, which use the same unit for months and minutes. Months are not allowed, but are parsed for future compatibility and to avoid misinterpreting ISO durations that would be valid in other contexts. If position is past the end of input , then fail. Run the following substeps in a loop, until a step requiring the loop to be broken or the entire algorithm to fail is reached:. Let units be undefined. It will be assigned one of the following values: Let next character be undefined. It is used to process characters from the input. If position is past the end of input , then break the loop. Set next character to the character in input pointed to by position. If next character is a ". Do not advance position. That is taken care of below. Otherwise, if next character is an ASCII digit , then collect a sequence of characters that are ASCII digits , interpret the resulting sequence as a base-ten integer, and let N be that number. Set next character to the character in input pointed to by position , and this time advance position to the next character. Let length be the number of characters in s. Set next character to the character in input pointed to by position , and advance position to the next character. If next character is a space character , then skip whitespace , set next character to the character in input pointed to by position , and advance position to the next character. Otherwise if next character is none of the above characters, then fail. If units is years , multiply multiplier by 12 and set units to months. If units is months , add the product of N and multiplier to months. If units is weeks , multiply multiplier by 7 and set units to days. If units is days , multiply multiplier by 24 and set units to hours. If units is hours , multiply multiplier by 60 and set units to minutes. If units is minutes , multiply multiplier by 60 and set units to seconds. Forcibly, units is now seconds. Add the product of N and multiplier to seconds. Return the duration consisting of seconds seconds. A string is a valid date string with optional time if it is also one of the following:. The rules to parse a date or time string are as follows. The algorithm will return either a date , a time , a global date and time , or nothing. Set start position to the same position as position. Set the date present and time present flags to true. If this fails, then set the date present flag to false. Otherwise, if date present is false, set position back to the same position as start position. If the time present flag is true, then parse a time component to obtain hour , minute , and second. If the date present and time present flags are both true, but position is beyond the end of input , then fail. If the date present and time present flags are both true, parse a time-zone offset component to obtain timezone hours and timezone minutes. If the date present flag is true and the time present flag is false, then let date be the date with year year , month month , and day day , and return date. Otherwise, if the time present flag is true and the date present flag is false, then let time be the time with hour hour , minute minute , and second second , and return time. Otherwise, let time be the moment in time at year year , month month , day day , hours hour , minute minute , second second , subtracting timezone hours hours and timezone minutes minutes, that moment in time being a moment in the UTC time zone; let timezone be timezone hours hours and timezone minutes minutes from UTC; and return time and timezone. A simple color consists of three 8-bit numbers in the range The rules for parsing simple color values are as given in the following algorithm. This algorithm will return either a simple color or an error. If input is not exactly seven characters long, then return an error. If the last six characters of input are not all ASCII hex digits , then return an error. Interpret the second and third characters as a hexadecimal number and let the result be the red component of result. Interpret the fourth and fifth characters as a hexadecimal number and let the result be the green component of result. Interpret the sixth and seventh characters as a hexadecimal number and let the result be the blue component of result. The rules for serializing simple color values given a simple color are as given in the following algorithm:. Convert the red, green, and blue components in turn to two-digit hexadecimal numbers using lowercase ASCII hex digits , zero-padding if necessary, and append these numbers to result , in the order red, green, blue. Return result , which will be a valid lowercase simple color. Some obsolete legacy attributes parse colors in a more complicated manner, using the rules for parsing a legacy color value , which are given in the following algorithm. Strip leading and trailing whitespace from input. If input is an ASCII case-insensitive match for the string " transparent ", then return an error. CSS2 System Colors are not recognised. Interpret the second character of input as a hexadecimal digit; let the red component of result be the resulting number multiplied by Interpret the third character of input as a hexadecimal digit; let the green component of result be the resulting number multiplied by Interpret the fourth character of input as a hexadecimal digit; let the blue component of result be the resulting number multiplied by If input is longer than characters, truncate input , leaving only the first characters. Split input into three strings of equal length, to obtain three components. Let length be the length of those components one third the length of input. If length is greater than 8, then remove the leading length -8 characters in each component, and let length be 8. If length is still greater than two, truncate each component, leaving only the first two characters in each. Interpret the first component as a hexadecimal number; let the red component of result be the resulting number. Interpret the second component as a hexadecimal number; let the green component of result be the resulting number. Interpret the third component as a hexadecimal number; let the blue component of result be the resulting number. A set of space-separated tokens is a string containing zero or more words known as tokens separated by one or more space characters , where words consist of any string of one or more characters, none of which are space characters. A string containing a set of space-separated tokens may have leading or trailing space characters. An unordered set of unique space-separated tokens is a set of space-separated tokens where none of the tokens are duplicated. An ordered set of unique space-separated tokens is a set of space-separated tokens where none of the tokens are duplicated but where the order of the tokens is meaningful. Sets of space-separated tokens sometimes have a defined set of allowed values. When a set of allowed values is defined, the tokens must all be from that list of allowed values; other values are non-conforming. If no such set of allowed values is provided, then all values are conforming. How tokens in a set of space-separated tokens are to be compared e. When a user agent has to split a string on spaces , it must use the following algorithm:. Collect a sequence of characters that are not space characters. Sets of comma-separated tokens sometimes have further restrictions on what consists a valid token. When such restrictions are defined, the tokens must all fit within those restrictions; other values are non-conforming. If no such restrictions are specified, then all values are conforming. When a user agent has to split a string on commas , it must use the following algorithm:. If position is past the end of input , jump to the last step. Let s be the resulting sequence which might be the empty string. Strip leading and trailing whitespace from s. The rules for parsing a hash-name reference to an element of type type are as follows:. Return the first element of type type that has an id attribute whose value is a case-sensitive match for s or a name attribute whose value is a compatibility caseless match for s. A URL is a valid URL if it conforms to the authoring conformance requirements in the URL standard. A string is a valid non-empty URL if it is a valid URL but it is not the empty string. A string is a valid URL potentially surrounded by spaces if, after stripping leading and trailing whitespace from it, it is a valid URL. A string is a valid non-empty URL potentially surrounded by spaces if, after stripping leading and trailing whitespace from it, it is a valid non-empty URL. This specification defines the URL about: URL, for use in DOCTYPE s in HTML documents when needed for compatibility with XML tools. The fallback base URL of a Document object is the absolute URL obtained by running these substeps:. The document base URL of a Document object is the absolute URL obtained by running these substeps:. Otherwise, the document base URL is the frozen base URL of the first base element in the Document that has an href attribute, in tree order. Resolving a URL is the process of taking a relative URL and obtaining the absolute URL that it implies. To resolve a URL to an absolute URL relative to either another absolute URL or an element, the user agent must use the following steps. Resolving a URL can result in an error, in which case the URL is not resolvable. If encoding is a UTF encoding , then change the value of encoding to UTF If the algorithm was invoked with an absolute URL to use as the base URL, let base be that absolute URL. Apply the URL parser to url , with base as the base URL, with encoding as the encoding. Let parsed URL be the result of the URL parser. Let serialized URL be the result of apply the URL serializer to parsed URL. Return serialized URL as the resulting absolute URL and parsed URL as the resulting parsed URL. For the purposes of the XML Base specification, user agents must act as if all Document objects represented XML documents. It is possible for xml: Such scripts would not be conforming, however, as xml: The following are base URL change steps , which run when an element is affected by a base URL change as defined by the DOM specification:. If the absolute 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 re-resolved relative to the element and the UI updated appropriately. For example, the CSS: If the absolute URL identified by the cite attribute is being shown to the user, or if any data derived from that URL is affecting the display, then the URL should be re-resolved relative to the element and the UI updated appropriately. User agents can implement a variety of transfer protocols, but this specification mostly defines behavior in terms of HTTP. The HTTP GET method is equivalent to the default retrieval action of the protocol. For example, RETR in FTP. Such actions are idempotent and safe, in HTTP terms. The HTTP response codes are equivalent to statuses in other protocols that have the same basic meanings. For example, a "file not found" error is equivalent to a code, a server error is equivalent to a 5xx code, and so on. The HTTP headers are equivalent to fields in other protocols that have the same basic meaning. For example, the HTTP authentication headers are equivalent to the authentication aspects of the FTP protocol. A referrer source is either a Document or a URL. When a user agent is to fetch a resource or URL , optionally from an origin origin , optionally using a specific referrer source as an override referrer source , and optionally with any of a synchronous flag , a manual redirect flag , a force same-origin flag , and a block cookies flag , the following steps must be run. When a URL is to be fetched, the URL identifies a resource to be obtained. If there is a specific override referrer source , and it is a URL , then let referrer be the override referrer source , and jump to the step labeled clean referrer. Let document be the appropriate Document as given by the following list:. Apply the URL parser to referrer and let parsed referrer be the resulting parsed URL. Let referrer be the result of applying the URL serializer to parsed referrer , with the exclude fragment flag set. If referrer is not the empty string, is not a data: URL , and is not the URL " about: Otherwise, the Referer sic header must be omitted, regardless of its value. If the algorithm was not invoked with the synchronous flag , perform the remaining steps asynchronously. Optionally, wait until the Document with which any tasks queued by this algorithm would be associated is active. If the resource is to be obtained from an application cache , then use the data from that application cache , as if it had been obtained in the manner appropriate given its URL. If the resource is identified by an absolute URL , and the resource is to be obtained using an idempotent action such as an HTTP GET or equivalent , and it is already being downloaded for other reasons e.


Как установить мелодию звонка на телефоне асус
Расписание погоды в городецке пинежский район
Карта брагинского района гомельской области
Торт из печени пошагово рецепт
Размер фотона загранпаспорт старого образца
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment