### selectionStart Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html Gets or sets the offset to the start of the selection. ```APIDOC ## selectionStart ### Description Returns the offset to the start of the selection. Can be set to change the start of the selection. ### Property selectionStart ### Syntax element.selectionStart ### Parameters - value (number) - Optional - The new offset for the start of the selection. ### Returns - offset (number) - The current offset to the start of the selection. ### Example ```js let start = input.selectionStart; input.selectionStart = 0; ``` ``` -------------------------------- ### GET form submission example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html A simple form using the GET method. When submitted, the user agent loads the action URL with query parameters appended, e.g., /find?t=cats&q=fur. ```html
``` -------------------------------- ### HTML nav element example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sections.html Example of a nav element with a list of links. ```html ``` -------------------------------- ### HTML with required tags due to attributes Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/syntax.html The same example but with attributes on the html and body elements, requiring those start tags to be present. ```html Hello

Welcome to this example. ``` -------------------------------- ### Image map example with home link Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/semantics-embedded-content.html An image map example showing a link to the home page. ```html Home ``` -------------------------------- ### HTML document after omitting start tag Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/syntax.html The same document as the previous example but with the start tag removed. The DOM is identical to the original. ```html Hello

Welcome to this example.

``` -------------------------------- ### Numeric input control example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html Example of using a numeric input control with a label, minimum value, and step. ```html ``` -------------------------------- ### Rendering of multiple annotations example in non-ruby user agents Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/textlevel-semantics.html Shows the expected rendering of the previous multiple-annotations example in non-ruby-capable user agents. ```text ♥: Heart, Cœur. ☘: Shamrock, Trèfle. ✶: Star, Étoile. ``` -------------------------------- ### URL input with datalist example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html Markup example showing an input element with type="url" and a datalist providing suggested URLs. The user agent may use the datalist and session history to offer autocomplete suggestions. ```html ``` -------------------------------- ### Reentrant upgrade reaction example with custom element constructor Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/dom.html HTML example showing how defining a custom element can enqueue upgrade reactions for multiple elements, and how a constructor that removes and re-inserts an element can cause a second upgrade reaction. The upgrade algorithm bails out early when the element is already custom. ```html ``` -------------------------------- ### HTML example: a.html and b.html for realm concepts Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/webappapis.html Two HTML files showing a parent page with an iframe and a button that calls a function in the iframe, and the iframe page defining that function. The example illustrates the entry, incumbent, and relevant realms when the button is clicked. ```html Entry page ``` ```html Incumbent page ``` -------------------------------- ### play() method Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/semantics-embedded-content.html Initiates playback of the media resource. Returns a promise that resolves when playback starts or rejects with a NotAllowedError or NotSupportedError. ```APIDOC ## play() method ### Description Initiates playback of the media resource. Returns a promise that resolves when playback starts or rejects with a NotAllowedError or NotSupportedError. ### Method INVOKE ### Endpoint HTMLMediaElement.play() ### Parameters None ### Response #### Success Response (200) - **Promise** - Resolves with undefined when playback starts. #### Error Response - **NotAllowedError** - If the media element is not allowed to play. - **NotSupportedError** - If the media element's error code is MEDIA_ERR_SRC_NOT_SUPPORTED. #### Response Example ``` Promise ``` ``` -------------------------------- ### Rendering of rp example in non-ruby user agents Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/textlevel-semantics.html Shows the expected rendering of the previous rp example in user agents that do not support ruby annotations: the fallback text appears as parentheses around the ruby text. ```text ... 漢字 (かんじ) ... ``` -------------------------------- ### Simplified kbd menu selection Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/textlevel-semantics.html A simpler alternative to the previous example, using a single kbd element with text. ```html

To make George eat an apple, select File | Eat Apple...

``` -------------------------------- ### rp element example with ruby annotations Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/textlevel-semantics.html Shows how to use rp elements to provide fallback parentheses around ruby text for user agents that do not support ruby annotations. The example includes white space for readability. ```html ... 漢 字 ( かん じ ) ... ``` -------------------------------- ### HTML body element example with nav and aside Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sections.html Example of a body element containing a nav and aside, demonstrating how sections are created without explicit headings. ```html

Hello world.

``` -------------------------------- ### Select drop-down with optgroup groups Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html Example form showing how to group option elements into optgroup elements within a select widget. The form submits to /courseselector via GET, and each optgroup has a label and contains option elements with values. ```html

Which course would you like to watch today?

``` -------------------------------- ### Autoplay muted video example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/semantics-embedded-content.html An HTML example showing a video that autoplays muted to avoid annoying users, with controls and loop enabled. The user can turn the sound on. ```html ``` -------------------------------- ### Transparent content model example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/dom.html Shows how to check whether content is allowed inside a transparent element by examining the content models of its ancestors. The example walks through the `a`, `map`, `ins`, and `object` elements to determine that text is allowed as phrasing content. ```html

Apples

``` -------------------------------- ### HTML section element examples Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sections.html Example of a section element with headings and paragraphs, showing how sections group content. ```html

Biography

The facts

1500+ shows, 14+ countries

2010/2011 figures per year

100+ shows, 8+ countries

``` -------------------------------- ### Technically conforming p element example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/grouping-content.html An example that is technically conforming but not ideal, using p elements for metadata that would be better marked up with footer and address elements. ```html

Last modified: 2001-04-23

Author: fred@example.com

``` -------------------------------- ### Conforming p element examples Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/grouping-content.html Two examples of conforming HTML fragments using the p element. The first is a simple paragraph, the second uses br elements for line breaks within a paragraph. ```html

The little kitten gently seated itself on a piece of carpet. Later in his life, this would be referred to as the time the cat sat on the mat.

``` ```html

There was once an example from Femley,
Whose markup was of dubious quality.
The validator complained,
So the author was pained,
To move the error from the markup to the rhyming.

; ``` -------------------------------- ### HTML h1-h6 heading examples Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sections.html Example of h1 and h2 headings used to structure a document. ```html

The Guide To Music On The Playa

The Main Stage

If you want to play on a stage, you should bring one.

Amplified Music

Amplifiers up to 300W or 90dB are welcome.

``` -------------------------------- ### wbr example: suggested wrapping points in code listing Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/textlevel-semantics.html This example uses wbr elements to suggest wrapping points in long lines of code within a pre element. ```html
  Heading heading = Helm.HeadingFactory(HeadingCoordinates[1], HeadingCoordinates[2], HeadingCoordinates[3], HeadingCoordinates[4]);
  Course course = Helm.CourseFactory(Heading, Maps.MapFactoryFromHeading(heading), Speeds.GetMaximumSpeed().ConvertToWarp());
``` -------------------------------- ### MathML quadratic formula example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/semantics-embedded-content.html Example of using MathML in an HTML document to display the quadratic formula. Some browsers may not render it correctly. ```html

The quadratic formula

x = - b ± b 2 - 4 ⁢ a ⁢ c 2 ⁢ a

``` -------------------------------- ### HTML header element example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sections.html Example of a header element inside an article, containing a heading and metadata. ```html

Hard Trance is My Life

By DJ Steve Hill and Technikal

The album with the amusing punctuation has red artwork.

``` -------------------------------- ### Inline samp element example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/textlevel-semantics.html Shows the samp element used inline to represent sample output from a computer system. ```html

The computer said Too much cheese in tray two but I didn’t know what that meant.

``` -------------------------------- ### Example of presentational markup: Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/introduction.html Shows an example of presentational markup using the font element with a color attribute, used to illustrate the maintenance cost of style-dependent markup. ```html ``` -------------------------------- ### Bookmark permalinks example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/links.html Shows how to use rel="bookmark" on anchor elements to create permalinks for sections or articles. The example includes three permalinks: one for a div section, one for an outer article, and one for an inner article. ```html

Example of permalinks

First example

This permalink applies to only the content from the first h2 to the second h2. The div isn’t exactly that section, but it roughly corresponds to it.

Second example

``` -------------------------------- ### Example usage of extractFilename with file input Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html Shows how to use the extractFilename function with an input element of type file. The example includes HTML and JavaScript to display the selected file name. ```html

The name of the file you picked is: (none).

``` ```javascript ``` -------------------------------- ### Modal dialog example for adding coins Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/interactive-elements.html Example of a modal dialog that provides a form for adding coins to a wallet in an online game. The dialog element is shown without an open attribute, so it should not be displayed to the user. ```html

Add to Wallet

You add coins at your own risk.

``` -------------------------------- ### Figure with img and figcaption for a webcam image Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/semantics-embedded-content.html Example showing a webcam image with alt text, a caption, and a link to weather details. ```html
View from Sopwith house, looking towards north Kingston. This image is updated every hour.

View the latest weather details for Kingston upon Thames.

``` -------------------------------- ### Keywords meta tag example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/document-metadata.html This example shows a `meta` element with `name="keywords"` used to specify keywords relevant to a page about typefaces on UK motorways. The value must be a set of comma-separated tokens. ```html Typefaces on UK motorways ... ``` -------------------------------- ### URL-encoded form submission example Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html Example of the URL-encoded data that the user agent submits to the server when the form is filled with the described values. Shows how multiple controls with the same name are submitted as repeated parameters. ```text custname=Denise+Lawrence&custtel=555-555-8642&custemail=&size=small&topping=onion&topping=mushroom&delivery=19%3A00&comments= ``` -------------------------------- ### Example: select element with options Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html Shows a select element with a label and five options, where the third option is preselected using the selected attribute. ```html
``` -------------------------------- ### HTML document after removing start tag with comment Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/syntax.html The result of removing the start tag from the previous example. The comment is now before the html element, which changes the DOM structure. ```html Hello

Welcome to this example.

``` -------------------------------- ### media.readyState Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/semantics-embedded-content.html Returns the current ready state of the media element, describing how much data is available. ```APIDOC ## media.readyState ### Description Returns the value that describes the current ready state of the media element. ### Type Number (read-only) ``` -------------------------------- ### media.play() Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/semantics-embedded-content.html Starts or resumes playback of the media resource. If playback has ended, it restarts from the beginning. ```APIDOC ## media.play() ### Description Sets the `paused` attribute to false, loading the media resource and beginning playback if necessary. If playback had ended, it restarts from the start. ### Method play() ### Parameters None. ### Returns No return value. ``` -------------------------------- ### HTML example: navigation links with accesskey attributes Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/editing.html Shows a navigation block where each link has an accesskey attribute to provide keyboard shortcuts. The accesskey values are single printable characters (a, t, s, b, c) and the example is from the HTML 5.3 specification section 5.5.2. ```html ``` -------------------------------- ### data element example with product ID Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/textlevel-semantics.html Shows how to use the data element to provide a machine-readable value (product ID) alongside human-readable text. ```html

The Instigator 2000

``` -------------------------------- ### selectionStart attribute Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/sec-forms.html Gets or sets the offset to the character immediately following the start of the selection. Setting it acts as if setSelectionRange() were called with the new value as the first argument. ```APIDOC ## selectionStart attribute ### Description Gets or sets the offset (in logical order) to the character that immediately follows the start of the selection. If there is no selection, returns the offset to the character immediately following the text entry cursor. ### Attribute selectionStart ### Getting Returns the offset to the character immediately following the start of the selection, or the caret position if no selection. ### Setting Acts as if setSelectionRange() were called with the new value as the first argument, the current selectionEnd as the second argument (unless selectionEnd is less than the new value, in which case the second argument is also the new value), and the current selectionDirection as the third argument. ``` -------------------------------- ### HTML example: form element inside phrasing content Source: https://www.w3.org/TR/2021/NOTE-html53-20210128/introduction.html Shows markup that results in two paragraphs when parsed as HTML, because a form element's start tag implies a p element's end tag. The example is used to illustrate a parser-related content model restriction. ```html

Welcome.