Search completed in 1.22 seconds.
RangeError: precision is out of range - JavaScript
The JavaScript exception "precision is out of
range" occurs when a number that's outside of the
range of 0 and 20 (or 21) was passed into toFixed or toPrecision. ...
... The JavaScript exception "precision is out of
range" occurs when a number that's outside of the
range of 0 and 20 (or 21) was passed into toFixed or toPrecision. ...
... The JavaScript exception "precision is out of
range" occurs when a number that's outside of the
range of 0 and 20 (or 21) was passed into toFixed or toPrecision. ...
...And 9 more matches
StaticRange.toRange() - Web APIs
Editor's Draft Initial definition. ...
... Editor's Draft Initial definition. ...
... Editor's Draft Initial definition. ...
...And 6 more matches
Range.cloneRange() - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
...And 2 more matches
StaticRange.StaticRange() - Web APIs
The four required
rangeSpec properties are: startContainer The Node in which the starting point of the
range is located. startOffset The offset into the starting node at which the first character of the
range is found. endContainer The Node in which the end point of the
range is located. ...
...The four required
rangeSpec properties are: startContainer The Node in which the starting point of the
range is located. startOffset The offset into the starting node at which the first character of the
range is found. endContainer The Node in which the end point of the
range is located. ...
... The Static
Range() constructor creates a new Static
Range object representing a span of content within the DOM. It includes properties identifying the standard and end positions of the
range as well as a Boolean indicating whether or not the
range is collapsed (that is, empty). Syntax var static
Range = new Static
Range(
rangeSpec) Parameters
rangeSpec The required
rangeSpec parameter is an object adhering to the Static
RangeInit dictionary. The four required
rangeSpec properties are: startContainer The Node in which the starting point of the
range is located. startOffset The offset into the starting node at which the first character of the
range is found. endContainer The Node in which the end point of the
range is located. endOffset The offset into the node indicated by...
...And 2 more matches
Range.isPointInRange() - Web APIs
Living Standard Initial definition. ...
... Living Standard Initial definition. ...
... The
Range.isPointIn
Range() method returns a boolean indicating whether the given point is in the
Range. It returns true if the point (cursor position) at offset within ReferenceNode is within this
range. Syntax bool =
range.isPointIn
Range( referenceNode, offset ) Parameters referenceNode The Node to compare with the
Range. offset The offset into Node of the point to compare with the
Range. Example
range = document.create
Range();
range.selectNode(document.getElementsByTagName("div").item(0)); bool =
range.isPointIn
Range(document.getElementsByTagName("p").item(0),1); Specification Specification Status Comment DOMThe definition of '
Range.isPointIn
Range()' in that specification. Living Standard Initial definition. ...
<input type="range"> - HTML: Hypertext Markup Language
<input> elements of type
range let the user specify a numeric value which must be no less than a given value, and no more than another given value. The precise value, however, is not considered important. This is typically represented using a slider or dial control rather than a text entry box like the number input type. Because this kind of widget is imprecise, it shouldn't typically be used unless the control's exact value isn't important. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If the user's browser doesn't support type
range, it will fall back and treat it as a text input. Value A DOMString c...
...e attribute contains a DOMString which contains a string representation of the selected number. The value is never an empty string (""). The default value is halfway between the specified minimum and maximum--unless the maximum is actually less than the minimum, in which case the default is set to the value of the min attribute. ...
...ains a DOMString which contains a string representation of the selected number. The value is never an empty string (""). The default value is halfway between the specified minimum and maximum--unless the maximum is actually less than the minimum, in which case the default is set to the value of the min attribute. ...
...And 33 more matches
AbstractRange - Web APIs
To understand the difference between those two interfaces, and how to choose which is appropriate for your needs. ...
...To understand the difference between those two interfaces, and how to choose which is appropriate for your needs. ...
...To understand the difference between those two interfaces, and how to choose which is appropriate for your needs. ...
...And 24 more matches
IDBKeyRange - Web APIs
The IDBKey
Range interface of the IndexedDB API represents a continuous interval over some data type that is used for keys. Records can be retrieved from IDBObjectStore and IDBIndex objects using keys or a
range of keys. You can limit the
range using lower and upper bounds. For example, you can iterate over all values of a key in the value
range A-Z. A key
range can be a single value or a
range with upper and lower bounds or endpoints. If the key
range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. A bounded key
range can either be open (the endpoints are excluded) or closed (the endpoints are included). ...
...iterate over all values of a key in the value
range A-Z. A key
range can be a single value or a
range with upper and lower bounds or endpoints. If the key
range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. A bounded key
range can either be open (the endpoints are excluded) or closed (the endpoints are included). ...
... key
range can be a single value or a
range with upper and lower bounds or endpoints. If the key
range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. A bounded key
range can either be open (the endpoints are excluded) or closed (the endpoints are included). ...
...And 18 more matches
TextRange - Web APIs
IE Only This property is IE specific. Although it is well supported by IE, most other browsers no longer support this property. This property should only be used as one of the solutions when you need to be compatible with lower versions of IE, rather than relying on it completely in cross browser scripts. A Text
Range object represents a fragment of text in a document, similar to the standard defined
Range interface. This object is used to represent a specific piece of text in the document. For example, when you hold down the mouse to select the content on the page, you create a typical Text
Range. It is implemented in IE, then a Text
Range object can be created by Element.createText
Range() or Document.selection.create
Range(). Note that this interface is not supported in non IE brow...
...s object is used to represent a specific piece of text in the document. For example, when you hold down the mouse to select the content on the page, you create a typical Text
Range. It is implemented in IE, then a Text
Range object can be created by Element.createText
Range() or Document.selection.create
Range(). Note that this interface is not supported in non IE browsers. Alternative Selection and
Range interfaces can be used. Properties Text
Range.boundingHeightRead only Returns the height of the rectangle bound to the Text
Range object. ...
...te a typical Text
Range. It is implemented in IE, then a Text
Range object can be created by Element.createText
Range() or Document.selection.create
Range(). Note that this interface is not supported in non IE browsers. Alternative Selection and
Range interfaces can be used. Properties Text
Range.boundingHeightRead only Returns the height of the rectangle bound to the Text
Range object. Text
Range.boundingLeftRead only Returns the distance between the left edge of the rectangle that binds the Text
Range object and the left edge that completely contains the Text
Range object. Text
Range.boundingTopRead only Returns the distance between the top edge of the rectangle that binds the Text
Range object and the top edge that completely contains the Text
Range object. ...
...And 14 more matches
IDBKeyRange.bound() - Web APIs
upper specifies the upper bound of the new key
range. lowerOpen Optional indicates whether the lower bound excludes the endpoint value. The default is false. ...
... upper specifies the upper bound of the new key
range. lowerOpen Optional indicates whether the lower bound excludes the endpoint value. The default is false. ...
... upper specifies the upper bound of the new key
range. lowerOpen Optional indicates whether the lower bound excludes the endpoint value. The default is false. ...
...And 12 more matches
HTTP range requests - HTTP
Here the Content-Length header is also useful as it indicates the full size of the image to retrieve. ...
... HTTP
range requests allow to send only a portion of an HTTP message from a server to a client. Partial requests are useful for large media or downloading files with pause and resume functions, for example. Checking if a server supports partial requests If the Accept-
Ranges is present in HTTP responses (and its value isn't "none"), the server supports
range requests. You can check this by issuing a HEAD request with cURL, for example. curl -I http://i.imgur.com/z4d4kWk.jpg HTTP/1.1 200 OK ... ...
...sts are useful for large media or downloading files with pause and resume functions, for example. Checking if a server supports partial requests If the Accept-
Ranges is present in HTTP responses (and its value isn't "none"), the server supports
range requests. You can check this by issuing a HEAD request with cURL, for example. curl -I http://i.imgur.com/z4d4kWk.jpg HTTP/1.1 200 OK ... Accept-
Ranges: bytes Content-Length: 146515 In this response, Accept-
Ranges: bytes indicates that bytes can be used as unit to define a
range. Here the Content-Length header is also useful as it indicates the full size of the image to retrieve. If sites omit the Accept-
Ranges header, they likely don't support partial requests. Some sites also explicitly send "none" as a value, indicating no support. In som...
...And 12 more matches
IDBKeyRange.lowerBound() - Web APIs
Exceptions This method may raise a DOMException of the following type: Exception Description DataError The value parameter passed was not a valid key. ...
... Exceptions This method may raise a DOMException of the following type: Exception Description DataError The value parameter passed was not a valid key. ...
... Exceptions This method may raise a DOMException of the following type: Exception Description DataError The value parameter passed was not a valid key. ...
...And 10 more matches
Range.compareNode() - Web APIs
Obsolete since Gecko 1.9 (Firefox 3)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. The
Range.compareNode() returns a constant indicating the position of the Node. The possible values are: NODE_BEFORE (0) Node starts before the
Range NODE_AFTER (1) Node ends after the
Range NODE_BEFORE_AND_AFTER (2) Node starts before and ends after the
Range NODE_INSIDE (3) Node starts after and ends before the
Range, i.e. the Node is completely selected by the
Range. ...
...(1) Node ends after the
Range NODE_BEFORE_AND_AFTER (2) Node starts before and ends after the
Range NODE_INSIDE (3) Node starts after and ends before the
Range, i.e. the Node is completely selected by the
Range. Warning: This method has been removed from Gecko 1.9 (Firefox 3) and will not exist in future versions of Firefox, which was the only browser implementing it; you should switch to
Range.compareBoundaryPoints() as soon as possible. ...
...E (3) Node starts after and ends before the
Range, i.e. the Node is completely selected by the
Range. Warning: This method has been removed from Gecko 1.9 (Firefox 3) and will not exist in future versions of Firefox, which was the only browser implementing it; you should switch to
Range.compareBoundaryPoints() as soon as possible. ...
...And 9 more matches
Media buffering, seeking, and time ranges - Developer guides
Sometimes it's useful to know how much <audio> or <video> has downloaded or is playable without delay -- a good example of this is the buffered progress bar of an audio or video player. This article discusses how to build a buffer/seek bar using Time
Ranges, and other features of the media API. Buffered The buffered attribute will tell us which parts of the media has been downloaded. It returns a Time
Ranges object, which will tell us which chunks of media have been downloaded. This is usually contiguous but if the user jumps about while media is buffering, it may contain holes. This will work with <audio> or <video>; for now let's consider a simple audio example: <audio id="my-audio" controls src="music.mp3"> </audio> We can access these attributes like so: var myAudio = document...
...ich chunks of media have been downloaded. This is usually contiguous but if the user jumps about while media is buffering, it may contain holes. This will work with <audio> or <video>; for now let's consider a simple audio example: <audio id="my-audio" controls src="music.mp3"> </audio> We can access these attributes like so: var myAudio = document.getElementById('my-audio'); var bufferedTime
Ranges = myAudio.buffered; Time
Ranges Object Time
Ranges are a series of non-overlapping
ranges of time, with start and stop times. (learn more about Time
Ranges). A Time
Ranges Object consists of the following properties: length: The number of time
ranges in the object. start(index): The start time, in seconds, of a time
range. end(index): The end time, in seconds, of a time
range. Without any ...
...nges are a series of non-overlapping
ranges of time, with start and stop times. (learn more about Time
Ranges). A Time
Ranges Object consists of the following properties: length: The number of time
ranges in the object. start(index): The start time, in seconds, of a time
range. end(index): The end time, in seconds, of a time
range. Without any user interaction there is usually only one time
range, but if you jump about in the media more than one time
range can appear, as illustrated by the below visualization. This represents two buffered time
ranges -- one spanning 0 to 5 seconds and the second spanning 15 to 19 seconds. ------------------------------------------------------ |=============| |===========| | ------------------------------------------------------ 0 ...
...And 9 more matches
IDBKeyRange.upperBound() - Web APIs
Exceptions This method may raise a DOMException of the following type: Exception Description DataError The value parameter passed was not a valid key. ...
... Exceptions This method may raise a DOMException of the following type: Exception Description DataError The value parameter passed was not a valid key. ...
... Exceptions This method may raise a DOMException of the following type: Exception Description DataError The value parameter passed was not a valid key. ...
...And 8 more matches
Range - Web APIs
The
Range interface represents a fragment of a document that can contain nodes and parts of text nodes. A
range can be created by using the Document.create
Range() method.
Range objects can also be retrieved by using the get
RangeAt() method of the Selection object or the caret
RangeFromPoint() method of the Document object. There also is the
Range() constructor available. Properties There are no inherited properties.
Range.collapsed Read only Returns a Boolean indicating whether the
range's start and end points are at the same position.
Range.commonAncestorContainer Read only Returns the deepest Node that contains the startContainer and endContainer nodes.
Range.endContainer Read only Returns the Node within which the
Range ends. ...
...nstructor available. Properties There are no inherited properties.
Range.collapsed Read only Returns a Boolean indicating whether the
range's start and end points are at the same position.
Range.commonAncestorContainer Read only Returns the deepest Node that contains the startContainer and endContainer nodes.
Range.endContainer Read only Returns the Node within which the
Range ends.
Range.endOffset Read only Returns a number representing where in the endContainer the
Range ends.
Range.startContainer Read only Returns the Node within which the
Range starts.
Range.startOffset Read only Returns a number representing where in the startContainer the
Range starts. Constructor
Range() Returns a
Range object with the global Document as its start and end. Methods There a...
...ns a number representing where in the endContainer the
Range ends.
Range.startContainer Read only Returns the Node within which the
Range starts.
Range.startOffset Read only Returns a number representing where in the startContainer the
Range starts. Constructor
Range() Returns a
Range object with the global Document as its start and end. Methods There are no inherited methods.
Range.setStart() Sets the start position of a
Range.
Range.setEnd() Sets the end position of a
Range.
Range.setStartBefore() Sets the start position of a
Range relative to another Node.
Range.setStartAfter() Sets the start position of a
Range relative to another Node. ...
...And 8 more matches
RangeError - JavaScript
The
RangeError object indicates an error when a value is not in the set or
range of allowed values. Description A
RangeError is thrown when trying to pass a value as an argument to a function that does not allow a
range that includes the value. This can be encountered when: passing a value that is not one of the allowed string values to String.prototype.normalize(), or when attempting to create an array of an illegal length with the Array constructor, or when passing bad values to the numeric methods Number.prototype.toExponential(), Number.prototype.toFixed() or Number.prototype.toPrecision(). Constructor
RangeError() Creates a new
RangeError object. Instance properties
RangeError.prototype.message Error message. ...
... when attempting to create an array of an illegal length with the Array constructor, or when passing bad values to the numeric methods Number.prototype.toExponential(), Number.prototype.toFixed() or Number.prototype.toPrecision(). Constructor
RangeError() Creates a new
RangeError object. Instance properties
RangeError.prototype.message Error message. Although ECMA-262 specifies that
RangeError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message.
RangeError.prototype.name Error name. ...
..., Number.prototype.toFixed() or Number.prototype.toPrecision(). Constructor
RangeError() Creates a new
RangeError object. Instance properties
RangeError.prototype.message Error message. Although ECMA-262 specifies that
RangeError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message.
RangeError.prototype.name Error name. Inherited from Error.
RangeError.prototype.fileName Path to file that raised this error. Inherited from Error.
RangeError.prototype.lineNumber Line number in file that raised this error. Inherited from Error.
RangeError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. ...
...And 8 more matches
StaticRange - Web APIs
The DOM Static
Range interface extends Abstract
Range to provide a method to specify a
range of content in the DOM whose contents don't update to reflect changes which occur within the DOM tree. It offers the same set of properties and methods as Abstract
Range. Abstract
Range and Static
Range are not available from web workers. ...
...nge and Static
Range are not available from web workers. ...
... absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Abstract
Range" target="_top"><rect x="1" y="1" width="130" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="66" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Abstract
Range</text></a><polyline points="131,25 141,20 141,30 131,25" stroke="#D4DDE4" fill="none"/><line x1="141" y1="25" x2="171" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Static
Range" target="_top"><rect x="171" y="1" width="110" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="226" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#...
...And 7 more matches
Document.caretRangeFromPoint() - Web APIs
Null, if x or y are negative, outside viewport, or there is no text entry node. Example Basic demo: When clicking in a paragraph insert a line break at the caret position: HTML <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. ...
... Null, if x or y are negative, outside viewport, or there is no text entry node. Example Basic demo: When clicking in a paragraph insert a line break at the caret position: HTML <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. ...
...t a line break at the caret position: HTML <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. ...
...And 6 more matches
Range.getBoundingClientRect() - Web APIs
This method is useful for determining the viewport coordinates of the cursor or selection inside a text box. See Element.getBoundingClientRect() for details on the returned value. Syntax boundingRect =
range.getBoundingClientRect() Example HTML <div id="highlight"></div> <p>This example positions a "highlight" rectangle behind the contents of a
range. The
range's content <b>starts here</b> and continues on until it <b>ends here</b>. ...
...rectangles for all the elements in the
range. This method is useful for determining the viewport coordinates of the cursor or selection inside a text box. See Element.getBoundingClientRect() for details on the returned value. Syntax boundingRect =
range.getBoundingClientRect() Example HTML <div id="highlight"></div> <p>This example positions a "highlight" rectangle behind the contents of a
range. The
range's content <b>starts here</b> and continues on until it <b>ends here</b>. ...
...See Element.getBoundingClientRect() for details on the returned value. Syntax boundingRect =
range.getBoundingClientRect() Example HTML <div id="highlight"></div> <p>This example positions a "highlight" rectangle behind the contents of a
range. The
range's content <b>starts here</b> and continues on until it <b>ends here</b>. ...
...And 6 more matches
Range.setEndAfter() - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
...And 6 more matches
Range.setEndBefore() - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
...And 6 more matches
Range.setStartAfter() - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
...And 6 more matches
IDBKeyRange.lowerOpen - Web APIs
The lowerOpen read-only property of the IDBKey
Range interface returns a boolean indicating whether the lower-bound value is included in the key
range. Note: This feature is available in Web Workers. Syntax var lowerOpen = myKey
Range.lowerOpen Value A boolean: Value Indication true The lower-bound value is not included in the key
range. false The lower-bound value is included in the key
range. Example The following example illustrates how you'd use a key
range. Here we declare key
RangeValue = IDBKey
Range.upperBound("F", "W", true, true); -- a
range that includes everything between "F" and "W" but not including them -- since both the upper and lower bounds have been declared as open (true). We open a transaction (using IDBTransaction)...
...llustrates how you'd use a key
range. Here we declare key
RangeValue = IDBKey
Range.upperBound("F", "W", true, true); -- a
range that includes everything between "F" and "W" but not including them -- since both the upper and lower bounds have been declared as open (true). We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its lowerOpen property value to the console, which should appear as "true": the lower bound is open, so won't be included in the
range. ...
...n (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its lowerOpen property value to the console, which should appear as "true": the lower bound is open, so won't be included in the
range. ...
...And 5 more matches
IDBKeyRange.upperOpen - Web APIs
The upperOpen read-only property of the IDBKey
Range interface returns a boolean indicating whether the upper-bound value is included in the key
range. Note: This feature is available in Web Workers. Syntax var upperOpen = myKey
Range.upperOpen Value A boolean: Value Indication true The upper-bound value is not included in the key
range. false The upper-bound value is included in the key
range. Example The following example illustrates how you'd use a key
range. Here we declare key
RangeValue = IDBKey
Range.upperBound("F", "W", true, true); -- a
range that includes everything between "F" and "W" but not including them -- since both the upper and lower bounds have been declared as open (true). We open a transaction (using IDBTransaction)...
...llustrates how you'd use a key
range. Here we declare key
RangeValue = IDBKey
Range.upperBound("F", "W", true, true); -- a
range that includes everything between "F" and "W" but not including them -- since both the upper and lower bounds have been declared as open (true). We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its upperOpen property value to the console, which should appear as "true": the upper bound is open, so won't be included in the
range. ...
...n (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its upperOpen property value to the console, which should appear as "true": the upper bound is open, so won't be included in the
range. ...
...And 5 more matches
range - CSS: Cascading Style Sheets
When defining custom counter styles, the
range descriptor lets the author specify a
range of counter values over which the style is applied. If a counter value is outside the specified
range, then the fallback style will be used to construct the representation of that marker. Syntax /* Keyword value */
range: auto; /*
Range values */
range: 2 5;
range: infinite 10;
range: 6 infinite;
range: infinite infinite; /* Multiple
range values */
range: 2 5, 8 10;
range: infinite 6, 10 infinite; Values auto The
range depends on the counter system: For cyclic, numeric, and fixed systems, the
range is negative infinity to positive infinity. For alphabetic and symbolic systems, the
range is 1 to positive infinity. For additive systems, the
range is 0 to positive infinity. For extends sy...
... /* Multiple
range values */
range: 2 5, 8 10;
range: infinite 6, 10 infinite; Values auto The
range depends on the counter system: For cyclic, numeric, and fixed systems, the
range is negative infinity to positive infinity. For alphabetic and symbolic systems, the
range is 1 to positive infinity. For additive systems, the
range is 0 to positive infinity. For extends systems, the
range is whatever auto would produce for the extended system; if extending a complex predefined style (?7 Complex Predefined Counter Styles), the
range is the style's defined
range. [ [ | infinite ]{2} ]# Defines a comma-separated list of
ranges. For each individual
range, the first value is the lower bound and the second value is the upper bound. ...
...tive infinity. For extends systems, the
range is whatever auto would produce for the extended system; if extending a complex predefined style (?7 Complex Predefined Counter Styles), the
range is the style's defined
range. [ [ | infinite ]{2} ]# Defines a comma-separated list of
ranges. For each individual
range, the first value is the lower bound and the second value is the upper bound. A
range is inclusive, that means it always contains both, the lower and upper bound numbers. If infinite is used as the first value in a
range, it represents negative infinity; if it is used as the second value, it represents positive infinity. The
range of the counter style is the union of all the
ranges defined in the list. ...
...And 5 more matches
IDBKeyRange.lower - Web APIs
The lower read-only property of the IDBKey
Range interface returns the lower bound of the key
range. Note: This feature is available in Web Workers. Syntax var lower = myKey
Range.lower Value The lower bound of the key
range (can be any type.) Example The following example illustrates how you'd use a key
range. Here we declare key
RangeValue = IDBKey
Range.upperBound("F", "W", true, true); -- a
range that includes everything between "F" and "W" but not including them -- since both the upper and lower bounds have been declared as open (true). We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its lower property value to the console...
...ower bounds have been declared as open (true). We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its lower property value to the console, which should appear as "F". ...
...s open (true). We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its lower property value to the console, which should appear as "F". ...
...And 4 more matches
IDBKeyRange.only() - Web APIs
The only() method of the IDBKey
Range interface creates a new key
range containing a single value. Note: This feature is available in Web Workers. Syntax var myIDBKey
Range = IDBKey
Range.only(value); Parameters value is the value for the new key
range. Return value IDBKey
Range: The newly created key
range. Exceptions This method may raise a DOMException of the following types: Exception Description DataError The value parameter passed was not a valid key. Example The following example illustrates how you'd use an only key
range. Here we declare a key
RangeValue = IDBKey
Range.only("A"); -- a
range that only includes the value "A". We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.o...
... DataError The value parameter passed was not a valid key. Example The following example illustrates how you'd use an only key
range. Here we declare a key
RangeValue = IDBKey
Range.only("A"); -- a
range that only includes the value "A". We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. This means that the cursor will only retrieve the record with the key value "A". ...
...lue = IDBKey
Range.only("A"); -- a
range that only includes the value "A". We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. This means that the cursor will only retrieve the record with the key value "A". ...
...And 4 more matches
IDBKeyRange.upper - Web APIs
The upper read-only property of the IDBKey
Range interface returns the upper bound of the key
range. Note: This feature is available in Web Workers. Syntax var upper = myKey
Range.upper Value The upper bound of the key
range (can be any type.) Example The following example illustrates how you'd use a key
range. Here we declare key
RangeValue = IDBKey
Range.upperBound("F", "W", true, true); -- a
range that includes everything between "F" and "W" but not including them -- since both the upper and lower bounds have been declared as open (true). We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its upper property value to the console...
...ower bounds have been declared as open (true). We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its upper property value to the console, which should appear as "W". ...
...s open (true). We open a transaction (using IDBTransaction) and an object store, and open a Cursor with IDBObjectStore.openCursor, declaring key
RangeValue as its optional key
range value. After declaring the key
range, we log its upper property value to the console, which should appear as "W". ...
...And 4 more matches
Range.commonAncestorContainer - Web APIs
The
Range.commonAncestorContainer read-only property returns the deepest -- or furthest down the document tree -- Node that contains both boundary points of the
Range. This means that if
Range.startContainer and
Range.endContainer both refer to the same node, this node is the common ancestor container. Since a
Range need not be continuous, and may also partially select nodes, this is a convenient way to find a Node which encloses a
Range. This property is read-only. To change the ancestor container of a Node, consider using the various methods available to set the start and end positions of the
Range, such as
Range.setStart() and
Range.setEnd(). Syntax
rangeAncestor =
range.commonAncestorContainer; Example In this example, we create an event listener to handle pointerup events on a list.
...The .highlight class created below uses a set of CSS @keyframes to animate a fading outline. ...
...t of CSS @keyframes to animate a fading outline. ...
...And 4 more matches
Range.compareBoundaryPoints() - Web APIs
The
Range.compareBoundaryPoints() method compares the boundary points of the
Range with those of another
range. Syntax compare =
range.compareBoundaryPoints(how, source
Range); Return value compare A number, -1, 0, or 1, indicating whether the corresponding boundary-point of the
Range is respectively before, equal to, or after the corresponding boundary-point of source
Range. Parameters how A constant describing the comparison method:
Range.END_TO_END compares the end boundary-point of source
Range to the end boundary-point of
Range.
Range.END_TO_START compares the end boundary-point of source
Range to the start boundary-point of
Range.
Range.START_TO_END compares the start boundary-point of source
Range to the end boundary-point of
Range. ...
...of source
Range. Parameters how A constant describing the comparison method:
Range.END_TO_END compares the end boundary-point of source
Range to the end boundary-point of
Range.
Range.END_TO_START compares the end boundary-point of source
Range to the start boundary-point of
Range.
Range.START_TO_END compares the start boundary-point of source
Range to the end boundary-point of
Range.
Range.START_TO_START compares the start boundary-point of source
Range to the start boundary-point of
Range. If the value of the parameter is invalid, a DOMException with a NotSupportedError code is thrown. source
Range A
Range to compare boundary points with the
range. ...
...
Range.START_TO_END compares the start boundary-point of source
Range to the end boundary-point of
Range.
Range.START_TO_START compares the start boundary-point of source
Range to the start boundary-point of
Range. If the value of the parameter is invalid, a DOMException with a NotSupportedError code is thrown. source
Range A
Range to compare boundary points with the
range. ...
...And 4 more matches
Range.extractContents() - Web APIs
The
Range.extractContents() method moves contents of the
Range from the document tree into a DocumentFragment. Event listeners added using DOM Events are not retained during extraction. HTML attribute events are retained or duplicated as they are for the Node.cloneNode() method. HTML id attributes are also cloned, which can lead to an invalid document if a partially-selected node is extracted and appended to the document. Partially selected nodes are cloned to include the parent tags necessary to make the document fragment valid. ...
...d during extraction. HTML attribute events are retained or duplicated as they are for the Node.cloneNode() method. HTML id attributes are also cloned, which can lead to an invalid document if a partially-selected node is extracted and appended to the document. Partially selected nodes are cloned to include the parent tags necessary to make the document fragment valid. Syntax documentFragment =
range.extractContents(); Example Basic example var
range = document.create
Range();
range.selectNode(document.getElementsByTagName("div").item(0)); var documentFragment =
range.extractContents(); document.body.appendChild(documentFragment); Moving items between containers This example lets you move items between two containers. Select one or more item, and then click "swap" to move them to the op...
... border: 1px solid; font-size: 2em; padding: .3em; } button { font-size: 1.2em; padding: .5em; pointer-events: auto; } JavaScript const list1 = document.getElementById('list1'); const list2 = document.getElementById('list2'); const button = document.getElementById('swap'); button.addEventListener('click', e => { selection = window.getSelection(); for (let i = 0; i < selection.
rangeCount; i++) { const
range = selection.get
RangeAt(i); if (
range.commonAncestorContainer === list1 ||
range.commonAncestorContainer.parentNode === list1) { const documentFragment =
range.extractContents(); list2.appendChild(documentFragment); } else if (
range.commonAncestorContainer === list2 ||
range.commonAncestorContainer.parentNode === list2) { cons...
...And 4 more matches
Range.setStart() - Web APIs
The
Range.setStart() method sets the start position of a
Range. If the startNode is a Node of type Text, Comment, or CDataSection, then startOffset is the number of characters from the start of startNode. For other Node types, startOffset is the number of child nodes between the start of the startNode. Setting the start point below (lower in the document) the end point will result in a collapsed
range with the start and end points both set to the specified start position. Syntax
range.setStart(startNode, startOffset); Parameters startNode The Node where the
Range should start. startOffset An integer greater than or equal to zero representing the offset for the start of the
Range from the start of startNode. ...
...llapsed
range with the start and end points both set to the specified start position. Syntax
range.setStart(startNode, startOffset); Parameters startNode The Node where the
Range should start. startOffset An integer greater than or equal to zero representing the offset for the start of the
Range from the start of startNode. Examples Highlight part of an element This example uses the
Range.setStart() and
Range.setEnd() methods to add part of an address to a
range. The selected
range is then highlighted using
Range.surroundContents(). The address contains nine nodes: five text nodes, and four <br> elements. HTML <p id="address">Wyatt Earp<br> 101 E. Main St.<br> Dodge City, KS<br> 67801<br> USA</p> <hr> <p>Nodes in the original address:</p> <ol id="log"></ol> JavaScript const...
...('address'); const log = document.getElementById('log'); // Log info address.childNodes.forEach(node => { const li = document.createElement('li'); li.textContent = `${node.nodeName}, ${node.nodeValue}`; log.appendChild(li); }); // Highlight the street and city const startOffset = 2; // Start at third node: 101 E. Main St. ...
...And 4 more matches
Range.collapsed - Web APIs
Living Standard No change. ...
... Living Standard No change. ...
... Living Standard No change. ...
...And 3 more matches
:out-of-range - CSS: Cascading Style Sheets
The :out-of-
range CSS pseudo-class represents an <input> element whose current value is outside the
range limits specified by the min and max attributes. /* Selects any <input>, but only when it has a
range specified, and its value is outside that
range */ input:out-of-
range { background-color: rgba(255, 0, 0, 0.25); } This pseudo-class is useful for giving the user a visual indication that a field's current value is outside the permitted limits. Note: This pseudo-class only applies to elements that have (and can take) a
range limitation. ...
... and its value is outside that
range */ input:out-of-
range { background-color: rgba(255, 0, 0, 0.25); } This pseudo-class is useful for giving the user a visual indication that a field's current value is outside the permitted limits. Note: This pseudo-class only applies to elements that have (and can take) a
range limitation. ...
...utside that
range */ input:out-of-
range { background-color: rgba(255, 0, 0, 0.25); } This pseudo-class is useful for giving the user a visual indication that a field's current value is outside the permitted limits. Note: This pseudo-class only applies to elements that have (and can take) a
range limitation. ...
...And 3 more matches
Intl.DateTimeFormat.prototype.formatRangeToParts() - JavaScript
The Intl.DateTimeFormat.prototype.format
RangeToParts() method allows locale-specific tokens representing each part of the formatted date
range produced by DateTimeFormat formatters. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.DateTimeFormat.prototype.format
RangeToParts(startDate, endDate) Examples Basic format
RangeToParts usage This method receives two Dates and returns an Array of objects containing the locale-specific tokens representing each part of the formatted date
range. let date1 = new Date(Date.UTC(2007, 0, 10, 10, 0, 0)); let date2 = new Date(Date.UTC(2007, 0, 10, 11, 0, 0)); // > 'Wed,...
... of objects containing the locale-specific tokens representing each part of the formatted date
range. ...
...nting each part of the formatted date
range. ...
...And 3 more matches
IDBLocaleAwareKeyRange - Web APIs
The IDBLocaleAwareKey
Range interface of the IndexedDB API is a Firefox-specific version of IDBKey
Range -- it functions in exactly the same fashion, and has the same properties and methods, but it is intended for use with IDBIndex objects when the original index had a locale value specified upon its creation (see createIndex()'s optionalParameters) -- that is, it has locale aware sorting enabled. Methods This interface inherits all the methods of its parent interface, IDBKey
Range. Properties This interface inherits all the properties of its parent interface, IDBKey
Range. Bear in mind however that IDBLocaleAwareKey
Range has its own implementation of IDBKey
Range.bound. This is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that's no...
...e, IDBKey
Range. Bear in mind however that IDBLocaleAwareKey
Range has its own implementation of IDBKey
Range.bound. This is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that's not the case. With locale-aware indexes, the meaning of < depends on the locale, so for example in Lithuanian Y is sorted between I and K. The only difference between IDBKey
Range and IDBLocaleAwareKey
Range is that the latter doesn't do the aforementioned check. Developers should always use IDBLocaleAwareKey
Range when dealing with locale-aware indexes. ...
...not the case. With locale-aware indexes, the meaning of < depends on the locale, so for example in Lithuanian Y is sorted between I and K. The only difference between IDBKey
Range and IDBLocaleAwareKey
Range is that the latter doesn't do the aforementioned check. Developers should always use IDBLocaleAwareKey
Range when dealing with locale-aware indexes. ...
...And 2 more matches
MediaSettingsRange - Web APIs
Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities().imageWidth to modify the size of an input
range. ...
... Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities().imageWidth to modify the size of an input
range. ...
... Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities().imageWidth to modify the size of an input
range. ...
...And 2 more matches
Range() - Web APIs
The
Range() constructor returns a newly created
Range object whose start and end is the global Document object. Syntax
range = new
Range() Example In this example we create a new
range with the
Range() constructor, and set its beginning and end positions using the
Range.setStartBefore() and
Range.setEndAfter() methods. We then select the
range using window.getSelection() and Selection.add
Range(). ...
... with the
Range() constructor, and set its beginning and end positions using the
Range.setStartBefore() and
Range.setEndAfter() methods. We then select the
range using window.getSelection() and Selection.add
Range(). ...
...nge() constructor, and set its beginning and end positions using the
Range.setStartBefore() and
Range.setEndAfter() methods. We then select the
range using window.getSelection() and Selection.add
Range(). ...
...And 2 more matches
Range.endContainer - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
...And 2 more matches
Range.startContainer - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
...And 2 more matches
If-Range - HTTP
The If-
Range HTTP request header makes a
range request conditional: if the condition is fulfilled, the
range request will be issued and the server sends back a 206 Partial Content answer with the appropriate body. If the condition is not fulfilled, the full resource is sent back, with a 200 OK status. This header can be used either with a Last-Modified validator, or with an ETag, but not with both. The most common use case is to resume a download, to guarantee that the stored resource has not been modified since the last fragment has been received. ...
... full resource is sent back, with a 200 OK status. This header can be used either with a Last-Modified validator, or with an ETag, but not with both. The most common use case is to resume a download, to guarantee that the stored resource has not been modified since the last fragment has been received. Header type Request header Forbidden header name no Syntax If-
Range: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT If-
Range: <etag> Directives <etag> An entity tag uniquely representing the requested resource. It is a string of ASCII characters placed between double quotes (Like "675af34563dc-tr34") and may be prefixed by W/ to indicate that the weak comparison algorithm should be used. <day-name> One of "Mon", "Tue", "Wed", "Thu", "Fri"...
...ar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" (case sensitive). <year> 4 digit year number, e.g. "1990" or "2016". <hour> 2 digit hour number, e.g. "09" or "23". ...
...And 2 more matches
Groups and ranges - JavaScript
It is also possible to include a character class in a character set. ...
...s. Types The following section is also duplicated on this cheatsheet. Do not forget to edit it as well, thanks! Characters Meaning x|y Matches either "x" or "y". For example, /green|red/ matches "green" in "green apple" and "red" in "red apple". [xyz] [a-c] A character set. Matches any one of the enclosed characters. You can specify a
range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character set as a normal character. It is also possible to include a character class in a character set. For example, [abcd] is the same as [a-d]. They match the "b" in "brisket", and the "c" in "chop". For examp...
...match the "b" in "brisket", the "c" in "chop", and the "-" (hyphen) in "non-profit". For example, [\w-] is the same as [A-Za-z0-9_-]. They both match the "b" in "brisket", the "c" in "chop", and the "n" in "non-profit". [^xyz] [^a-c] A negated or complemented character set. That is, it matches anything that is not enclosed in the brackets. You can specify a
range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character set as a normal character. For example, [^abc] is the same as [^a-c]. They initially match "o" in "bacon" and "h" in "chop". The ^ character may also indicate the beginning of input. (x...
...And 2 more matches
RangeError: invalid array length - JavaScript
The JavaScript exception "Invalid array length" occurs when creating an Array or an ArrayBuffer which has a length which is either negative or larger or equal to 232, or when setting the Array.length property to a value which is either negative or larger or equal to 232. ...
... The JavaScript exception "Invalid array length" occurs when creating an Array or an ArrayBuffer which has a length which is either negative or larger or equal to 232, or when setting the Array.length property to a value which is either negative or larger or equal to 232. ...
... The JavaScript exception "Invalid array length" occurs when creating an Array or an ArrayBuffer which has a length which is either negative or larger or equal to 232, or when setting the Array.length property to a value which is either negative or larger or equal to 232. ...
...And 2 more matches
nsIDOMHTMLTimeRanges
The nsIDOMHTMLTime
Ranges interface represents a set of time
ranges in media; it's primarily used by the nsIDOMHTMLMediaElement interface, and implements the DOM Time
Ranges interface. Each time
range represented by an nsIDOMHTMLTime
Ranges object has an index number; you call the start() and end() methods to obtain the start and end times of each
range, specifying the index number of the
range to look up. dom/interfaces/html/nsIDOMHTMLTime
Ranges.idlScriptable Please add a summary to this article. Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Inherits from: nsISupports Method overview float start(in unsigned long index); float end(in unsigned long index); Attributes Attribute Type Description length unsigned long The number of
ranges represented ...
...Read only. Methods end() Returns the time offset to the end of the specified time
range. float end( in unsigned long index ); Parameters index The index to the time
range whose end time is to be returned. Return value The time at which the specified
range ends, in seconds measured from the beginning of the timeline represented by the object. ...
...cko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Inherits from: nsISupports Method overview float start(in unsigned long index); float end(in unsigned long index); Attributes Attribute Type Description length unsigned long The number of
ranges represented by the nsIDOMHTMLTime
Ranges object. Read only. Methods end() Returns the time offset to the end of the specified time
range. float end( in unsigned long index ); Parameters index The index to the time
range whose end time is to be returned. Return value The time at which the specified
range ends, in seconds measured from the beginning of the timeline represented by the object. Exceptions thrown INDEX_SIZE_ERR The specified index is not valid. start() Returns the time offset to the start of the specified time ra...
... whose end time is to be returned. Return value The time at which the specified
range ends, in seconds measured from the beginning of the timeline represented by the object. Exceptions thrown INDEX_SIZE_ERR The specified index is not valid. start() Returns the time offset to the start of the specified time
range. float start( in unsigned long index ); Parameters index The index to the time
range whose start time is to be returned. Return value The time at which the specified
range starts, in seconds measured from the beginning of the timeline represented by the object. Exceptions thrown INDEX_SIZE_ERR The specified index is not valid. ...
HTMLInputElement.setSelectionRange() - Web APIs
The HTMLInputElement.setSelection
Range() method sets the start and end positions of the current text selection in an <input> or <textarea> element. Optionally, in newer browser versions, you can specify the direction in which selection should be considered to have occurred. This lets you indicate, for example, that the selection was set by the user clicking and dragging from the end of the selected text toward the beginning. This method updates the HTMLInputElement.selectionStart, selectionEnd, and selectionDirection properties in one call. Note that accordingly to the WHATWG forms spec selectionStart, selectionEnd properties and setSelection
Range method apply only to inputs of types text, search, URL, tel and password. Chrome, starting from version 33, throws an exception while accessing t...
... an exception while accessing those properties and method on the rest of input types. For example, on input of type number: "Failed to read the 'selectionStart' property from 'HTMLInputElement': The input element's type ('number') does not support selection". If you wish to select all text of an input element, you can use the HTMLInputElement.select() method instead. Syntax element.setSelection
Range(selectionStart, selectionEnd [, selectionDirection]); Parameters If selectionEnd is less than selectionStart, then both are treated as the value of selectionEnd. selectionStart The 0-based index of the first selected character. An index greater than the length of the element's value is treated as pointing to the end of the value. selectionEnd The 0-based index of the character after the ...
... value. Example Click the button in this example to select the third, fourth, and fifth characters in the text box ("zil" in the word "Mozilla"). HTML <input type="text" id="text-box" size="20" value="Mozilla"> <button onclick="selectText()">Select text</button> JavaScript function selectText() { const input = document.getElementById('text-box'); input.focus(); input.setSelection
Range(2, 5); } Result Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLInputElement.setSelection
Range()' in that specification. Living Standard No change HTML 5.1The definition of 'HTMLInputElement.setSelection
Range()' in that specification. Recommendation No change HTML5The definition of 'HTMLInputElem...
...t Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLInputElement.setSelection
Range()' in that specification. Living Standard No change HTML 5.1The definition of 'HTMLInputElement.setSelection
Range()' in that specification. Recommendation No change HTML5The definition of 'HTMLInputElement.setSelection
Range()' in that specification. Recommendation Initial definition ...
IDBKeyRange.includes() - Web APIs
The includes() method of the IDBKey
Range interface returns a boolean indicating whether a specified key is inside the key
range. Note: This feature is available in Web Workers. Syntax var isIncluded = myKey
Range.includes(key) Parameters key The key you want to check for in your key
range. This can be any type. Return value A Boolean. Exceptions This method may raise a DOMException of the following type: Attribute Description DataError The supplied key was not a valid key. ...
...: This feature is available in Web Workers. Syntax var isIncluded = myKey
Range.includes(key) Parameters key The key you want to check for in your key
range. This can be any type. Return value A Boolean. Exceptions This method may raise a DOMException of the following type: Attribute Description DataError The supplied key was not a valid key. Example var key
RangeValue = IDBKey
Range.bound('A', 'K', false, false); var myResult = key
RangeValue.includes('F'); // Returns true var myResult = key
RangeValue.includes('W'); // Returns false Polyfill The includes() method was added in the second edition of the Indexed DB specification. ...
...s not a valid key. Example var key
RangeValue = IDBKey
Range.bound('A', 'K', false, false); var myResult = key
RangeValue.includes('F'); // Returns true var myResult = key
RangeValue.includes('W'); // Returns false Polyfill The includes() method was added in the second edition of the Indexed DB specification. For browsers that do not support it, the following polyfill can be used. ...
... var key
RangeValue = IDBKey
Range.bound('A', 'K', false, false); var myResult = key
RangeValue.includes('F'); // Returns true var myResult = key
RangeValue.includes('W'); // Returns false Polyfill The includes() method was added in the second edition of the Indexed DB specification. For browsers that do not support it, the following polyfill can be used. ...
InputEvent.getTargetRanges() - Web APIs
Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
.... Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
Range.cloneContents() - Web APIs
The
Range.cloneContents() returns a DocumentFragment copying the objects of type Node included in the
Range. Event Listeners added using DOM Events are not copied during cloning. HTML attribute events are duplicated as they are for the DOM Core cloneNode method. HTML id attributes are also cloned, which can lead to an invalid document through cloning. Partially selected nodes include the parent tags necessary to make the document fragment valid. ...
... Node included in the
Range. Event Listeners added using DOM Events are not copied during cloning. HTML attribute events are duplicated as they are for the DOM Core cloneNode method. HTML id attributes are also cloned, which can lead to an invalid document through cloning. Partially selected nodes include the parent tags necessary to make the document fragment valid. Syntax documentFragment =
range.cloneContents(); Example
range = document.create
Range();
range.selectNode(document.getElementsByTagName("div").item(0)); documentFragment =
range.cloneContents(); document.body.appendChild(documentFragment); Specifications Specification Status Comment DOMThe definition of '
Range.cloneContents()' in that specification. Living Standard No change. Documen...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
Range.createContextualFragment() - Web APIs
The
Range.createContextualFragment() method returns a DocumentFragment by invoking the HTML fragment parsing algorithm or the XML fragment parsing algorithm with the start of the
range (the parent of the selected node) as the context node. The HTML fragment parsing algorithm is used if the
range belongs to a Document whose HTMLness bit is set. In the HTML case, if the context node would be html, for historical reasons the fragment parsing algorithm is invoked with body as the context instead. Syntax documentFragment =
range.createContextualFragment(tagString) Parameters tagString Text that contains text and tags to be converted to a document fragment. ...
...ness bit is set. In the HTML case, if the context node would be html, for historical reasons the fragment parsing algorithm is invoked with body as the context instead. Syntax documentFragment =
range.createContextualFragment(tagString) Parameters tagString Text that contains text and tags to be converted to a document fragment. ...
... HTML case, if the context node would be html, for historical reasons the fragment parsing algorithm is invoked with body as the context instead. Syntax documentFragment =
range.createContextualFragment(tagString) Parameters tagString Text that contains text and tags to be converted to a document fragment. ...
...ing algorithm is invoked with body as the context instead. Syntax documentFragment =
range.createContextualFragment(tagString) Parameters tagString Text that contains text and tags to be converted to a document fragment. Example var tagString = "<div>I am a div node</div>"; var
range = document.create
Range(); // Make the parent of the first div in the document becomes the context node
range.selectNode(document.getElementsByTagName("div").item(0)); var documentFragment =
range.createContextualFragment(tagString); document.body.appendChild(documentFragment); Specification Specification Status Comment DOM Parsing and SerializationThe definition of '
Range.createContextualFragment()' in that specification. Working Draft Initial specification. ...
Range.deleteContents() - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... The
Range.deleteContents() method removes the contents of the
Range from the Document. Unlike
Range.extractContents(), this method does not return a DocumentFragment containing the deleted content. Syntax
range.deleteContents() Example
range = document.create
Range();
range.selectNode(document.getElementsByTagName("div").item(0));
range.deleteContents(); Specifications Specification Status Comment DOMThe definition of '
Range.deleteContents()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.deleteContents()' in that specification. Obsolete Initial specification. ...
Range.insertNode() - Web APIs
The
Range.insertNode() method inserts a node at the start of the
Range. The new node is inserted at the start boundary point of the
Range. If the new node is to be added to a text Node, that Node is split at the insertion point, and the insertion occurs between the two text nodes. If the new node is a document fragment, the children of the document fragment are inserted instead. Syntax
range.insertNode(newNode); Parameters newNode The Node to insert at the start of the
range. ...
...he start boundary point of the
Range. If the new node is to be added to a text Node, that Node is split at the insertion point, and the insertion occurs between the two text nodes. If the new node is a document fragment, the children of the document fragment are inserted instead. Syntax
range.insertNode(newNode); Parameters newNode The Node to insert at the start of the
range. Example
range = document.create
Range(); newNode = document.createElement("p"); newNode.appendChild(document.createTextNode("New Node Inserted Here"));
range.selectNode(document.getElementsByTagName("div").item(0));
range.insertNode(newNode); Specifications Specification Status Comment DOMThe definition of '
Range.insertNode()' in that specification. Living Standard No change ...
... Obsolete Initial definition ...
... Obsolete Initial definition ...
Range.selectNode() - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... The
Range.selectNode() method sets the
Range to contain the Node and its contents. The parent Node of the start and end of the
Range will be the same as the parent of the referenceNode. Syntax
range.selectNode(referenceNode); Parameters referenceNode The Node to select within a
Range. Example let
range = document.create
Range(); let referenceNode = document.getElementsByTagName('div').item(0);
range.selectNode(referenceNode); Specifications Specification Status Comment DOMThe definition of '
Range.selectNode()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.selectNode()' in that specification. Obsolete Initial specification. ...
Range.selectNodeContents() - Web APIs
The
Range.selectNodeContents() method sets the
Range to contain the contents of a Node. The parent Node of the start and end of the
Range will be the reference node. The startOffset is 0, and the endOffset is the number of child Nodes or number of characters contained in the reference node. Syntax
range.selectNodeContents(referenceNode); Parameters referenceNode The Node whose contents will be selected within a
Range. Example
range = document.create
Range(); referenceNode = document.getElementsByTagName("div")[0];
range.selectNodeContents(referenceNode); Live sample This example lets the user select and deselect a paragraph with buttons. Document.create
Range(),
Range.selectNodeContents(), and Selection.add
Range() are used to select the content. Window.getSelection() and Selection...
... within a
Range. Example
range = document.create
Range(); referenceNode = document.getElementsByTagName("div")[0];
range.selectNodeContents(referenceNode); Live sample This example lets the user select and deselect a paragraph with buttons. Document.create
Range(),
Range.selectNodeContents(), and Selection.add
Range() are used to select the content. Window.getSelection() and Selection.removeAll
Ranges() are used to deselect it. HTML <p id="p"><b>Use the buttons below</b> to select or deselect the contents of this paragraph.</p> <button id="select-button">Select paragraph</button> <button id="deselect-button">Deselect paragraph</button> JavaScript const p = document.getElementById('p'); const selectButton = document.getElementById('select-button'); const deselectButton = document.getEleme...
...graph</button> <button id="deselect-button">Deselect paragraph</button> JavaScript const p = document.getElementById('p'); const selectButton = document.getElementById('select-button'); const deselectButton = document.getElementById('deselect-button'); selectButton.addEventListener('click', e => { // Clear any current selection const selection = window.getSelection(); selection.removeAll
Ranges(); // Select paragraph const
range = document.create
Range();
range.selectNodeContents(p); selection.add
Range(
range); }); deselectButton.addEventListener('click', e => { const selection = window.getSelection(); selection.removeAll
Ranges(); }); Result Specifications Specification Status Comment DOMThe definition of '
Range.selectNodeContents()' in that spe...
...ection.add
Range(
range); }); deselectButton.addEventListener('click', e => { const selection = window.getSelection(); selection.removeAll
Ranges(); }); Result Specifications Specification Status Comment DOMThe definition of '
Range.selectNodeContents()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.selectNodeContents()' in that specification. Obsolete Initial specification. ...
Range.setEnd() - Web APIs
Return value undefined. Exceptions Exceptions are thrown as DOMException objects of the following types: InvalidNodeTypeError The node specified by endNode is a doctype node;
range endpoints cannot be located inside a doctype node. ...
... The
Range.setEnd() method sets the end position of a
Range to be located at the given offset into the specified node x.Setting the end point above (higher in the document) than the start point will result in a collapsed
range with the start and end points both set to the specified end position. Syntax
range.setEnd(endNode, endOffset); Parameters endNode The Node inside which the
Range should end. endOffset An integer greater than or equal to zero representing the offset for the end of the
Range from the start of endNode. Return value undefined. Exceptions Exceptions are thrown as DOMException objects of the following types: InvalidNodeTypeError The node specified by endNode is a doctype node;
range endpoints cannot be located inside a doctype node. IndexSizeError The value...
...pe node. IndexSizeError The value specified by endOffset is either greater than or equal to the length of the node or is less than zero. Usage notes If the endNode is a Node of type Text, Comment, or CDataSection, then endOffset is the number of characters from the start of endNode. For other Node types, endOffset is the number of child nodes between the start of the endNode. Example const
range = document.create
Range(); const endNode = document.getElementsByTagName('p').item(3); const endOffset = endNode.childNodes.length;
range.setEnd(endNode, endOffset); setEnd() is commonly used in conjunction with setStart() to fully configure a
range. Specifications Specification Status Comment DOMThe definition of '
Range.setEnd()' in that specification. Living Stan...
...item(3); const endOffset = endNode.childNodes.length;
range.setEnd(endNode, endOffset); setEnd() is commonly used in conjunction with setStart() to fully configure a
range. Specifications Specification Status Comment DOMThe definition of '
Range.setEnd()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.setEnd()' in that specification. Obsolete Initial specification. ...
Range.surroundContents() - Web APIs
The
Range.surroundContents() method moves content of the
Range into a new node, placing the new node at the start of the specified
range. This method is nearly equivalent to newNode.appendChild(
range.extractContents());
range.insertNode(newNode). After surrounding, the boundary points of the
range include newNode. An exception will be thrown, however, if the
Range splits a non-Text node with only one of its boundary points. That is, unlike the alternative above, if there are partially selected nodes, they will not be cloned and instead the operation will fail. Syntax
range.surroundContents(newParent); Parameters newParent A Node with which to surround the contents. ...
...a non-Text node with only one of its boundary points. That is, unlike the alternative above, if there are partially selected nodes, they will not be cloned and instead the operation will fail. Syntax
range.surroundContents(newParent); Parameters newParent A Node with which to surround the contents. Example HTML <span class="header-text">Put this in a headline</span> JavaScript const
range = document.create
Range(); const newParent = document.createElement('h1');
range.selectNode(document.querySelector('.header-text'));
range.surroundContents(newParent); Result Specifications Specification Status Comment DOMThe definition of '
Range.surroundContents()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Tr...
... Obsolete Initial specification. ...
...ent.createElement('h1');
range.selectNode(document.querySelector('.header-text'));
range.surroundContents(newParent); Result Specifications Specification Status Comment DOMThe definition of '
Range.surroundContents()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.surroundContents()' in that specification. Obsolete Initial specification. ...
WebGLRenderingContext.depthRange() - Web APIs
The WebGLRenderingContext.depth
Range() method of the WebGL API specifies the depth
range mapping from normalized device coordinates to window or viewport coordinates. Syntax void gl.depth
Range(zNear, zFar); Parameters zNear A GLclampf specifying the mapping of the near clipping plane to window or viewport coordinates. Clamped to the
range 0 to 1 and must be less than or equal to zFar. The default value is 0. zFar A GLclampf specifying the mapping of the far clipping plane to window or viewport coordinates. Clamped to the
range 0 to 1. The default value is 1. Return value None. ...
...eters zNear A GLclampf specifying the mapping of the near clipping plane to window or viewport coordinates. Clamped to the
range 0 to 1 and must be less than or equal to zFar. The default value is 0. zFar A GLclampf specifying the mapping of the far clipping plane to window or viewport coordinates. Clamped to the
range 0 to 1. The default value is 1. Return value None. Examples gl.depth
Range(0.2, 0.6); To check the current depth
range, query the DEPTH_
RANGE constant which returns a Float32Array gl.getParameter(gl.DEPTH_
RANGE); // Float32Array[0.2, 0.6] Specifications Specification Status Comment WebGL 1.0The definition of 'depth
Range' in that specification. Recommendation Initial definition. Unlike OpenGL, WebGL requires zNear and zFar values to be...
...Additionally, zNear must be less than or equal to zFar. OpenGL ES 2.0The definition of 'glDepth
Rangef' in that specification. ...
...
RANGE); // Float32Array[0.2, 0.6] Specifications Specification Status Comment WebGL 1.0The definition of 'depth
Range' in that specification. Recommendation Initial definition. Unlike OpenGL, WebGL requires zNear and zFar values to be clamped to the
range 0 to 1. Additionally, zNear must be less than or equal to zFar. OpenGL ES 2.0The definition of 'glDepth
Rangef' in that specification. Standard Man page of the OpenGL API. ...
:in-range - CSS: Cascading Style Sheets
The :in-
range CSS pseudo-class represents an <input> element whose current value is within the
range limits specified by the min and max attributes. /* Selects any <input>, but only when it has a
range specified, and its value is inside that
range */ input:in-
range { background-color: rgba(0, 255, 0, 0.25); } This pseudo-class is useful for giving the user a visual indication that a field's current value is within the permitted limits. Note: This pseudo-class only applies to elements that have (and can take) a
range limitation. In the absence of such a limitation, the element can neither be "in-
range" nor "out-of-
range." Syntax :in-
range Examples HTML <form action="" id="form1"> <ul>Values between 1 and 10 are valid. <li> <input id="value1" name="value1" type="number"...
...." Syntax :in-
range Examples HTML <form action="" id="form1"> <ul>Values between 1 and 10 are valid. ...
... <ul>Values between 1 and 10 are valid. ...
..." type="number" placeholder="1 to 10" min="1" max="10" value="12"> <label for="value1">Your value is </label> </li> </ul> </form> CSS li { list-style: none; margin-bottom: 1em; } input { border: 1px solid black; } input:in-
range { background-color: rgba(0, 255, 0, 0.25); } input:out-of-
range { background-color: rgba(255, 0, 0, 0.25); border: 2px solid red; } input:in-
range + label::after { content: 'okay.'; } input:out-of-
range + label::after { content: 'out of
range!'; } Result Specifications Specification Status Comment HTML Living StandardThe definition of ':in-
range' in that specification. Living Standard Defines when :in-
range matches elements in HTML. Selectors Level 4The definition of ':in-
range' in that ...
unicode-range - CSS: Cascading Style Sheets
The unicode-
range CSS descriptor sets the specific
range of characters to be used from a font defined by @font-face and made available for use on the current page. If the page doesn't use any character in this
range, the font is not downloaded; if it uses at least one, the whole font is downloaded. Syntax /* <unicode-
range> values */ unicode-
range: U+26; /* single codepoint */ unicode-
range: U+0-7F; unicode-
range: U+0025-00FF; /* codepoint
range */ unicode-
range: U+4??; /* wildcard
range */ unicode-
range: U+0025-00FF, U+4??; /* multiple values */ Values single codepoint A single Unicode character code point, for example U+26. codepoint
range A
range of Unicode code points. ...
...nt */ unicode-
range: U+0-7F; unicode-
range: U+0025-00FF; /* codepoint
range */ unicode-
range: U+4??; /* wildcard
range */ unicode-
range: U+0025-00FF, U+4??; /* multiple values */ Values single codepoint A single Unicode character code point, for example U+26. codepoint
range A
range of Unicode code points. So for example, U+0025-00FF means include all characters in the
range U+0025 to U+00FF. wildcard
range A
range of Unicode code points containing wildcard characters, that is using the '?' character, so for example U+4?? means include all characters in the
range U+400 to U+4FF. Description The purpose of this descriptor is to allow the font resources to be segmented so that a browser only needs to download the font resource needed for the text content of a part...
... particular page. For example, a site with many localizations could provide separate font resources for English, Greek and Japanese. For users viewing the English version of a page, the font resources for Greek and Japanese fonts wouldn't need to be downloaded, saving bandwidth. Formal definition Related at-rule@font-faceInitial valueU+0-10FFFFComputed valueas specified Formal syntax <unicode-
range># Examples Using a different font for a single character In this example we create a simple HTML containing a single <div> element, including an ampersand, that we want to style with a different font. To make it obvious, we will use a sans-serif font, Helvetica, for the text, and a serif font, Times New Roman, for the ampersand. In the CSS we are in effect defining a completely separate @font...
...ate @font-face that only includes a single character in it, meaning that only this character will be styled with this font. We could also have done this by wrapping the ampersand in a <span> and applying a different font just to that, but that is an extra element and rule set. HTML <div>Me & You = Us</div> CSS @font-face { font-family: 'Ampersand'; src: local('Times New Roman'); unicode-
range: U+26; } div { font-size: 4em; font-family: Ampersand, Helvetica, sans-serif; } Result Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'unicode-
range' in that specification. Candidate Recommendation Initial definition ...
Accept-Ranges - HTTP
The Accept-
Ranges response HTTP header is a marker used by the server to advertise its support of partial requests. The value of this field indicates the unit that can be used to define a
range. In presence of an Accept-
Ranges header, the browser may try to resume an interrupted download, rather than to start it from the start again. Header type Response header Forbidden header name no Syntax Accept-
Ranges: <
range-unit> Accept-
Ranges: none Directives <
range-unit> Defines the
range unit the server supports. Though bytes is the only
range unit formally defined by RFC 7233, additional
range units may be registered in the HTTP
Range Unit Registry. none No
range unit is supported, this makes the header equivalent of its own absence and is therefore rarely u...
...erver supports. Though bytes is the only
range unit formally defined by RFC 7233, additional
range units may be registered in the HTTP
Range Unit Registry. none No
range unit is supported, this makes the header equivalent of its own absence and is therefore rarely used, though some browsers, like IE9, it is used to disable or remove the pause buttons in the download manager. ...
...y be registered in the HTTP
Range Unit Registry. none No
range unit is supported, this makes the header equivalent of its own absence and is therefore rarely used, though some browsers, like IE9, it is used to disable or remove the pause buttons in the download manager. ...
... none No
range unit is supported, this makes the header equivalent of its own absence and is therefore rarely used, though some browsers, like IE9, it is used to disable or remove the pause buttons in the download manager. Examples Accept-
Ranges: bytes Specifications Specification Title RFC 7233, section 2.3: Accept-
Ranges Hypertext Transfer Protocol (HTTP/1.1):
Range Requests ...
Content-Range - HTTP
The Content-
Range response HTTP header indicates where in a full body message a partial message belongs. Header type Response header Forbidden header name no CORS-safelisted response-header no Syntax Content-
Range: <unit> <
range-start>-<
range-end>/<size> Content-
Range: <unit> <
range-start>-<
range-end>/* Content-
Range: <unit> */<size> Directives <unit> The unit in which
ranges are specified. This is usually bytes. <
range-start> An integer in the given unit indicating the beginning of the request
range. <
range-end> An integer in the given unit indicating the end of the requested
range. <size> The total size of the document (or '*' if unknown). ...
...start>-<
range-end>/* Content-
Range: <unit> */<size> Directives <unit> The unit in which
ranges are specified. This is usually bytes. <
range-start> An integer in the given unit indicating the beginning of the request
range. <
range-end> An integer in the given unit indicating the end of the requested
range. <size> The total size of the document (or '*' if unknown). ...
...s is usually bytes. <
range-start> An integer in the given unit indicating the beginning of the request
range. ...
... in the given unit indicating the beginning of the request
range. <
range-end> An integer in the given unit indicating the end of the requested
range. ...
Range - HTTP
The
Range HTTP request header indicates the part of a document that the server should return. Several parts can be requested with one
Range header at once, and the server may send back these
ranges in a multipart document. If the server sends back
ranges, it uses the 206 Partial Content for the response. If the
ranges are invalid, the server returns the 416
Range Not Satisfiable error. The server can also ignore the
Range header and return the whole document with a 200 status code. ...
... back these
ranges in a multipart document. If the server sends back
ranges, it uses the 206 Partial Content for the response. If the
ranges are invalid, the server returns the 416
Range Not Satisfiable error. The server can also ignore the
Range header and return the whole document with a 200 status code. Header type Request header Forbidden header name no Syntax
Range: <unit>=<
range-start>-
Range: <unit>=<
range-start>-<
range-end>
Range: <unit>=<
range-start>-<
range-end>, <
range-start>-<
range-end>
Range: <unit>=<
range-start>-<
range-end>, <
range-start>-<
range-end>, <
range-start>-<
range-end>
Range: <unit>=-<suffix-length> Directives <unit> The unit in which
ranges are specified. This is usually bytes. <
range-start> An integer in the given unit indicating...
... <unit>=<
range-start>-<
range-end>
Range: <unit>=<
range-start>-<
range-end>, <
range-start>-<
range-end>
Range: <unit>=<
range-start>-<
range-end>, <
range-start>-<
range-end>, <
range-start>-<
range-end>
Range: <unit>=-<suffix-length> Directives <unit> The unit in which
ranges are specified. This is usually bytes. <
range-start> An integer in the given unit indicating the beginning of the request
range. <
range-end> An integer in the given unit indicating the end of the requested
range. This value is optional and, if omitted, the end of the document is taken as the end of the
range. <suffix-length> An integer in the given unit indicating the number of units at the end of the file to return. Examples Requesting three
ranges from the file.
Range: bytes=200-1000, 2000-6576, 19000- Request...
...is optional and, if omitted, the end of the document is taken as the end of the
range. <suffix-length> An integer in the given unit indicating the number of units at the end of the file to return. Examples Requesting three
ranges from the file.
Range: bytes=200-1000, 2000-6576, 19000- Requesting the first 500 and last 500 bytes of the file. The request may be rejected by the server if the
ranges overlap.
Range: bytes=0-499, -500 Specifications Specification Title RFC 7233, section 3.1:
Range Hypertext Transfer Protocol (HTTP/1.1):
Range Requests ...
RangeError: repeat count must be less than infinity - JavaScript
It has a count parameter indicating the number of times to repeat the string. It must be between 0 and less than positive Infinity and cannot be a negative number. ...
... The JavaScript exception "repeat count must be less than infinity" occurs when the String.prototype.repeat() method is used with a count argument that is infinity. Message
RangeError: argument out of
range (Edge)
RangeError: repeat count must be less than infinity and not overflow maximum string size (Firefox)
RangeError: Invalid count value (Chrome) Error type
RangeError What went wrong? The String.prototype.repeat() method has been used. It has a count parameter indicating the number of times to repeat the string. It must be between 0 and less than positive Infinity and cannot be a negative number. The
range of allowed values can be described like this: [0, +?). The resulting string can also not be larger than the maximum string size, which can differ in JavaScript engines. In Firefo...
...string. It must be between 0 and less than positive Infinity and cannot be a negative number. The
range of allowed values can be described like this: [0, +?). ...
...than positive Infinity and cannot be a negative number. The
range of allowed values can be described like this: [0, +?). ...
Intl.DateTimeFormat.prototype.formatRange() - JavaScript
The Intl.DateTimeFormat.prototype.format
Range() formats a date
range in the most concise way based on the locale and options provided when instantiating Intl.DateTimeFormat object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.DateTimeFormat.prototype.format
Range(startDate, endDate) Examples Basic format
Range usage This method receives two Dates and formats the date
range in the most concise way based on the locale and options provided when instantiating Intl.DateTimeFormat. let date1 = new Date(Date.UTC(2007, 0, 10, 10, 0, 0)); let date2 = new Date(Date.UTC(2007, 0, 10, 11, 0, 0)); let date3 = new...
...007, 0, 10, 11, 0, 0)); let date3 = new Date(Date.UTC(2007, 0, 20, 10, 0, 0)); // > 'Wed, 10 Jan 2007 10:00:00 GMT' // > 'Wed, 10 Jan 2007 11:00:00 GMT' // > 'Sat, 20 Jan 2007 10:00:00 GMT' let fmt1 = new Intl.DateTimeFormat("en", { year: '2-digit', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' }); console.log(fmt1.format(date1)); console.log(fmt1.format
Range(date1, date2)); console.log(fmt1.format
Range(date1, date3)); // > '1/10/07, 10:00 AM' // > '1/10/07, 10:00 - 11:00 AM' // > '1/10/07, 10:00 AM - 1/20/07, 10:00 AM' let fmt2 = new Intl.DateTimeFormat("en", { year: 'numeric', month: 'short', day: 'numeric' }); console.log(fmt2.format(date1)); console.log(fmt2.format
Range(date1, date2)); console.log(fmt2.format
Range(date1, date3)); // >...
... ...
... ...
RangeError() constructor - JavaScript
The
RangeError() constructor creates an error when a value is not in the set or
range of allowed values. Syntax new
RangeError([message[, fileName[, lineNumber]]]) Parameters message Optional Human-readable description of the error. ...
...uctor creates an error when a value is not in the set or
range of allowed values. Syntax new
RangeError([message[, fileName[, lineNumber]]]) Parameters message Optional Human-readable description of the error. ...
...ge[, fileName[, lineNumber]]]) Parameters message Optional Human-readable description of the error. ...
...name of the file containing the code that caused the exception lineNumber Optional The line number of the code that caused the exception Examples Using
RangeError (for numeric values) function check(n) { if( !(n >= -500 && n <= 500) ) { throw new
RangeError("The argument must be between -500 and 500.") } } try { check(2000) } catch(error) { if (error instanceof
RangeError) { // Handle the error } } Using
RangeError (for non-numeric values) function check(value) { if(["apple", "banana", "carrot"].includes(value) === false) { throw new
RangeError('The argument must be an "apple", "banana", or "carrot".') } } try { check("cabbage") } catch(error) { if(error instanceof
RangeError) { // Handle the error ...
NPByteRange - Archive of obsolete content
This value may be either positive or negative: Positive value: Offset from the beginning of the stream. Negative value: Offset from the end of the stream. length Number of bytes to fetch from the specified offset. ...
... << Gecko Plugin API Reference << Plug-in Side Plug-in API Summary Represents a particular
range of bytes from a stream. Syntax typedef struct _NPByte
Range { int32 offset; /* negative offset = from the end */ uint32 length; struct _NPByte
Range* next; } NPByte
Range; Fields The data structure has the following fields: offset Offset in bytes to the start of the requested
range. This value may be either positive or negative: Positive value: Offset from the beginning of the stream. Negative value: Offset from the end of the stream. length Number of bytes to fetch from the specified offset. next Points to the next NPByte
Range request in the list of requests, or null if this is the last request. Description The plug-in seeks within a stream by building a linked list of ...
...ither positive or negative: Positive value: Offset from the beginning of the stream. Negative value: Offset from the end of the stream. length Number of bytes to fetch from the specified offset. next Points to the next NPByte
Range request in the list of requests, or null if this is the last request. Description The plug-in seeks within a stream by building a linked list of one or more NPByte
Range objects, which represents a set of discontiguous byte
ranges. The only plug-in API call that uses the NPByte
Range type is NPN_RequestRead(), which lets the plug-in read specified parts of a file without downloading it. The plug-in is responsible for deleting NPByte
Range objects when finished with them. The browser makes a copy if it needs to keep the objects beyond the call to NPN_RequestRead(). ...
XForms Range Element - Archive of obsolete content
Introduction Allows the user to choose a value from within a specific
range of values (see the spec). Attributes UI Common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special incremental - supported, default value is false start - lower bound of possible values end - upper bound of possible values step - is used for incrementing/decrementing values Start/end/step attributes If the value of the bound instance node is outside the
range of values specified by the start and end attributes, then the
range element receives a xforms-out-of-
range event. If the bound value then becomes in
range, the
range element receives a xforms-in-
range event. start Specifies the lower bound of possible values, i.e.
...n't be less than the value of this attribute. If this attribute is omitted, then it is assumed to be 0. end Specifies the upper bound of possible values, i.e. values can't be greater than the value of this attribute. If this attribute is omitted, then it is assumed to be the value of start + 20. step Specifies the step of incrementing/decrementing values. This determines how much the value of the
range will be changed upon user interaction. If this attribute is omitted, then it is assumed to be the value of end - start / 20. Type restrictions The
range element can be bound to a node of type xsd:duration, xsd:date, xsd:time, xsd:dateTime, xsd:gYearMonth, xsd:gYear, xsd:gMonthDay, xsd:gDay, xsd:gMonth, xsd:float, xsd:decimal or xsd:double or any type derived from one of these. Representation...
...ed upon user interaction. If this attribute is omitted, then it is assumed to be the value of end - start / 20. Type restrictions The
range element can be bound to a node of type xsd:duration, xsd:date, xsd:time, xsd:dateTime, xsd:gYearMonth, xsd:gYear, xsd:gMonthDay, xsd:gDay, xsd:gMonth, xsd:float, xsd:decimal or xsd:double or any type derived from one of these. Representations The XForms
range element is represented by a slider widget (xhtml only). Characteristics analogous widget is <xul:scale/>, which is available in Fx 3.0 only if the incremental attribute has the value true, the value of the bound node will be updated upon each movement of the slider's thumb. ...
NS_CStringSetDataRange
aCutStart [in] The starting index of the section to replace, measured in storage units. aCutLength [in] The length of the section to replace, measured in storage units. aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. ...
...e, measured in storage units. aCutLength [in] The length of the section to replace, measured in storage units. aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_CStringSetData
Range function returns NS_OK if successful. Otherwise, it returns an error code. Example // Replace all occurances of |matchVal| with |newVal| void ReplaceSubstring(nsACString& str, const nsACString& matchVal, const nsACString& newVal) { const char* sp, *mp, *np; PRUint32 sl, ml, nl; sl = NS_CStringGetData(str, &sp); ml = NS_CStringGetData(matchV...
...See bug 239123 for details. See Also nsACString ...
NS_StringSetDataRange
aCutStart [in] The starting index of the section to replace, measured in storage units. aCutLength [in] The length of the section to replace, measured in storage units. aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. ...
...to replace, measured in storage units. aCutLength [in] The length of the section to replace, measured in storage units. aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_StringSetData
Range function returns NS_OK if successful. Otherwise, it returns an error code. Example Code // Replace all occurances of |matchVal| with |newVal| void ReplaceSubstring(nsAString& str, const nsAString& matchVal, const nsAString& newVal) { const PRUnichar* sp, *mp, *np; PRUint32 sl, ml, nl; sl = NS_StringGetData(str, &sp); ml = NS...
...See bug 239123 for details. See Also nsAString ...
Range.collapse() - Web APIs
The
Range.collapse() method collapses the
Range to one of its boundary points. A collapsed
Range is empty, containing no content, specifying a single-point in a DOM tree. To determine if a
Range is already collapsed, see the
Range.collapsed property. Syntax
range.collapse(toStart); Parameters toStart Optional A Boolean value: true collapses the
Range to its start, false to its end. If omitted, it defaults to false . Example var
range = document.create
Range(); referenceNode = document.getElementsByTagName("div").item(0);
range.selectNode(referenceNode);
range.collapse(true); Specifications Specification Status Comment DOMThe definition of '
Range.collapse()' in that specification. Living Standard The parameter is now optional and default to false. ...
... Obsolete Initial specification. ...
...nt.getElementsByTagName("div").item(0);
range.selectNode(referenceNode);
range.collapse(true); Specifications Specification Status Comment DOMThe definition of '
Range.collapse()' in that specification. Living Standard The parameter is now optional and default to false. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.collapse()' in that specification. Obsolete Initial specification. ...
Range.detach() - Web APIs
Obsolete Initial specification. ...
... Obsolete Initial specification. ...
... The
Range.detach() method does nothing. It used to disable the
Range object and enable the browser to release associated resources. The method has been kept for compatibility. Syntax
range.detach(); Example var
range = document.create
Range();
range.selectNode(document.getElementsByTagName("div").item(0));
range.detach(); Specifications Specification Status Comment DOMThe definition of '
Range.detach()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.detach()' in that specification. Obsolete Initial specification. ...
Range.endOffset - Web APIs
The
Range.endOffset read-only property returns a number representing where in the
Range.endContainer the
Range ends. If the endContainer is a Node of type Text, Comment, or CDATASection, then the offset is the number of characters from the start of the endContainer to the boundary point of the
Range. For other Node types, the endOffset is the number of child nodes between the start of the endContainer and the boundary point of the
Range. This property is read-only. To change the endOffset of a
Range, use one of the
Range.setEnd methods. ...
...Text, Comment, or CDATASection, then the offset is the number of characters from the start of the endContainer to the boundary point of the
Range. For other Node types, the endOffset is the number of child nodes between the start of the endContainer and the boundary point of the
Range. This property is read-only. To change the endOffset of a
Range, use one of the
Range.setEnd methods. Syntax end
RangeOffset =
range.endOffset; Example var
range = document.create
Range();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset); end
RangeOffset =
range.endOffset; Specifications Specification Status Comment DOMThe definition of '
Range.endOffset' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal ...
...et =
range.endOffset; Example var
range = document.create
Range();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset); end
RangeOffset =
range.endOffset; Specifications Specification Status Comment DOMThe definition of '
Range.endOffset' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.endOffset' in that specification. Obsolete Initial specification. ...
Range.startOffset - Web APIs
The
Range.startOffset read-only property returns a number representing where in the startContainer the
Range starts. If the startContainer is a Node of type Text, Comment, or CDATASection, then the offset is the number of characters from the start of the startContainer to the boundary point of the
Range. For other Node types, the startOffset is the number of child nodes between the start of the startContainer and the boundary point of the
Range. To change the startOffset of a
Range, use the
Range.setStart method. ...
...iner is a Node of type Text, Comment, or CDATASection, then the offset is the number of characters from the start of the startContainer to the boundary point of the
Range. For other Node types, the startOffset is the number of child nodes between the start of the startContainer and the boundary point of the
Range. To change the startOffset of a
Range, use the
Range.setStart method. Syntax start
RangeOffset =
range.startOffset; Example var
range = document.create
Range();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset); var start
RangeOffset =
range.startOffset; Specifications Specification Status Comment DOMThe definition of '
Range.startOffset' in that specification. Living Standard No change. Document Object Model (DOM) Level ...
...tartOffset; Example var
range = document.create
Range();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset); var start
RangeOffset =
range.startOffset; Specifications Specification Status Comment DOMThe definition of '
Range.startOffset' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.startOffset' in that specification. Obsolete Initial specification. ...
Range.toString() - Web APIs
The
Range.toString() method is a stringifier returning the text of the
Range. Alerting the contents of a
Range makes an implicit toString() call, so comparing
range and text through an alert dialog is ineffective. Syntax text =
range.toString(); Example HTML <p>This example logs <b>everything</b> between the bold <b>words</b>. Look at the output below.</p> <p id="log"></p> JavaScript const
range = document.create
Range();
range.setStartBefore(document.getElementsByTagName('b').item(0), 0);
range.setEndAfter(document.getElementsByTagName('b').item(1), 0); document.getElementById('log').textContent =
range.toString(); Result Specifications Specification Status Comment DOMThe definition of '
Range.toString()' in that specification. Living Standard No chan...
... Obsolete Initial specification. ...
... Obsolete Initial specification. ...
Selection.removeAllRanges() - Web APIs
Working Draft Current Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... Working Draft Current Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...nt Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
Selection.removeRange() - Web APIs
Working Draft Current Browser compatibility The compatibility table on this page is generated from structured data. ...
... The Selection.remove
Range() method removes a
range from a selection. Syntax sel.remove
Range(
range) Parameters
range A
range object that will be removed to the selection. Return value undefined Examples /* Programmaticaly, more than one
range can be selected. * This will remove all
ranges except the first. */ s = window.getSelection(); if(s.
rangeCount > 1) { for(var i = 1; i < s.
rangeCount; i++) { s.remove
Range(s.get
RangeAt(i)); } } Specifications Specification Status Comment Selection APIThe definition of 'Selection.remove
Range()' in that specification. Working Draft Current Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check o...
...rrent Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
416 Range Not Satisfiable - HTTP
The HyperText Transfer Protocol (HTTP) 416
Range Not Satisfiable error response code indicates that a server cannot serve the requested
ranges. The most likely reason is that the document doesn't contain such
ranges, or that the
Range header value, though syntactically correct, doesn't make sense. The 416 response message contains a Content-
Range indicating an unsatisfied
range (that is a '*') followed by a '/' and the current length of the resource. E.g. Content-
Range: bytes */12777 Faced with this error, browsers usually either abort the operation (for example, a download will be considered as non-resumable) or ask for the whole document again. ...
...correct, doesn't make sense. The 416 response message contains a Content-
Range indicating an unsatisfied
range (that is a '*') followed by a '/' and the current length of the resource. E.g. Content-
Range: bytes */12777 Faced with this error, browsers usually either abort the operation (for example, a download will be considered as non-resumable) or ask for the whole document again. ...
...source. E.g. Content-
Range: bytes */12777 Faced with this error, browsers usually either abort the operation (for example, a download will be considered as non-resumable) or ask for the whole document again. ...
RangeError: argument is not a valid code point - JavaScript
The JavaScript exception "Invalid code point" occurs when NaN values, negative Integers (-1), non-Integers (5.4), or values larger than 0x10FFFF (1114111) are used with String.fromCodePoint(). Message
RangeError: {0} is not a valid code point (Firefox)
RangeError: Invalid code point {0} (Chromium) Error type
RangeError What went wrong? String.fromCodePoint() throws this error when passed NaN values, negative Integers (-1), non-Integers (5.4), or values larger than 0x10FFFF (1114111). A code point is a value in the Unicode codespace; that is, the
range of integers from 0 to 0x10FFFF. Examples Invalid cases String.fromCodePoint('_'); //
RangeError String.fromCodePoint(Infinity); //
RangeError String.fromCodePoint(-1); //
RangeError String.fromCodePoint(3.14); //
RangeEr...
...ers (5.4), or values larger than 0x10FFFF (1114111). A code point is a value in the Unicode codespace; that is, the
range of integers from 0 to 0x10FFFF. ...
...4111). A code point is a value in the Unicode codespace; that is, the
range of integers from 0 to 0x10FFFF. ...
HTMLInputElement.setRangeText() - Web APIs
start Optional The 0-based index of the first character to replace. Defaults to the current selectionStart value (the start of the user's current selection). end Optional The 0-based index of the character after the last character to replace. Defaults to the current selectionEnd value (the end of the user's current selection). selectMode Optional A string defining how the selection should be set after the text has been replaced. ...
...he button in this example to replace part of the text in the text box. The newly inserted text will be highlighted (selected) afterwards. HTML <input type="text" id="text-box" size="30" value="This text has NOT been updated."> <button onclick="selectText()">Update text</button> JavaScript function selectText() { const input = document.getElementById('text-box'); input.focus(); input.set
RangeText('ALREADY', 14, 17, 'select'); } Result Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLInputElement.setSelection
Range()' in that specification. Living Standard No change HTML5The definition of 'HTMLInputElement.setSelection
Range()' in that specification. Recommendation Initial definition ...
MediaSource.setLiveSeekableRange() - Web APIs
The setLiveSeekable
Range() method of the MediaSource interface sets the
range that the user can seek to in the media element. Syntax mediaSource.setLiveSeekable
Range(start, end) Parameters start The start of the seekable
range to set in seconds measured from the beginning of the source. If the duration of the media source is positive infinity, then the Time
Ranges object returned by the HTMLMediaElement.seekable property will have a start timestamp no greater than this value. end The end of the seekable
range to set in seconds measured from the beginning of the source. If the duration of the media source is positive infinity, then the Time
Ranges object returned by the HTMLMediaElement.seekable property will have an end timestamp no less than this value. Return value undefined Exa...
...easured from the beginning of the source. If the duration of the media source is positive infinity, then the Time
Ranges object returned by the HTMLMediaElement.seekable property will have an end timestamp no less than this value. Return value undefined Example // TBD Specifications Specification Status Comment Media Source ExtensionsThe definition of 'setLiveSeekable
Range()' in that specification. Recommendation Initial definition. ...
Range.comparePoint() - Web APIs
The
Range.comparePoint() method returns -1, 0, or 1 depending on whether the referenceNode is before, the same as, or after the
Range. If the reference node is a Node of type Text, Comment, or CDATASection, then offset is the number of characters from the start of reference node. For other Node types, offset is the number of child nodes between the start of the reference node. Syntax returnValue =
range.comparePoint(referenceNode, offset) Parameters referenceNode The Node to compare with the
Range. offset An integer greater than or equal to zero representing the offset inside the referenceNode. ...
...he number of characters from the start of reference node. For other Node types, offset is the number of child nodes between the start of the reference node. Syntax returnValue =
range.comparePoint(referenceNode, offset) Parameters referenceNode The Node to compare with the
Range. offset An integer greater than or equal to zero representing the offset inside the referenceNode. Example
range = document.create
Range();
range.selectNode(document.getElementsByTagName('div').item(0)); returnValue =
range.comparePoint(document.getElementsByTagName('p').item(0), 1); Specification Specification Status Comment DOMThe definition of '
Range.comparePoint()' in that specification. Living Standard Initial specification. ...
Range.getClientRects() - Web APIs
Working Draft Initial specification. ...
... The
Range.getClientRects() method returns a list of DOMRect objects representing the area of the screen occupied by the
range. This is created by aggregating the results of calls to Element.getClientRects() for all the elements in the
range. Syntax rectList =
range.getClientRects() Example
range = document.create
Range();
range.selectNode(document.getElementsByTagName("div").item(0)); rectList =
range.getClientRects(); Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of '
Range.getClientRects()' in that specification. Working Draft Initial specification. ...
Selection.addRange() - Web APIs
The Selection.add
Range() method adds a
Range to a Selection. Syntax selection.add
Range(
range); Parameters
range A
Range object that will be added to the Selection. Example Currently only Firefox supports multiple selection
ranges, other browsers will not add new
ranges to the selection if it already contains one. ...
...t already contains one. HTML <p>I <strong>insist</strong> that you <strong>try</strong> selecting the <strong>strong words</strong>.</p> <button>Select strong words</button> JavaScript let button = document.querySelector('button'); button.addEventListener('click', function () { let selection = window.getSelection(); let strongs = document.getElementsByTagName('strong'); if (selection.
rangeCount > 0) { selection.removeAll
Ranges(); } for (let i = 0; i < strongs.length; i++) { let
range = document.create
Range();
range.selectNode(strongs[i]); selection.add
Range(
range); } }); Result Specifications Specification Status Comment Selection APIThe definition of 'Selection.add
Range()' in that specification. Working Draft Current ...
Selection.rangeCount - Web APIs
The Selection.
rangeCount read-only property returns the number of
ranges in the selection. Before the user has clicked a freshly loaded page, the
rangeCount is 0. After the user clicks on the page,
rangeCount is 1, even if no selection is visible. A user can normally only select one
range at a time, so the
rangeCount will usually be 1. Scripting can be used to make the selection contain more than one
range. Gecko browsers allow multiple selections across table cells. Firefox allows to select multiple
ranges in the document by using Ctrl+click (unless the click within an element with display: table-cell). Syntax value = sel.
rangeCount Example The following example will show the
rangeCount every second. Select text in the browser to see it change. HTML <table> <tr><td>a...
...cument by using Ctrl+click (unless the click within an element with display: table-cell). Syntax value = sel.
rangeCount Example The following example will show the
rangeCount every second. Select text in the browser to see it change. HTML <table> <tr><td>a.1<td>a.2 <tr><td>b.1<td>b.2 <tr><td>c.1<td>c.2 JavaScript window.setInterval(function () { console.log(window.getSelection().
rangeCount); }, 1000); Result Open your console to see how many
ranges are in the selection. In Gecko browsers, you can select multiple
ranges across table cells by holding down Ctrl while dragging with the mouse. Specifications Specification Status Comment Selection APIThe definition of 'Selection.
rangeCount' in that specification. Working Draft Current ...
TimeRanges.end() - Web APIs
Returns the time offset at which a specified time
range ends. Syntax endTime = Time
Ranges.end(index) Parameters index is the
range number to return the ending time for. Exceptions INDEX_SIZE_ERR A DOMException thrown if the specified index doesn't correspond to an existing
range. Example Given a video element with the ID "myVideo": var v = document.getElementById("myVideo"); var buf = v.buffered; var num
Ranges = buf.length; if (buf.length == 1) { // only one
range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // The one
range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } This example looks at the time
ranges and looks to see if the entire video has been loaded. Specifications Specification ...
... Living Standard Initial definition ...
TimeRanges.start() - Web APIs
Returns the time offset at which a specified time
range begins. Syntax startTime = Time
Ranges.start(index) Parameters index is the
range number to return the starting time for. Exceptions INDEX_SIZE_ERR A DOMException thrown if the specified index doesn't correspond to an existing
range. Example Given a video element with the ID "myVideo": var v = document.getElementById("myVideo"); var buf = v.buffered; var num
Ranges = buf.length; if (buf.length == 1) { // only one
range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // The one
range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } This example looks at the time
ranges and looks to see if the entire video has been loaded. Specifications Specifica...
... Living Standard Initial definition ...
TimeRanges - Web APIs
The Time
Ranges interface is used to represent a set of time
ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the <audio> and <video> elements. A Time
Ranges object includes one or more
ranges of time, each specified by a starting and ending time offset. You reference each time
range by using the start() and end() methods, passing the index number of the time
range you want to retrieve. The term "normalized Time
Ranges object" indicates that
ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent
ranges are folded into one bigger
range). Properties Time
Ranges.length Read only Returns an unsigned long representing the number of time
ranges represented by the time
range object. Methods ...
...mber of the time
range you want to retrieve. The term "normalized Time
Ranges object" indicates that
ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent
ranges are folded into one bigger
range). Properties Time
Ranges.length Read only Returns an unsigned long representing the number of time
ranges represented by the time
range object. Methods Time
Ranges.start() Returns the time for the start of the
range with the specified index. Time
Ranges.end() Returns the time for the end of the specified
range. Specifications Specification Status Comment HTML Living StandardThe definition of 'Time
Ranges' in that specification. Living Standard Initial definition ...
ULongRange - Web APIs
The ULong
Range dictionary is used to define a
range of permitted integer values for a property, with either or both a maximum and minimum value specified. The ConstrainULong
Range dictionary is based on this, augmenting it to support exact and ideal values as well. Properties max A numeric value in the
range of signed 32-bit integers, specifying the largest permissible value of the property it describes. min A numeric value in the
range of signed 32-bit integers, specifying the smallest permissible value of the property it describes. The specified min and/or and max values are required. If no match can be found that is within the given
range, an error will occur. ...
...t describes. min A numeric value in the
range of signed 32-bit integers, specifying the smallest permissible value of the property it describes. The specified min and/or and max values are required. If no match can be found that is within the given
range, an error will occur. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'ULong
Range' in that specification. Candidate Recommendation Initial definition ...
ValidityState.rangeOverflow - Web APIs
The read-only
rangeOverflow property of a ValidityState object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's max attribute. If the field is numeric in nature, including the date, month, week, time, datetime-local, number and
range types and a max value is set, if the value don't doesn't conform to the constraints set by the max value, the
rangeOverflow property will be true. Given the following: <input type="number" min="20" max="40" step="2"/> if value > 40,
rangeOverflow will be true. When true, the element matches the :invalid and :out-of-
range CSS pseudo-classes. ...
...he constraints set by the max value, the
rangeOverflow property will be true. Given the following: <input type="number" min="20" max="40" step="2"/> if value > 40,
rangeOverflow will be true. When true, the element matches the :invalid and :out-of-
range CSS pseudo-classes. Specifications Specification Status Comment HTML Living StandardThe definition of 'ValidityState.
rangeOverflow' in that specification. Living Standard HTML 5.1The definition of 'ValidityState.
rangeOverflow' in that specification. Recommendation HTML5The definition of 'ValidityState.
rangeOverflow' in that specification. Recommendation ...
ValidityState.rangeUnderflow - Web APIs
The read-only
rangeUnderflow property of a ValidityState object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's min attribute. If the field is numeric in nature, including the date, month, week, time, datetime-local, number and
range types and a min value is set, if the value don't doesn't conform to the constraints set by the min value, the
rangeUnderflow property will be true. Given the following: <input type="number" min="20" max="40" step="2"/> if value < 20,
rangeUnderflow will be true. When true, the element matches the :invalid and :out-of-
range CSS pseudo-classes. ...
... constraints set by the min value, the
rangeUnderflow property will be true. Given the following: <input type="number" min="20" max="40" step="2"/> if value < 20,
rangeUnderflow will be true. When true, the element matches the :invalid and :out-of-
range CSS pseudo-classes. Specifications Specification Status Comment HTML Living StandardThe definition of 'ValidityState.
rangeUnderflow' in that specification. Living Standard HTML 5.1The definition of 'ValidityState.
rangeUnderflow' in that specification. Recommendation HTML5The definition of 'ValidityState.
rangeUnderflow' in that specification. Recommendation ...
WebGL2RenderingContext.bindBufferRange() - Web APIs
The WebGL2RenderingContext.bindBuffer
Range() method of the WebGL 2 API binds a
range of a given WebGLBuffer to a given binding point (target) at a given index. Syntax void gl.bindBuffer
Range(target, index, buffer, offset, size); Parameters target A Glenum specifying the target for the bind operation. Possible values: gl.TRANSFORM_FEEDBACK_BUFFER gl.UNIFORM_BUFFER index A GLuint specifying the index of the target. buffer A WebGLBuffer which to bind to the binding point (target). offset A GLintptr specifying the starting offset. size A GLsizeiptr specifying the amount of data that can be read from the buffer. Return value None. ...
...or the bind operation. Possible values: gl.TRANSFORM_FEEDBACK_BUFFER gl.UNIFORM_BUFFER index A GLuint specifying the index of the target. buffer A WebGLBuffer which to bind to the binding point (target). offset A GLintptr specifying the starting offset. size A GLsizeiptr specifying the amount of data that can be read from the buffer. Return value None. Examples gl.bindBuffer
Range(gl.TRANSFORM_FEEDBACK_BUFFER, 1, buffer, 0, 4); Specifications Specification Status Comment WebGL 2.0The definition of 'bindBuffer
Range' in that specification. Editor's Draft Initial definition for WebGL. OpenGL ES 3.0The definition of 'glBindBuffer
Range' in that specification. Standard Man page of the (similar) OpenGL API. ...
WebGL2RenderingContext.drawRangeElements() - Web APIs
Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. start A GLuint specifying the minimum array index contained in offset. ...
...pecifying an offset in the element array buffer. Must be a valid multiple of the size of the given type. Return value None. Exceptions If mode is not one of the accepted values, a gl.INVALID_ENUM error is thrown. If offset is a valid multiple of the size of the given type, a gl.INVALID_OPERATION error is thrown. If count is negative, a gl.INVALID_VALUE error is thrown. Examples gl.draw
RangeElements(gl.POINTS, 0, 7, 8, gl.UNSIGNED_BYTE, 0); Specifications Specification Status Comment WebGL 2.0The definition of 'draw
RangeElements' in that specification. Editor's Draft Initial definition for WebGL. OpenGL ES 3.0The definition of 'glDraw
RangeElements' in that specification. Standard Man page of the (similar) OpenGL API. ...
setSelectionRange - Archive of obsolete content
<< XUL Reference home setSelection
Range( start, end ) Return type: no return value Sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
AbstractRange.collapsed - Web APIs
The collapsed read-only property of the Abstract
Range interface returns true if the
range's start position and end position are the same. Syntax var isCollpased =
range.collapsed Value A Boolean value which is true if the
range is collapsed. A collapsed
range is one in which the start and end positions are the same, resulting in a zero-character-long
range.. Specifications Specification Status Comment DOMThe definition of 'collapsed' in that specification. Living Standard Static
RangeThe definition of 'collapsed' in that specification. Editor's Draft Initial definition. ...
AbstractRange.endContainer - Web APIs
The endContainer property of the Abstract
Range interface returns the Node in which the end of the
range is located. Syntax var endNode =
range.endContainer Value The DOM Node which contains the final character of the
range. Specifications Specification Status Comment DOMThe definition of 'endContainer' in that specification. Living Standard Static
RangeThe definition of 'endContainer' in that specification. Editor's Draft Initial definition. ...
AbstractRange.endOffset - Web APIs
The endOffset property of the Abstract
Range interface returns the offset into the end node of the
range's end position. Syntax var endOffset =
range.endOffset; Value An integer value indicating the number of characters into the Node indicated by endContainer at which the final character of the
range is located. Specifications Specification Status Comment DOMThe definition of 'endOffset' in that specification. Living Standard Static
RangeThe definition of 'endOffset' in that specification. Editor's Draft Initial definition. ...
AbstractRange.startContainer - Web APIs
The read-only startContainer property of the Abstract
Range interface returns the start Node for the
range. Syntax var startNode =
range.startContainer Value The DOM Node inside which the start position of the
range is found. Specifications Specification Status Comment DOMThe definition of 'startContainer ' in that specification. Living Standard Static
RangeThe definition of 'startContainer' in that specification. Editor's Draft Initial definition. ...
AbstractRange.startOffset - Web APIs
The read-only startOffset property of the Abstract
Range interface returns the offset into the start node of the
range's start position. Syntax var startOffset =
range.startOffset Value An integer value indicating the number of characters into the Node indicated by startContainer at which the first character of the
range is located. Specifications Specification Status Comment DOMThe definition of 'startOffset' in that specification. Living Standard Static
RangeThe definition of 'startOffset' in that specification. Editor's Draft Initial definition. ...
Document.createRange() - Web APIs
The Document.create
Range() method returns a new
Range object. Syntax
range = document.create
Range();
range is the created
Range object. Example let
range = document.create
Range();
range.setStart(startNode, startOffset);
range.setEnd(endNode, endOffset); Notes Once a
Range is created, you need to set its boundary points before you can make use of most of its methods. Specifications Specification Status Comment DOMThe definition of 'document.create
Range' in that specification. Living Standard ...
DoubleRange - Web APIs
The Double
Range dictionary is used to define a
range of permitted double-precision floating-point values for a property, with either or both a maximum and minimum value specified. The ConstrainDouble dictionary is based on this, augmenting it to support exact and ideal values as well. Properties max A floating-point value specifying the largest permissible value of the property it describes. min A floating-point value specifying the smallest permissible value of the property it describes. The specified min and/or and max values are required. If no match can be found that is within the given
range, an error will occur. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'Double
Range' in that specification. Candidate Recomm...
FontFace.unicodeRange - Web APIs
The unicode
Range property of the FontFace interface retrieves or sets the
range of unicode codepoints encompassing the font. It is equivalent to the unicode-
range descriptor. Syntax var unicode
RangeDescriptor = FontFace.unicode
Range; FontFace.unicode
Range = unicode
RangeDescriptor; Value A CSSOMString containing a descriptor as it would appear in a style sheet's @font-face rule. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'unicode
Range' in that specification. Working Draft Initial definition. ...
MSRangeCollection - Web APIs
Non-standard. Do not use! This object is a Microsoft extension and is only supported in Internet Explorer. The MS
RangeCollection object is an array of one or more
Range objects. Remarks The MS
RangeCollection object does not inherit from any class or interface and does not define any members. ...
MediaSettingsRange.max - Web APIs
The max read-only property of the MediaSettings
Range interface returns the maximum value of the settings
range. Syntax var max = mediaSettings
Range.max Value A double integer. Specifications Specification Status Comment MediaStream Image CaptureThe definition of 'max' in that specification. Working Draft Initial definition. ...
MediaSettingsRange.min - Web APIs
The min read-only property of the MediaSettings
Range interface returns the minimum value of the settings
range. Syntax var min = mediaSettings
Range.min Value A double integer. Specifications Specification Status Comment MediaStream Image CaptureThe definition of 'min' in that specification. Working Draft Initial definition. ...
MediaSettingsRange.step - Web APIs
The step read-only property of the MediaSettings
Range interface returns the minimum difference between consecutive values of the settings
range. Syntax var step = mediaSettings
Range.step Value A double integer. Specifications Specification Status Comment MediaStream Image CaptureThe definition of 'step' in that specification. Working Draft Initial definition. ...
MediaSource.clearLiveSeekableRange() - Web APIs
The clearLiveSeekable
Range() method of the MediaSource interface clears a seekable
range previously set with a call to setLiveSeekable
Range(). Syntax mediaSource.clearLiveSeekable
Range() Parameters None. Return value undefined Specifications Specification Status Comment Media Source ExtensionsThe definition of 'clearLiveSeekable
Range()' in that specification. Recommendation Initial definition. ...
Range.intersectsNode() - Web APIs
The
Range.intersectsNode() method returns a boolean indicating whether the given Node intersects the
Range. Syntax bool =
range.intersectsNode( referenceNode ) Parameters referenceNode The Node to compare with the
Range. Example var
range = document.create
Range();
range.selectNode(document.getElementsByTagName("div").item(0)); var bool =
range.intersectsNode(document.getElementsByTagName("p").item(0)); Specification Specification Status Comment DOMThe definition of '
Range.intersectNode()' in that specification. Living Standard Initial definition. ...
Range.setStartBefore() - Web APIs
The
Range.setStartBefore() method sets the start position of a
Range relative to another Node. The parent Node of the start of the
Range will be the same as that for the referenceNode. Syntax
range.setStartBefore(referenceNode); Parameters referenceNode The Node before which the
Range should start. Example var
range = document.create
Range(); var referenceNode = document.getElementsByTagName("div").item(0);
range.setStartBefore(referenceNode); Specifications Specification Status Comment DOMThe definition of '
Range.setStartBefore()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of '
Range.setStartBefore()' in that specification. Obsolete Initial speci...
Selection.getRangeAt() - Web APIs
The Selection.get
RangeAt() method returns a
range object representing one of the
ranges currently selected. Syntax
range = sel.get
RangeAt(index) Parameters index The zero-based index of the
range to return. A negative number or a number greater than or equal to Selection.
rangeCount will result in an error. Return value The specified
Range object. Example let
ranges = []; sel = window.getSelection(); for(let i = 0; i < sel.
rangeCount; i++) {
ranges[i] = sel.get
RangeAt(i); } /* Each item in the
ranges array is now * a
range object representing one of the *
ranges in the current selection */ Specifications Specification Status Comment Selection APIThe definition of 'Selection: get
RangeAt()' in that specification. Working Draft Current ...
StaticRange.collapsed - Web APIs
The collapsed read-only property of the Static
Range interface returns true if the
range's start position and end position are the same. Syntax var isCollpased = static
Range.collapsed Value A Boolean value which is true if the
range is collapsed. A collapsed
range is one in which the start and end positions are the same, resulting in a zero-character-long
range.. Specifications Specification Status Comment DOMThe definition of 'collapsed' in that specification. Living Standard Static
RangeThe definition of 'collapsed' in that specification. Editor's Draft Initial definition. ...
StaticRange.endContainer - Web APIs
The endContainer property of the Static
Range interface returns the end Node for the
range. Syntax var node = staticNode.endContainer staticNode.endContainer = endContainer Value The DOM Node which contains the final character of the
range. Specifications Specification Status Comment DOMThe definition of 'endContainer' in that specification. Living Standard Static
RangeThe definition of 'endContainer' in that specification. Editor's Draft Initial definition. ...
StaticRange.endOffset - Web APIs
The endOffset property of the Static
Range interface returns the offset into the end node of the
range's end position. Syntax var endOffset = static
Range.endOffset Value An integer value indicating the number of characters into the Node indicated by endContainer at which the final character of the
range is located. Specifications Specification Status Comment DOMThe definition of 'endOffset' in that specification. Living Standard Static
RangeThe definition of 'endOffset' in that specification. Editor's Draft Initial definition. ...
StaticRange.startContainer - Web APIs
The read-only startContainer property of the Static
Range interface returns the start Node for the
range. Syntax var node = staticNode.startContainer Value The DOM Node inside which the start position of the
range is found. Specifications Specification Status Comment DOMThe definition of 'startContainer ' in that specification. Living Standard Static
RangeThe definition of 'startContainer' in that specification. Editor's Draft Initial definition. ...
StaticRange.startOffset - Web APIs
The read-only startOffset property of the Static
Range interface returns the offset into the start node of the
range's start position. Syntax var startOffset = static
Range.startOffset Value An integer value indicating the number of characters into the Node indicated by startContainer at which the first character of the
range is located. Specifications Specification Status Comment DOMThe definition of 'startOffset' in that specification. Living Standard Static
RangeThe definition of 'startOffset' in that specification. Editor's Draft Initial definition. ...
TimeRanges.length - Web APIs
The Time
Ranges.length read-only property returns the number of
ranges in the object. Syntax length = Time
Ranges.length; Example Given a video element with the ID "myVideo": var v = document.GetElementById("myVideo"); var buf = v.buffered; var num
Ranges = buf.length; if (buf.length == 1) { // Only one
range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // The one
range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } This example looks at the time
ranges and looks to see if the entire video has been loaded. Specifications Specification Status Comment HTML Living StandardThe definition of 'Time
Ranges.length()' in that specification. Living Standard Initial definition ...
WebGLShaderPrecisionFormat.rangeMax - Web APIs
The read-only WebGLShaderPrecisionFormat.
rangeMax property returns the base 2 log of the absolute value of the maximum value that can be represented. Examples var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).
rangeMax; // 127 gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_INT).
rangeMax; // 24 Specifications Specification Status Comment WebGL 1.0The definition of 'WebGLShaderPrecisionFormat.
rangeMax' in that specification. Recommendation Initial definition. ...
WebGLShaderPrecisionFormat.rangeMin - Web APIs
The read-only WebGLShaderPrecisionFormat.
rangeMin property returns the base 2 log of the absolute value of the minimum value that can be represented. Examples var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).
rangeMin; // 127 gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_INT).
rangeMin; // 24 Specifications Specification Status Comment WebGL 1.0The definition of 'WebGLShaderPrecisionFormat.
rangeMin' in that specification. Recommendation Initial definition. ...
::-moz-range-progress - CSS: Cascading Style Sheets
The ::-moz-
range-progress CSS pseudo-element is a Mozilla extension that represents the lower portion of the track (i.e., groove) in which the indicator slides in an <input> of type="
range". This portion corresponds to values lower than the value currently selected by the thumb (i.e., virtual knob). Note: Using ::-moz-
range-progress with anything but an <input type="
range"> doesn't match anything and has no effect. Syntax ::-moz-
range-progress Examples HTML <input type="
range" min="0" max="100" step="5" value="50"/> CSS input[type=
range]::-moz-
range-progress { background-color: green; height: 1em; } Result A progress bar using this style might look something like this: Specifications Not part of any standard. ...
::-moz-range-thumb - CSS: Cascading Style Sheets
The ::-moz-
range-thumb CSS pseudo-element is a Mozilla extension that represents the thumb (i.e., virtual knob) of an <input> of type="
range". The user can move the thumb along the input's track to alter its numerical value. Note: Using ::-moz-
range-thumb with anything but an <input type="
range"> doesn't match anything and has no effect. Syntax ::-moz-
range-thumb Examples HTML <input type="
range" min="0" max="100" step="5" value="50"/> CSS input[type=
range]::-moz-
range-thumb { background-color: green; } Result A progress bar using this style might look something like this: Specifications Not part of any standard. ...
::-moz-range-track - CSS: Cascading Style Sheets
The ::-moz-
range-track CSS pseudo-element is a Mozilla extension that represents the track (i.e., groove) in which the indicator slides in an <input> of type="
range". Note: Using ::-moz-
range-track with anything but an <input type="
range"> doesn't match anything and has no effect. Syntax ::-moz-
range-track Examples HTML <input type="
range" min="0" max="100" step="5" value="50"/> CSS input[type=
range]::-moz-
range-track { background-color: green; } Result A progress bar using this style might look something like this: Specifications Not part of any standard. ...
RangeError: radix must be an integer - JavaScript
The JavaScript exception "radix must be an integer at least 2 and no greater than 36" occurs when the optional radix parameter of the Number.prototype.toString() or the BigInt.prototype.toString() method was specified and is not between 2 and 36. Message
RangeError: invalid argument (Edge)
RangeError: radix must be an integer at least 2 and no greater than 36 (Firefox)
RangeError: toString() radix argument must be between 2 and 36 (Chrome) Error type
RangeError What went wrong? The optional radix parameter of the Number.prototype.toString() or the BigInt.prototype.toString() method was specified. Its value must be an integer (a number) between 2 and 36, specifying the base of the number system to be used for representing numeric values. For example, the decimal (base 10) number 169 is r...
RangeError: invalid date - JavaScript
The JavaScript exception "invalid date" occurs when a string leading to an invalid date has been provided to Date or Date.parse(). Message
RangeError: invalid date (Edge)
RangeError: invalid date (Firefox)
RangeError: invalid time value (Chrome)
RangeError: Provided date is not in valid
range (Chrome) Error type
RangeError What went wrong? A string leading to an invalid date has been provided to Date or Date.parse(). Examples Invalid cases Unrecognizable strings or dates containing illegal element values in ISO formatted strings usually return NaN. However, depending on the implementation, non-conforming ISO format strings, may also throw
RangeError: invalid date, like the following cases in Firefox: new Date('foo-bar 2014'); new Date('2014-25-23').toISOString(); new Date('foo-bar 2...
RangeError: repeat count must be non-negative - JavaScript
The JavaScript exception "repeat count must be non-negative" occurs when the String.prototype.repeat() method is used with a count argument that is a negative number. Message
RangeError: argument out of
range RangeError: repeat count must be non-negative (Firefox)
RangeError: Invalid count value (Chrome) Error type
RangeError What went wrong? The String.prototype.repeat() method has been used. It has a count parameter indicating the number of times to repeat the string. It must be between 0 and less than positive Infinity and cannot be a negative number. The
range of allowed values can be described like this: [0, +?). Examples Invalid cases 'abc'.repeat(-1); //
RangeError Valid cases 'abc'.repeat(0); // '' 'abc'.repeat(1); // 'abc' 'abc'.repeat(2); // 'abcabc' 'abc'.repea...
unicode-range - SVG: Scalable Vector Graphics
The unicode-
range attribute defines the
range of ISO 10646 characters possibly covered by the glyphs in a font. Only one element is using this attribute: <font-face> Usage notes Value <u
range># Default value None Animatable No <u
range># This value is a comma-separated list of ISO 10646 characters possibly covered by the glyphs in the font. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'unicode-
range' in that specification. Recommendation Initial definition ...
Index - Web APIs
y share the same vertex data, primitive count and type. 3 ANGLE_instanced_arrays.drawArraysInstancedANGLE() ANGLE_instanced_arrays, API, Method, Reference, WebGL, WebGL extension The ANGLE_instanced_arrays.drawArraysInstancedANGLE() method of the WebGL API renders primitives from array data like the gl.drawArrays() method. In addition, it can execute multiple instances of the
range of elements. 4 ANGLE_instanced_arrays.drawElementsInstancedANGLE() ANGLE_instanced_arrays, API, Method, Reference, WebGL, WebGL extension The ANGLE_instanced_arrays.drawElementsInstancedANGLE() method of the WebGL API renders primitives from array data like the gl.drawElements() method. In addition, it can execute multiple instances of a set of elements. 5 ANGLE_in...
...em. 15 AbsoluteOrientationSensor API, AbsoluteOrientationSensor, Constructor, Generic Sensor API, Orientation Sensor API, Reference, Sensor, Sensor APIs, Sensors The AbsoluteOrientationSensor constructor creates a new AbsoluteOrientationSensor object which describes the device's physical orientation in relation to the Earth's reference coordinate system. ...
...AbsoluteOrientationSensor, Constructor, Generic Sensor API, Orientation Sensor API, Reference, Sensor, Sensor APIs, Sensors The AbsoluteOrientationSensor constructor creates a new AbsoluteOrientationSensor object which describes the device's physical orientation in relation to the Earth's reference coordinate system. ...
...And 134 more matches
Proxy Auto-Configuration (PAC) file - HTTP
The PAC file is named proxy.pac Command line: pactester -p ...
... The PAC file is named proxy.pac Command line: pactester -p ~/pacparser-mas...
... The PAC file is named proxy.pac Command line: pactester -p ~/pacparser-master/tests/proxy...
...And 23 more matches
Assertions - JavaScript
/\Bo/gim,'e'); console.log(4, fixedMultiline); // fix 'greon' but does not touch 'on'. Matching the beginning of input using a ^ control character Use ^ for matching at the beginning of input. In this example, we can get the fruits that start with 'A' by a /^A/ regex. For selecting appropriate fruits we can use the filter method with an arrow function. let fruits = ["Apple", "Watermelon", "O
range", "Avocado", "Strawberry"]; // Select fruits started with 'A' by /^A/ Regex. // Here '^' control symbol used only in one role: Matching beginning of an input. let fruitsStartsWithA = fruits.filter(fruit => /^A/.test(fruit)); console.log(fruitsStartsWithA); // [ 'Apple', 'Avocado' ] In the second example ^ is used both for matching at the beginning of input and for creating negated or complemen...
...re '^' control symbol used only in one role: Matching beginning of an input. let fruitsStartsWithA = fruits.filter(fruit => /^A/.test(fruit)); console.log(fruitsStartsWithA); // [ 'Apple', 'Avocado' ] In the second example ^ is used both for matching at the beginning of input and for creating negated or complemented character sets when used within groups. let fruits = ["Apple", "Watermelon", "O
range", "Avocado", "Strawberry"]; // Selecting fruits that dose not start by 'A' by a /^[^A]/ regex. // In this example, two meanings of '^' control symbol are represented: // 1) Matching begining of the input // 2) A negated or complemented character set: [^A] // That is, it matches anything that is not enclosed in the brackets. let fruitsStartsWithNotA = fruits.filter(fruit => /^[^A]/.test(fruit));...
...e not start by 'A' by a /^[^A]/ regex. // In this example, two meanings of '^' control symbol are represented: // 1) Matching begining of the input // 2) A negated or complemented character set: [^A] // That is, it matches anything that is not enclosed in the brackets. ...
...And 22 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
nput type="number" name="number"/> HTML5 password A single-line text field whose value is obscured. Will alert user if site is not secure. <input type="password" name="password"/> radio A radio button, allowing a single value to be selected out of multiple choices with the same name value. <input type="radio" name="radio"/>
range A control for entering a number whose exact value is not important. Displays as a
range widget defaulting to the middle value. Used in conjunction min and max to define the
range of acceptable values. <input type="
range" name="
range" min="0" max="25"/> HTML5 reset A button that resets the contents of the form to default values. Not recommended. <input type="...
... in the same input field, but more complex forms of autocomplete can exist. For instance, a browser could integrate with a device's contacts list to autocomplete email addresses in an email input field. See Values in The HTML autocomplete attribute for permitted values. The autocomplete attribute is valid on hidden, text, search, url, tel, email, date, month, week, time, datetime-local, number,
range, color, and password. This attribute has no effect on input types that do not return numeric or text data, being valid for all input types except checkbox, radio, file, or any of the button types. See The HTML autocomplete attribute for additional information, including information on password security and how autocomplete is slightly different for hidden than for other input types. autofocu...
...tion> <option>#dd0000</option> <option>#cc0000</option> <option>#bb0000</option> </datalist> <datalist id="numbersxx"> <option>0</option> <option>2</option> <option>4</option> <option>8</option> <option>16</option> <option>32</option> <option>64</option> </datalist> <datalist id="fruitsxx"> <option>cherry</option> <option>banana</option> <option>mango</option> <option>o
range</option> <option>blueberry</option> </datalist> <datalist id="urlsxx"> <option>https://developer.mozilla.org</option> <option>https://caniuse.com/</option> <option>https://mozilla.com</option> <option>https://mdn.github.io</option> <option>https://www.youtube.com/user/firefoxchannel</option> </datalist> <p><label for="textx">Text</label> <input type="text" list="fruitsxx" id="textx"/...
...And 20 more matches
Using IndexedDB - Web APIs
indow.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. // Moreover, you may need references to some window.IDB* objects: window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction || {READ_WRITE: "readwrite"}; // This line should only be needed if it is needed to support the object's constants for older browsers window.IDBKey
Range = window.IDBKey
Range || window.webkitIDBKey
Range || window.msIDBKey
Range; // (Mozilla has never prefixed these objects, so we don't need window.mozIDB*) Beware that implementations that use a prefix may be buggy, or incomplete, or following an old version of the specification. Therefore, it is not recommended to use it in production code. It may be preferable to not support a browser than to cla...
...re = db.transaction("customers").objectStore("customers"); objectStore.openCursor().onsuccess = function(event) { var cursor = event.target.result; if (cursor) { console.log("Name for SSN " + cursor.key + " is " + cursor.value.name); cursor.continue(); } else { console.log("No more entries!"); } }; The openCursor() function takes several arguments. First, you can limit the
range of items that are retrieved by using a key
range object that we'll get to in a minute. Second, you can specify the direction that you want to iterate. In the above example, we're iterating over all objects in ascending order. The success callback for cursors is a little special. The cursor object itself is the result of the request (above we're using the shorthand, so it's event.target.result). T...
...ey cursor to grab customer record object keys index.openKeyCursor().onsuccess = function(event) { var cursor = event.target.result; if (cursor) { // cursor.key is a name, like "Bill", and cursor.value is the SSN. // No way to directly get the rest of the stored object. ...
...And 13 more matches
Index - Archive of obsolete content
lection API provides a method for detecting the selections made by the user. Features can get, set, and listen for selection events in HTML or plain text. 530 Tabs In this class you can find information about the tabs in your Firefox window. 531 slideBar slideBar is a reinvention of the old sidebar features of browsers. They allow quick access to a wide
range of both temporary and permanent information at the side of your browser window. When a slideBar feature is selected its contents will be revealed from behind the current webpage. 532 slideBar To implement a new slideBar within your jetpack code, use the method jetpack.slideBar.append(options) 533 Users No summary! 534 aza No summar...
...68 International characters in XUL JavaScript Firefox, Gecko, Guide, Internationalization, JavaScript, Mozilla, XPCOM, XUL Gecko 1.8, as used in Firefox 1.5 and other applications, added support for non-ASCII characters in JavaScript files loaded from XUL files. 1169 Introduction to XUL Guide, XUL Mozilla has configurable, downloadable chrome, meaning that the ar
rangement and even presence or absence of controls in the main window is not hardwired into the application, but loaded from a separate UI description. In fact, most of Mozilla's windows (and dialogs) will be described using this mechanism. XUL (pronounced "zool," as if that spelling helped any, and short for "XML User Interface Language") is our name for the language in which these UI descriptions are...
...302 scrollByPixels XUL Methods, XUL Reference No summary! 1303 scrollToIndex XUL Methods, XUL Reference No summary! 1304 select XUL Methods, XUL Reference No summary! 1305 selectAll XUL Methods, XUL Reference No summary! 1306 selectItem XUL Methods, XUL Reference No summary! 1307 selectItem
Range XUL Methods, XUL Reference No summary! 1308 selectTabAtIndex Method, Reference, XUL, XUL Methods, XUL Reference No summary! 1309 setIcon XUL, XUL Methods, XUL Reference No summary! 1310 setSelection
Range XUL Methods, XUL Reference No summary! 1311 showOnlyTheseTabs Method, Reference, XUL No summary! ...
...And 12 more matches
nsISelection
nsISelection content/base/public/nsISelection.idlScriptable ??? ...
...querying the current selected
range of nodes within the document. Implemented by: ?????????????????????????????????????. ...
...rrent selected
range of nodes within the document. Implemented by: ?????????????????????????????????????. ...
...And 11 more matches
nsISelectionPrivate
above for up-to-date information. ...
...me, in PRInt32 inOffset, in nsPointRef aPoint); Native code only! nsIEnumerator getEnumerator(); nsFrameSelection getFrameSelection(); Native code only! void Get
RangesForInterval(in nsIDOMNode beginNode, in PRInt32 beginOffset, in nsIDOMNode endNode, in PRInt32 endOffset, in PRBool allowAdjacent, out PRUint32 resultCount, [retval, array, size_is(resultCount)] out nsIDOM
Range results); void Get
RangesForIntervalArray(in nsINode beginNode, in PRInt32 beginoffset, in nsINode endNode, in PRInt32 endOffset, in boolean allowAdjacent, in
RangeArray results); Native code only! ...
..., in PRInt32 beginOffset, in nsIDOMNode endNode, in PRInt32 endOffset, in PRBool allowAdjacent, out PRUint32 resultCount, [retval, array, size_is(resultCount)] out nsIDOM
Range results); void Get
RangesForIntervalArray(in nsINode beginNode, in PRInt32 beginoffset, in nsINode endNode, in PRInt32 endOffset, in boolean allowAdjacent, in
RangeArray results); Native code only! void Get
RangesForIntervalCOMArray(in nsIDOMNode beginNode, in PRInt32 beginOffset, in nsIDOMNode endNode, in PRInt32 endOffset, in PRBool allowAdjacent, in
RangeArray results); Native code only! ...
...And 11 more matches
Selection - Web APIs
To obtain a Selection object for examination or manipulation, call window.getSelection(). A user may make a selection from left to right (in document order) or right to left (reverse of document order). The anchor is where the user began the selection and the focus is where the user ends the selection. If you make a selection with a desktop mouse, the anchor is placed where you pressed the mouse button, and the focus is placed where you released the mouse button. Anchor and focus should not be confused with the start and end positions of a selection. ...
...offset of the selection's anchor within the focusNode. If focusNode is a text node, this is the number of characters within focusNode preceding the focus. If focusNode is an element, this is the number of child nodes of the focusNode preceding the focus. Selection.isCollapsedRead only Returns a Boolean indicating whether the selection's start and end points are at the same position. ...
...focusNode. If focusNode is a text node, this is the number of characters within focusNode preceding the focus. If focusNode is an element, this is the number of child nodes of the focusNode preceding the focus. Selection.isCollapsedRead only Returns a Boolean indicating whether the selection's start and end points are at the same position. Selection.
rangeCountRead only Returns the number of
ranges in the selection. Selection.typeRead only Returns a DOMString describing the type of the current selection. Methods Selection.add
Range() A
Range object that will be added to the selection. Selection.collapse() Collapses the current selection to a single point. Selection.collapseToEnd() Collapses the selection to the end of the last
range in the selection. Selection.collapseToStart(...
...And 11 more matches
nsIAccessibleText
accessible/public/nsIAccessibleText.idlScriptable Please add a summary to this article. ...
... accessible/public/nsIAccessibleText.idlScriptable Please add a summary to this article. ...
... accessible/public/nsIAccessibleText.idlScriptable Please add a summary to this article. ...
...And 10 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
ct(audioCtx.destination); osc.start(); osc.stop(audioCtx.currentTime + 1); } Controlling amplitude This is great, but wouldn't it be nice if we had an amplitude envelope to go with it? Let's create a simple one so we get used to the methods we need to create an envelope with the Web Audio API. Let's say our envelope has attack and release. ...
...ude This is great, but wouldn't it be nice if we had an amplitude envelope to go with it? Let's create a simple one so we get used to the methods we need to create an envelope with the Web Audio API. Let's say our envelope has attack and release. ...
...sed to the methods we need to create an envelope with the Web Audio API. Let's say our envelope has attack and release. ...
...And 9 more matches
Digital audio concepts - Web media technologies
sound that's produced. Computers, however, are digital. In order to represent a sound wave in a way computers can manipulate and work with (let alone transmit over a network), the sound has to be converted into a digital form. This process is called analog to digital conversion (A/D for short). The first factor affecting the fidelity of the captured audio is the audio bandwidth; that is, the
range of audio frequencies the A/D converter is capable of capturing and converting into digital form. The audio bandwidth is also affected by the codec, if it chooses to discard any frequency bands while encoding the sound. Sound enters the computer through a microphone or other input in the form of a stream of electrons whose voltage varies to represent the amplitude of the sound wave. This analog s...
... While recording or generating multi-channel audio files, the channels are assembled into a series of audio frames, each consisting of one sample for each of the audio's channels. An individual sample is a numeric value representing the amplitude of the sound waveform at a single moment in time, and may be represented in various formats. Stereo audio is probably the most commonly used channel ar
rangement in web audio, and 16-bit samples are used for the majority of day-to-day audio in use today. For 16-bit stereo audio, each sample taken from the analog signal is recorded as two 16-bit integers, one for the left channel and one for the right. That means each sample requires 32 bits of memory. At the common sample rate of 48 kHz (48,000 samples per second), this means each second of audio occu...
...ed for computer audio. 96000 Hz High-resolution audio. 192000 Hz Ultra-high resolution audio. Not commonly used yet, but this will change over time. There is a reason why 44.1 kHz is considered the minimum "high fidelity" sampling rate. The Nyquist-Shannon sampling theorem dictates that to reproduce a sound accurately, it must be sampled at twice the rate of the sound's frequency. Since the
range of human hearing is from around 20 Hz to 20,000 Hz, reproducing the highest-pitched sounds people can generally hear requires a sample rate of more than 40,000 Hz. To provide additional room for a low-pass filter in order to avoid distortion caused by aliasing, an additional 2.05 kHz transition band is added to the pre-sampling frequency (resulting in 22,050 Hz). Doubling that per the Nyquist th...
...And 9 more matches
MIME types (IANA media types) - HTTP
d. Multipart types Multipart types indicate a category of document broken into pieces, often with different MIME types; they can also be used -- especially in email scenarios -- to represent multiple, separate files which are all part of the same transaction. They represent a composite document. With the exception of multipart/form-data, used in the POST method of HTML Forms, and multipart/byte
ranges, used with 206 Partial Content to send part of a document, HTTP doesn't handle multipart documents in a special way: the message is transmitted to the browser (which will likely show a "Save As" window if it doesn't know how to display the document). There are two multipart types: message List at IANA A message that encapsulates other messages. This can be used, for instance, to represent a...
...ssage/rfc822 (for forwarded or replied-to message quoting) and message/partial to allow breaking a large message into smaller ones automatically to be reassembled by the recipient. multipart List at IANA Data that is comprised of multiple components which may individually have different MIME types. Examples include multipart/form-data (for data produced using the FormData API) and multipart/byte
ranges (defined in RFC 7233: 5.4.1 and used with HTTP's 206 "Partial Content" response returned when the fetched data is only part of the content, such as is delivered using the
Range header). Important MIME types for Web developers application/octet-stream This is the default for binary files. As it means unknown binary file, browsers usually don't execute it, or even ask if it should be executed.
...pabilities, and detailed browser compatibility information; including which versions introduced support and specific special features that may have been introduced later. Audio and video types As is the case for images, HTML doesn't mandate that web browsers support any specific file and codec types for the <audio> and <video> elements, so it's important to consider your target audience and the
range of browsers (and versions of those browsers) they may be using when choosing the file type and codecs to use for media. Our media container formats guide provides a list of the file types that are commonly supported by web browsers, including information about what their special use cases may be, any drawbacks they have, and compatibility information, along with other details. The audio codec a...
...And 8 more matches
UI pseudo-classes - Learn web development
, the CSS Selector Level 3 and CSS Basic UI Level 3 added more pseudo-classes related to HTML forms that provide several other useful targetting conditions that you can take advantage of. We'll discuss these in more detail in the sections below, but briefly, the main ones we'll be looking at are: :required and :optional: Targets required or optional form controls. :valid and :invalid, and :in-
range and :out-of-
range: Target form controls that are valid/invalid according to form validation constraints set on them, or in-
range/out-of-
range. :enabled and :disabled, and :read-only and :read-write: Target enabled or disabled form controls (e.g. with the disabled HTML attribute set), and read-write or read-only form controls (e.g. with the readonly HTML attribute set). :checked, :indeterminate,...
.... Then we give the generated content the content "required", which is what we wanted our label to say, and style and position it as we want. The result is seen below. Styling controls based on whether their data is valid The other really important, fundamental concept in form validation is whether a form control's data is valid or not (in the case of numerical data, we can also talk about in-
range and out-of-
range data). Form controls with constraint limitations can be targeted based on these states. :valid and :invalid You can target from control using the :valid and :invalid pseudo-classes. Some points worth bearing in mind: Controls with no constraint validation will always be valid, and therefore matched with :valid. Controls with required set on them that have no value are count...
...trols with required set on them that have no value are counted as invalid -- they will be matched with :invalid and :required. Controls with built-in validation, such as <input type="email"> or <input type="url"> are (matched with) :invalid when the data entered into them does not match the pattern they are looking for (but they are valid when empty). Controls whose current value is outside the
range limits specified by the min and max attributes are (matched with) :invalid, but also matched by :out-of-
range, as you'll see later on. There are some other ways to make an element matched by :valid/:invalid, as you'll see in the Client-side form validation article. But we'll keep things simple for now. Let's go in and look at a simple example of :valid/:invalid (see valid-invalid.html for the ...
...And 7 more matches
Bytecode Descriptions
onicalizeNaN). BigInt Operands: (uint32_t bigIntIndex) Stack: => bigint Push the BigInt constant script->getBigInt(bigIntIndex). String Operands: (uint32_t atomIndex) Stack: => string Push the string constant script->getAtom(atomIndex). Format: JOF_ATOM Symbol Operands: (uint8_t symbol (the JS::SymbolCode of the symbol to use)) Stack: => symbol Push a well-known symbol. symbol must be in
range for JS::SymbolCode. Expressions Unary operators Void Stack: val => undefined Pop the top value on the stack, discard it, and push undefined. Implements: The void operator, step 3. Typeof, TypeofExpr Stack: val => (typeof val) The typeof operator. Infallible. The result is always a string that depends on the type of val. JSOp::Typeof and JSOp::TypeofExpr are the same except that--amazingly...
...version can call .toString()/.valueOf() methods and can throw. On success, the result is always numeric. Format: JOF_IC Pow Stack: lval, rval => (lval ** rval) The exponentiation operator (**). Pop two values, convert them to numeric values, do exponentiation, and push the result. The top value is the exponent. The conversion can call .toString()/.valueOf() methods and can throw. This throws a
RangeError if both values are BigInts and the exponent is negative. Format: JOF_IC Conversions ToPropertyKey Stack: propertyNameValue => propertyKey Convert a value to a property key. Implements: ToPropertyKey, except that if the result would be the string representation of some integer in the
range 0..2^31, we push the corresponding Int32 value instead. This is because the spec insists that array...
...Iter and can exit only by executing a JSOp::EndIter or by exception unwinding. (A JSOp::EndIter is always emitted at the end of the loop, and extra copies are emitted on "exit slides", where a break, continue, or return statement exits the loop.) Typically a single try note entry marks the contiguous chunk of bytecode from the instruction after JSOp::Iter to JSOp::EndIter (inclusive); but if that
range contains any instructions on exit slides, after a JSOp::EndIter, then those must be correctly noted as outside the loop. Format: JOF_IC MoreIter Stack: iter => iter, name Get the next property name for a for-in loop. iter must be a PropertyIteratorObject produced by JSOp::Iter. This pushes the property name for the next loop iteration, or MagicValue(JS_NO_ITER_VALUE) if there are no more enum...
...And 7 more matches
Index
e Guide, XPCOM This is a book about Gecko, and about creating XPCOM components for Gecko-based applications. Though the emphasis is on the practical steps you take to make your C++ code into a component that can be used in Gecko, we hope that these steps will also give us an occasion to discuss all of the tools, techniques, and technologies that make up XPCOM. Accordingly, the book is ar
ranged so that you can follow along and create your own components or learn about different XPCOM topics individually, as in a reference work. For example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with Mozilla - prompts a discussion of the relationship between components and modules, of XPCOM inte...
...tribute is obtained by parsing the attribute string returned by IAccessible2.attributes(). The "table-cell-index" attribute can be used just like a child index of the typical case. ATs should first test for the presence of the "table-cell-index" attribute and if it is not present then IAccessible2.indexInParent() can be used as in the typical case where cells are direct children of the table. The
range of valid coordinates for this interface are implementation dependent. However, that
range includes at least the intervals from the from the first row or column with the index 0 up to the last (but not including) used row or column as returned by nRows() and nColumns(). 171 IAccessibleTable2 Interfaces, NeedsHelp Please also refer to the IAccessibleTableCell interface. If you ...
...u can QueryInterface to nsIAccessibleDocument from the nsIAccessible or nsIAccessNode for the root node of a document. You can also get one from nsIAccessNode.GetAccessibleDocument() or nsIAccessibleEvent.GetAccessibleDocument() 292 nsIAccessibleEditableText Accessibility, Interfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference Copies the text
range into the clipboard. 293 DeleteText delete Documentation is now located at nsIAccessibleEditableText.DeleteText(). 294 nsIAccessibleEvent Accessibility, Interfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference To listen to in-process accessibility invents, make your object an nsIObserver, and listen for accessible-event by u...
...And 7 more matches
nsITreeSelection
layout/xul/base/src/tree/public/nsITreeSelection.idlScriptable This interface is used by the tree widget to get information about what is selected. ...
...l/base/src/tree/public/nsITreeSelection.idlScriptable This interface is used by the tree widget to get information about what is selected. ...
...rface is used by the tree widget to get information about what is selected. ...
...And 7 more matches
Streams - Plugins
The browser uses the NPP_Write method to "push" stream data to the instance incrementally as it is available. Random-access mode: The plug-in calls the NPN_RequestRead method to "pull" stream data. In general, this mode is more expensive, because the entire stream must be downloaded to a temporary file before use unless the stream comes from a local file or an HTTP server that supports the byte-
range extension to HTTP. File mode: The browser saves the entire stream to a local file and passes the file path to the plug-in instance through the NPP_StreamAsFile method. Use this feature only as a last resort; plug-ins should implement an incremental stream-based interface wherever possible. Streams sent by the plug-in to the browser are like normal-mode streams produced by the browser, but in r...
...meter refers to the plug-in instance receiving the stream; the type parameter represents the stream's MIME type. The stream parameter is a pointer to the new stream, which is valid until the stream is destroyed. The seekable parameter specifies whether the stream is seekable (true) or not (false). Seekable streams support random access (for example, local files or HTTP servers that support byte-
range requests). The plug-in can set the output parameter type to one of these transmission modes: NP_NORMAL: (Default): The plug-in can process the data progressively as it arrives from the network or file system through a series of calls to NPP_WriteReady and NPP_Write. NP_ASFILEONLY: This plug-in gets full random access to the data using platform-specific file operations. The browser saves stre...
...s the offset, in bytes, of buf from the beginning of the data in the stream. The len parameter specifies the length, in bytes, of buf, the buffer of data (delivered by the stream). The buffer allocated by the browser is deleted after returning from the function, so the plug-in must make a copy of the data it needs to keep. As an example, suppose that a plug-in (and the HTTP server) supports byte-
range requests, and that the browser is in the process of pushing data to the plug-in. If the user now requests a specific page of the document, the plug-in calls NPN_RequestRead with a list of byte
ranges. The open stream is converted from normal mode to seek mode in an effort to pass the plug-in data that was already on the way, rather than just discarding it. All NPP_Write calls for streaming data e...
...And 7 more matches
Selection API - Web APIs
The Selection API provides functionality for reading and manipulating the
range of text selected by the user. Concepts and usage To retrieve the current text
range the user has selected, you can use the Window.getSelection() or Document.getSelection() method, storing the return value -- a Selection object -- in a variable for futher use. Once your selection is in a variable, you perform a variety of operations on it, for example copying the selection to a text string using Selection.toString(), adding a
range (as represented by a standard
Range object) to the selection (or removing one) with Selection.add
Range()/Selection.remove
Range(), or changing the selection to be the entire contents of a DOM node using Selection.selectAllChildren(). You can run code in response to the selection bein...
...tion.add
Range()/Selection.remove
Range(), or changing the selection to be the entire contents of a DOM node using Selection.selectAllChildren(). You can run code in response to the selection being changed, or a new selection being started, using the GlobalEventHandlers.onselectionchange and GlobalEventHandlers.onselectstart event handlers. Selection API interfaces Selection Represents the
range of text selected by the user or the current position of the caret. Extensions to other interfaces Window.getSelection(), Document.getSelection() Returns a Selection object representing the
range of text selected by the user or the current position of the caret. Document.getSelection() is basically an alias of Window.getSelection(). GlobalEventHandlers.onselectstart Represents the event ha...
...rfaces Window.getSelection(), Document.getSelection() Returns a Selection object representing the
range of text selected by the user or the current position of the caret. Document.getSelection() is basically an alias of Window.getSelection(). GlobalEventHandlers.onselectstart Represents the event handler that is called when a selectstart event is fired on the current object (i.e. when a new
range of text is about to be selected by the user). GlobalEventHandlers.onselectionchange Represents the event handler that is called when a selectionchange event is fired on the current object (i.e. when the selected text
range changes). Specifications Specification Status Comment Selection APIThe definition of 'Selection' in that specification. Working Draft The ...
...And 7 more matches
WebGL model view projection - Web APIs
ndled by the basic transformation matrices like translation, scale, and rotation. These matrices can be composed together and grouped in special ways to make them useful for rendering complicated 3D scenes. These composed matrices ultimately move the original model data around into a special coordinate space called clip space. This is a 2 unit wide cube, centered at (0,0,0), and with corners that
range range from (-1,-1,-1) to (1,1,1). This clip space is compressed down into a 2D space and rasterized into an image. The first matrix discussed below is the model matrix, which defines how you take your original model data and move it around in 3D world space. The projection matrix is used to convert world space coordinates into clip space coordinates. A commonly used projection matrix, the perspe...
...ox. box.draw({ top : 0.9, // x bottom : 0, // x left : -0.9, // y right : 0.9, // y depth : 0.5, // z color : [0.4, 1, 0.4, 1] // green }); Finally, for demonstration that clipping is actually going on, this box doesn't get drawn because it's entirely outside of clip space. The depth is outside of the -1.0 to 1.0
range. box.draw({ top : 1, // x bottom : -1, // x left : -1, // y right : 1, // y depth : -1.5, // z color : [0.4, 0.4, 1, 1] // blue }); The results View on JSFiddle Exercise A helpful exercise at this point is to move the boxes around the clip space by varying the code to get a feel for how points get clippe...
... w component to 1.1 box.draw({ top : 0.9, // y bottom : 0, // y left : -0.9, // x right : 0.9, // x w : 1.1, // w - shrink this box depth : 0.5, // z color : [0.4, 1, 0.4, 1] // green }); This last box doesn't get drawn because it's outside of clip space. The depth is outside of the -1.0 to 1.0
range. ...
...And 7 more matches
Setting up adaptive streaming media sources - Developer guides
is used to hold the information on the various streams and the bandwidths they are associated with. In your video source (src) attribute you point to the MPD instead of to the media file as you would with non-adaptive media. The MPD file tells the browser where the various pieces of media are located, it also includes meta data such as mimeType and codecs and there are other details such as byte-
ranges in there too - it is an XML document and in many cases will be generated for you. There are a few profiles we can use. We're going to take a look at Ondemand profile for Video On Demand (VOD) and the LIVE profile. For live services streaming, the LIVE profile is a requirement. The stream switching capabilities are identical between the profiles. Other reasons to use LIVE profile over Ondemand...
...nerated for you. There are a few profiles we can use. We're going to take a look at Ondemand profile for Video On Demand (VOD) and the LIVE profile. For live services streaming, the LIVE profile is a requirement. The stream switching capabilities are identical between the profiles. ...
...s we can use. We're going to take a look at Ondemand profile for Video On Demand (VOD) and the LIVE profile. For live services streaming, the LIVE profile is a requirement. The stream switching capabilities are identical between the profiles. ...
...And 7 more matches
Web audio codec guide - Web media technologies
ncy band(s), there may be a noticeable loss of fidelity Removing frequency bands means less data to encode, thus smaller encoded files Stereo coding Simple stereo and mid-side stereo coding don't affect quality; intensity stereo coding introduces loss of detail, however. Joint stereo can reduce the size of the encoded audio to some extent The parameters available--and the
range of possible values--varies from codec to codec, and even among different encoding utilities for the same codec, so read the documentation that comes with the encoding software you use to learn more. Features affecting encoded audio size Several factors affect the size of the encoded audio. Some of these are a matter of the form of the source audio; others are related to decisions made while enc...
...els. For example, MP3 supports one LFE channel, while AAC supports up to 16. In addition to providing audio for specific speakers in a sound system, some codecs may allow audio channels to be used to provide alternative audio, such as vocals in different languages or descriptive audio for visually impaired people. Audio frequency bandwidth The audio frequency bandwidth of a codec indicates the
range of audio frequencies that can be represented using the codec. Some codecs operate specifically by eliminating audio that falls outside a given frequency
range. There is a correlation between the sample rate and the maxium sound frequency that can be represented by a waveform represented by a codec. At a theoretical level, the maximum frequency a codec can represent is the sample rate divided by t...
... by a waveform represented by a codec. At a theoretical level, the maximum frequency a codec can represent is the sample rate divided by two; this frequency is called the Nyquist frequency. In reality, the maximum is slightly lower, but it's close. The audio frequency bandwidth comes into play especially vividly when a codec is designed or configured to represent human speech rather than a broad
range of sounds. Human speech generally resides within the audio frequency
range of 300 Hz to 18 kHz. However, the vast majority of human vocalizations exist in the
range 300 Hz to 8 kHz, and you can capture enough of human vocalizations in the frequency
range 500 Hz to 3 kHz to still be understandable. For that reason, speech-specific codecs often begin by dropping sound that falls outside a set rang...
...And 7 more matches
Client-side form validation - Learn web development
e :valid CSS pseudo-class, which lets you apply a specific style to valid elements. If the user tries to send the data, the browser will submit the form, provided there is nothing else stopping it from doing so (e.g., JavaScript). ...
... Built-in form validation examples In this section, we'll test out some of the attributes that we discussed above. ...
... Built-in form validation examples In this section, we'll test out some of the attributes that we discussed above. ...
...And 6 more matches
IME handling guide
ause style is rendered by Gecko. And the drop down menu is created by IME. Each clause is represented with selection in the editor. From chrome script, you can check it with nsISelectionController. In native code, you can access it with either nsISelectionController or mozilla::SelectionType (the latter is recommended because of type safer). ...
...Each clause is represented with selection in the editor. From chrome script, you can check it with nsISelectionController. In native code, you can access it with either nsISelectionController or mozilla::SelectionType (the latter is recommended because of type safer). And editor sets these IME selections from mozilla::Text
RangeType which are sent by mozilla::WidgetCompositionEvent as mozilla::Text
RangeArray. Following table explains the mapping between them. ...
...electionType (the latter is recommended because of type safer). And editor sets these IME selections from mozilla::Text
RangeType which are sent by mozilla::WidgetCompositionEvent as mozilla::Text
RangeArray. Following table explains the mapping between them. ...
...And 6 more matches
IAccessibleEditableText
Return value E_INVALIDARG...
...; HRESULT setAttributes([in] long startOffset, [in] long endOffset, [in] BSTR attributes ); Methods copyText() Copies the text
range into the clipboard. The specified text between the two given indices is copied into the system clipboard. HRESULT copyText( [in] long startOffset, [in] long endOffset ); Parameters startOffset Start index of the text to moved into the clipboard. The valid
range is 0..length. endOffset End index of the text to moved into the clipboard. The valid
range is 0..length. Return value E_INVALIDARG if bad [in] passed. S_OK. cutText() Deletes a
range of text and copies it to the clipboard. The text between the two given indices is deleted from the text represented by this object and copied to the clipboard. HRESULT cutText( [in] long startOffset, [in] long e...
...The text between and including the two given indices is deleted from the text represented by this object. ...
...And 6 more matches
attr() - CSS: Cascading Style Sheets
tion. Relative URL are resolved relatively to the original document, not relatively to the style sheet. Leading and trailing spaces are stripped. The url about:invalid that points to a non-existent document with a generic error condition. integer <integer> The attribute value is parsed as a CSS <integer>. If it is not valid, that is not an integer or out of the
range accepted by the CSS property, the default value is used. Leading and trailing spaces are stripped. 0, or, if 0 is not a valid value for the property, the property's minimum value. number <number> The attribute value is parsed as a CSS <number>. If it is not valid, that is not a number or out of the
range accepted by the CSS property, the default value is used. ...
... If the given unit is a relative length, attr() computes it to an absolute length. Leading and trailing spaces are stripped. 0, or, if 0 is not a valid value for the property, the property's minimum value. ...
...ailing spaces are stripped. 0, or, if 0 is not a valid value for the property, the property's minimum value. em, ex, px, rem, vw, vh, vmin, vmax, mm, cm, in, pt, or pc <length> The attribute value is parsed as a CSS <number>, that is without the unit (e.g. 12.5), and interpreted as a <length> with the specified unit. If it is not valid, that is not a number or out of the
range accepted by the CSS property, the default value is used. If the given unit is a relative length, attr() computes it to an absolute length. Leading and trailing spaces are stripped. 0, or, if 0 is not a valid value for the property, the property's minimum value. angle <angle> The attribute value is parsed as a CSS <angle> dimension, that is including the unit (e...
...And 6 more matches
HTTP Index - HTTP
tent-Language response header. Browsers set adequate values for this header according to their user interface language and even if a user can change it, this happens rarely (and is frowned upon as it leads to fingerprinting). 53 Accept-Patch HTTP, Reference The Accept-Patch response HTTP header advertises which media-type the server is able to understand. 54 Accept-
Ranges HTTP, HTTP Header,
Range Requests, Reference, Response Header The Accept-
Ranges response HTTP header is a marker used by the server to advertise its support of partial requests. The value of this field indicates the unit that can be used to define a
range. 55 Access-Control-Allow-Credentials Access-Control-Allow-Credentials, CORS, HTTP, Reference, credentials, header ...
...rs, Reference The Content-Length entity header indicates the size of the entity-body, in bytes, sent to the recipient. 74 Content-Location HTTP, Reference, header The Content-Location header indicates an alternate location for the returned data. The principal use is to indicate the URL of a resource transmitted as the result of content negotiation. 75 Content-
Range HTTP, HTTP Header, Reference, Response Header, header The Content-
Range response HTTP header indicates where in a full body message a partial message belongs. 76 Content-Security-Policy CSP, Content Security Policy, HTTP, Reference, Security, header The HTTP Content-Security-Policy response header allows web site administrators to control resources the user agent is...
...e, Request header The If-None-Match HTTP request header makes the request conditional. For GET and HEAD methods, the server will send back the requested resource, with a 200 status, only if it doesn't have an ETag matching the given ones. For other methods, the request will be processed only if the eventually existing resource's ETag doesn't match any of the values listed. 159 If-
Range Condtional Requests, HTTP, HTTP Header,
Range Requests, Reference, Request header The If-
Range HTTP request header makes a
range request conditional: if the condition is fulfilled, the
range request will be issued and the server sends back a 206 Partial Content answer with the appropriate body. If the condition is not fulfilled, the full resource is sent back, with a 200 OK status. ...
...And 6 more matches
Other form controls - Learn web development
If you use this fallback, ensure the data for both the <input> and the <select> are collected server-side. Less obvious datalist uses According to the HTML specification, the list attribute and the <datalist> element can be used with any kind of widget requiring a user input. This leads to some uses of it that might seem a little non-obvious. For example, in browsers that support <datalist> on
range input types, a small tick mark will be displayed above the
range for each datalist <option> value. You can see an implementation example of this on the <input type="
range"> reference page. And browsers that support <datalist>s and <input type="color"> should display a customized palette of colors as the default, while still making the full color palette available. In this case, different browse...
...="100" value="75">75/100</progress> This is for implementing anything requiring progress reporting, such as the percentage of total files downloaded, or the number of questions filled in on a questionnaire. The content inside the <progress> element is a fallback for browsers that don't support the element and for screen readers to vocalize it. Meter A meter bar represents a fixed value in a
range delimited by max and min values. This value is visually rendered as a bar, and to know how this bar looks, we compare the value to some other set values: The low and high values divide the
range in three parts: The lower part of the
range is between the min and low values, inclusive. The medium part of the
range is between the low and high values, exclusive. The higher part of the ...
... delimited by max and min values. This value is visually rendered as a bar, and to know how this bar looks, we compare the value to some other set values: The low and high values divide the
range in three parts: The lower part of the
range is between the min and low values, inclusive. The medium part of the
range is between the low and high values, exclusive. The higher part of the
range is between the high and max values, inclusive. The optimum value defines the optimum value for the <meter> element. ...
...And 5 more matches
NSS Tools crlutil
50204153000Z Add an extension to a CRL or a crl certificate entry: addext extension-name critical/non-critical [arg1[arg2 ...]] Where: extension-name: string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. ...
...e critical/non-critical [arg1[arg2 ...]] Where: extension-name: string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. arg1, arg2: specific to extension type extension parameters addext uses the
range that was set earlier by addcert and will install an extension to every cert entries within the
range. See "Implemented extensions" for more information regarding extensions and theirs parameters. Add certificate entries(s) to CRL: addcert
range date Where:
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. date: re...
...ge date Where:
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. date: revocation date of a cert. Date should be represented in GeneralizedTime format (YYYYMMDDhhmmssZ). Remove certificate entry(s) from CRL rmcert
range Where:
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. ...
...And 5 more matches
Document.getElementsByClassName() - Web APIs
rentDOM.getElementsByClassName("test")[0]; // the first element, as we wanted console.log(testTarget); //<p class="test">hello world 2</p> </script> </body> </html> Multiple Classes Example document.getElementsByClassName works very similarly to document.querySelector and document.querySelectorAll. Only elements with ALL of the classNames specified are selected. ...
...mentsByClassName("test")[0]; // the first element, as we wanted console.log(testTarget); //<p class="test">hello world 2</p> </script> </body> </html> Multiple Classes Example document.getElementsByClassName works very similarly to document.querySelector and document.querySelectorAll. Only elements with ALL of the classNames specified are selected. ...
...he first element, as we wanted console.log(testTarget); //<p class="test">hello world 2</p> </script> </body> </html> Multiple Classes Example document.getElementsByClassName works very similarly to document.querySelector and document.querySelectorAll. Only elements with ALL of the classNames specified are selected. ...
...And 5 more matches
Web APIs
uch EventsUURL APIVVibration APIVisual Viewport WWeb AnimationsWeb Audio APIWeb Authentication APIWeb Crypto APIWeb NotificationsWeb Storage APIWeb Workers APIWebGLWebRTCWebVTTWebXR Device APIWebsockets API Interfaces This is a list of all the interfaces (that is, types of objects) that are available. ...
... DataTransferItemList DedicatedWorkerGlobalScope DelayNode DeprecationReportBody DeviceLightEvent DeviceMotionEvent DeviceMotionEventAcceleration DeviceMotionEventRotationRate DeviceOrientationEvent DeviceProximityEvent DirectoryEntrySync DirectoryReaderSync DisplayMediaStreamConstraints Document DocumentFragment DocumentOrShadowRoot DocumentTimeline DocumentTouch DocumentType Double
Range DragEvent DynamicsCompressorNode E EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query EXT_float_blend EXT_frag_depth EXT_sRGB EXT_shader_texture_lod EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic EcKeyGenParams EcKeyImportParams EcdhKeyDeriveParams EcdsaParams EffectTiming Element ElementCSSInlineStyle ElementT...
...reaElement HTMLTimeElement HTMLTitleElement HTMLTrackElement HTMLUListElement HTMLUnknownElement HTMLVideoElement HashChangeEvent Headers History HkdfParams HmacImportParams HmacKeyGenParams I IDBCursor IDBCursorSync IDBCursorWithValue IDBDatabase IDBDatabaseException IDBDatabaseSync IDBEnvironment IDBEnvironmentSync IDBFactory IDBFactorySync IDBIndex IDBIndexSync IDBKey
Range IDBLocaleAwareKey
Range IDBMutableFile IDBObjectStore IDBObjectStoreSync IDBOpenDBRequest IDBRequest IDBTransaction IDBTransactionSync IDBVersionChangeEvent IDBVersionChangeRequest IIRFilterNode IdleDeadline ImageBitmap ImageBitmapRenderingContext ImageCapture ImageData Index InputDeviceCapabilities InputEvent InstallEvent InstallTrigger IntersectionObserver IntersectionObserverE...
...And 5 more matches
Variable fonts guide - CSS: Cascading Style Sheets
TTP requests, and more data being downloaded (usually around 20k or more per file). Variable fonts With a variable font, all of those permutations can be contained in a single file. That file would be larger than a single font, but in most cases smaller or about the same size as the 4 you might load for body copy. The advantage in choosing the variable font is that you have access to the entire
range of weights, widths, and styles available, rather than being constrained to only the few that you previously would have loaded separately. This allows for common typographic techniques such as setting different size headings in different weights for better readability at each size, or using a slightly narrower width for data-dense displays. For comparison, it is typical in a typographic system fo...
...ed separately. This allows for common typographic techniques such as setting different size headings in different weights for better readability at each size, or using a slightly narrower width for data-dense displays. For comparison, it is typical in a typographic system for a magazine to use 10-15 or more different weight and width combinations throughout the publication -- giving a much wider
range of styles than currently typical on the web (or indeed practical for performance reasons alone). A note about font families, weights, and variants You might notice that we have been talking about having a specific font file for every weight and style (i.e. bold and italic and bold italic), rather than relying upon the browser to synthesize them. The reason for this is that most typefaces have v...
...is is sometimes done to reduce the overall file size in cases where the italics aren't needed or used. In all cases, it is still possible to link them with a common font-family name so you can call them using the same font-family and appropriate font-style. ...
...And 5 more matches
HTML documentation index - HTML: Hypertext Markup Language
HTML Microdata, Microdata, Reference The itemprop global attribute is used to add properties to an item. Every HTML element can have an itemprop attribute specified, and an itemprop consists of a name-value pair. Each name-value pair is called a property, and a group of one or more properties forms an item. Property values are either a string or a URL and can be associated with a very wide
range of elements including <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source> , <track>, and <video>. 23 itemref Attribute, Global attribute, HTML, HTML Microdata, Microdata, Reference Properties that are not descendants of an element with the itemscope attribute can be associated with an item using the global attribute itemref. 24 itemscope Attribute, Gl...
...is specified, the input has no size declared, and the form control will be the default width based on the user agent. If CSS targets the element with properties impacting the width, CSS takes precedence. 50 HTML attribute: step Attribute, Attributes, constrain validation, step Valid for the numeric input types, including the date, month, week, time, datetime-local, number and
range types, the step attribute is a number that specifies the granularity that the value must adhere to or the keyword any. 51 The HTML autocomplete attribute Addresses, Attribute, Email addresses, Forms, HTML, Input, Phone Numbers, Reference, Select, Text, Usernames, autocomplete, form, passwords, textarea autocomplete lets web developers specify what if any permission the user a...
...ition, Description Details, Element, HTML, HTML grouping content, Reference, Web, dd, description list, details The HTML <dd> element provides the description, definition, or value for the preceding term (<dt>) in a description list (<dl>). 88 <del>: The Deleted Text element Deleted Text, Element, HTML, HTML edits, Reference, Web, del The HTML <del> element represents a
range of text that has been deleted from a document. 89 <details>: The Details disclosure element Disclosure Box, Disclosure Widget, Element, HTML, HTML interactive elements, Reference, Web, details The HTML Details Element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. 90 <dfn>: The Definitio...
...And 5 more matches
JavaScript error reference - JavaScript
ng? Troubleshooting JavaScript. List of errors In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. ...
...s In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. ...
...sted by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. ...
...And 5 more matches
Web video codec guide - Web media technologies
oding video, and the values to be assigned to those options, will vary not only from one codec to another but depending on the encoding software you use. The documentation included with your encoding software will help you to understand the specific impact of these options on the encoded video. ...
... To resolve this, and to improve seek time through the video data, periodic key frames (also known as intra-frames or i-frames) are placed into the video file. The key frames are full frames, which are used to repair any damage or artifact residue that's currently visible. ...
...did before compression. There are many forms of aliasing; the most common ones you may see include: Moire patterns A Unknown prefix: Moire pattern. is a large-scale spatial interference pattern produced when a pattern in the source image and the manner in which the encoder operates are slightly out of alignment spatially. The artifacts generated by the encoder then introduce st
range, swirling effects in the source image's pattern upon decoding. Staircase effect The staircase effect is a spatial artifact that occurs when diagonal straight or curved edges that should be smooth take on a jagged appearance, looking somewhat like a set of stair steps. This is the effect that is being reduced by "anti-aliasing" filters. Wagon-wheel ...
...And 5 more matches
Tree Selection - Archive of obsolete content
hed to a tree. From the tree, you can get the selection using the tree's view property and then retrieve the view's selection property. You can use the methods of the selection object to retrieve the set of selected items or modify the selection. Because the selected items in a multiple selection tree are not necessarily contiguous, you can retrieve each block of contigous selections using the get
RangeCount() and get
RangeAt() functions. The first function returns the number of selection
ranges there are. If only one value is selected, this value will be 1. You would then write a loop for the number of
ranges, calling get
RangeAt() to get the actual indices of the start and end of the
range. The get
RangeAt() function takes three arguments. The first is the
range index. The second is an objec...
... the number of
ranges, calling get
RangeAt() to get the actual indices of the start and end of the
range. The get
RangeAt() function takes three arguments. The first is the
range index. The second is an object which will be filled in by the function with the index of the first selected item. The third argument is an object which will be filled in with the index of the last selected item. get
RangeAt Example var start = new Object(); var end = new Object(); var num
Ranges = tree.view.selection.get
RangeCount(); for (var t = 0; t < num
Ranges; t++){ tree.view.selection.get
RangeAt(t,start,end); for (var v = start.value; v <= end.value; v++){ alert("Item " + v + " is selected."); } } We create two objects called 'start' and 'end'. Then, we iterate over the set of
ranges, the number of...
...This function will fill in the start and end indicies by assigning them to the 'value' property. ...
...And 4 more matches
source-editor.jsm
to which to return the end offset. aIncludeDelimiter Optional If false, the returned offset is to the first character of the end-of-line delimiter if the specified line (this is the default). If true, the returned offset is the offset to the first character of the following line. Return value The offset to the last character in the specified line, or -1 if the specified line number is out of
range. getLineStart Returns the character offset of the first character of the specified line in the text. Number getLineStart( Number aLineIndex ); Parameters aLineIndex Zero-based offset to the line number to which to return the end offset. Return value The offset to the first character in the specified line, or -1 if the specified line number is out of
range. getMode() Returns the cu...
...ssible values. getSelectedText() Returns the currently-selected text. String getSelectedText(); Parameters None. Return value The currently-selected text in the editor. getSelection() Returns an object indicating the offsets to the first and last characters that are currently selected. Object getSelection(); Parameters None. Return value An object describing the currently selected
range of text in the editor: Property Type Description start Number 0-based offset to the first character in the current selection. end Number 0-based offset to the end of the current selection. The character at this offset is not included in the selection; it's essentially the first character after the selection. If there's no selection, the current...
...sed offset to the first character in the current selection. end Number 0-based offset to the end of the current selection. The character at this offset is not included in the selection; it's essentially the first character after the selection. If there's no selection, the current caret position is returned for both start and end. getText() Returns the text in the specified
range within the editor, or all of the editor's text if no
range is given. String getText( [optional] Number aStart, [optional] Number aEnd ); Parameters aStart Optional The offset to the first character to retrieve. aEnd Optional The offset to the last character to retrieve. If this isn't provided, all text from aStart (or the beginning of the document, if that wasn't provided either) to ...
...And 4 more matches
Index
MDDhhmmssZ). For example: 20050204153000Z * Add an extension to a CRL or a crl certificate entry: addext extension-name critical/non-critical [arg1[arg2 ...]] Where: extension-name: string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. arg1, arg2: specific to extension type extension parameters addext uses the
range that was set earlier by addcert and will install an extension to every cert entries within the
range. * Add certificate entries(s) to CRL: addcert
range date
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. date: revocation date of a cert. ...
...entries(s) to CRL: addcert
range date
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. date: revocation date of a cert. Date should be represented in GeneralizedTime format (YYYYMMDDhhmmssZ). * Remove certificate entry(s) from CRL rmcert
range Where:
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. ...
...dash is used as a delimiter. ...
...And 4 more matches
NSS tools : crlutil
MDDhhmmssZ). For example: 20050204153000Z * Add an extension to a CRL or a crl certificate entry: addext extension-name critical/non-critical [arg1[arg2 ...]] Where: extension-name: string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. arg1, arg2: specific to extension type extension parameters addext uses the
range that was set earlier by addcert and will install an extension to every cert entries within the
range. * Add certificate entries(s) to CRL: addcert
range date
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. date: revocation date of a cert. ...
...entries(s) to CRL: addcert
range date
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. date: revocation date of a cert. Date should be represented in GeneralizedTime format (YYYYMMDDhhmmssZ). * Remove certificate entry(s) from CRL rmcert
range Where:
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. ...
...dash is used as a delimiter. ...
...And 4 more matches
IAccessibleText
t ( 0 based). endOffset Offset of first character after new selection() (0 based). Return value E_INVALIDARG if bad [in] passed. S_OK. attributes() Returns text() attributes. [propget] HRESULT attributes( [in] long offset, [out] long startOffset, [out] long endOffset, [out] BSTR textAttributes ); Parameters offset Text() offset (0 based) startOffset The starting offset of the character
range over which all text() attributes match those of offset. (0 based) endOffset The offset of the first character past the character
range over which all text() attributes match those of offset. (0 based) textAttributes A string of attributes describing the text(). The attributes are described in the; text attributes specification on the IAccessible2 web site. Return value E_INVALIDARG if bad [in] p...
...s in the text() or the height of the preceding character, its width being at least one pixel so that the bounding box is not degenerate. [propget] HRESULT characterExtents( [in] long offset, [in] enum IA2CoordinateType coordType, [out] long x, [out] long y, [out] long width, [out] long height ); Parameters offset Index of the character for which to return its bounding box. The valid
range is 0..length. coordType Specifies if the coordinates are relative to the screen or to the parent window. x X coordinate of the top left corner of the bounding box of the referenced character. y Y coordinate of the top left corner of the bounding box of the referenced character. width Width of the bounding box of the referenced character. height Height of the bounding box of the referenced charact...
...pt engines accessing data out of process or from other threads. Servers only need to save the last removed block of text() and a scope of the entire application is adequate. [propget] HRESULT oldText( [out] IA2TextSegment oldText ); Parameters oldText The text() that was just removed. Return value S_FALSE if there is nothing to return, [out] value is null. S_OK. removeSelection() Unselects a
range of text(). HRESULT removeSelection( [in] long selectionIndex ); Parameters selectionIndex Index of selection() to remove (0 based). Return value E_INVALIDARG if bad [in] passed. S_OK. scrollSubstringTo() Makes a specific part of string visible on screen. HRESULT scrollSubstringTo( [in] long startIndex, [in] long endIndex, [in] enum IA2ScrollType scrollType ); Parameters startIndex 0 ...
...And 4 more matches
nsIScrollable
herits from: nsIScrollable Last changed in Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26) Method overview long getCurScrollPos(in long scrollOrientation); Obsolete since Gecko 29.0 long getDefaultScrollbarPreferences(in long scrollOrientation); void getScrollbarVisibility(out boolean verticalVisible, out boolean horizontalVisible); void getScroll
Range(in long scrollOrientation, out long minPos, out long maxPos); Obsolete since Gecko 29.0 void setCurScrollPos(in long scrollOrientation, in long curPos); Obsolete since Gecko 29.0 void setCurScrollPosEx(in long curHorizontalPos, in long curVerticalPos); Obsolete since Gecko 29.0 void setDefaultScrollbarPreferences(in long scrollOrientation, in long scrollbarPref); ...
... Constant Value Description ScrollOrientation_X 1 ...
... Constant Value Description ScrollOrientation_X 1 Horizontal scrolling. When passing this in to a method you are requesting or setting data for the horizontal scr...
...And 4 more matches
nsISelection2
content/base/public/nsISelection2.idlScriptable Please add a summary to this article. 1.0 66 Introduced Gecko 1.8 Obsolete Gecko 8.0 Inherits from: nsISelection Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) In Gecko 8.0 this Interface was merged into the nsISelectionPrivate interface. ...
...changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) In Gecko 8.0 this Interface was merged into the nsISelectionPrivate interface. ...
....5 / Thunderbird 3.0 / SeaMonkey 2.0) In Gecko 8.0 this Interface was merged into the nsISelectionPrivate interface. ...
...And 4 more matches
IDBIndexSync - Web APIs
from web developers. The IDBIndexSync interface of the IndexedDB API provides synchronous access to an index in a database. ...
...eb developers. The IDBIndexSync interface of the IndexedDB API provides synchronous access to an index in a database. ...
...If this attribute is null, this index i...
...And 4 more matches
String.fromCodePoint() - JavaScript
example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax String.fromCodePoint(num1[, ...[, numN]]) Parameters num1, ..., numN A sequence of code points. Return value A string created by using the specified sequence of code points. Exceptions A
RangeError is thrown if an invalid Unicode code point is given (e.g. "
RangeError: NaN is not a valid code point"). Description This method returns a string (and not a String object). Because fromCodePoint() is a static method of String, you must call it as String.fromCodePoint(), rather than as a method of a String object you created. Polyfill The String.fromCodePoint() method has been added to ...
... index !== len; ++index) { var codePoint = +arguments[index]; // correctly handles all cases including `NaN`, `-Infinity`, `+Infinity` // The surrounding `!(...)` is required to correctly handle `NaN` cases // The (codePoint>>>0) === codePoint clause handles decimals and negatives if (!(codePoint < 0x10FFFF && (codePoint>>>0) === codePoint)) throw
RangeError("Invalid code point: " + codePoint); if (codePoint <= 0xFFFF) { // BMP code point codeLen = codeUnits.push(codePoint); } else { // Astral code point; split in surrogate halves // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae codePoint -= 0x10000; codeLen = codeUnits.push( (codePoint >> 10) + 0xD800, ...
...code points 0x010000 - 0x10FFFF) by specifying their code point. In...
...And 4 more matches
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
d to add the library MozillaInterfaces.jar (located in xulrunner/sdk/lib folder) to your classpath. This library provides the interfaces necessary to bootstrap Mozilla and call XPCOM methods. To start embedding, we use the methods provided by the Mozilla singleton class. ...
... the library MozillaInterfaces.jar (located in xulrunner/sdk/lib folder) to your classpath. This library provides the interfaces necessary to bootstrap Mozilla and call XPCOM methods. To start embedding, we use the methods provided by the Mozilla singleton class. ...
...terfaces.jar (located in xulrunner/sdk/lib folder) to your classpath. This library provides the interfaces necessary to bootstrap Mozilla and call XPCOM methods. To start embedding, we use the methods provided by the Mozilla singleton class. ...
...And 3 more matches
NPN_RequestRead - Archive of obsolete content
Returns If successful, the function returns NPERR_NO_ERROR. ...
... << Gecko Plugin API Reference << Plug-in Side Plug-in API Summary Requests a
range of bytes from a seekable stream. This initiates a read operation; the actual data is received through subsequent calls to NPP_WriteReady() and NPP_Write(). Syntax #include <npapi.h> NPError NPN_RequestRead(NPStream* stream, NPByte
Range*
rangeList); Parameters The function has the following parameters: stream Stream of type NP_SEEK from which to read bytes.
rangeList
Range of bytes in the form of a linked list of NPByte
Range objects, each of which specifies a request for a
range of bytes. Returns If successful, the function returns NPERR_NO_ERROR. If unsuccessful, the function returns an error code. For possible values, see Error Codes. Description For a...
...eturns If successful, the function returns NPERR_NO_ERROR. If unsuccessful, the function returns an error code. For possible values, see Error Codes. Description For a seekable stream, the browser sends data only in response to requests by the plug-in. The plug-in calls NPN_RequestRead() to request data from a seekable stream. ...
...And 3 more matches
CSS - Archive of obsolete content
-fillThe ::-ms-fill CSS pseudo-element is a Microsoft extension that represents a progress bar displayed by <progress>.::-ms-fill-lowerThe ::-ms-fill-lower CSS pseudo-element represents the lower portion of the track of a slider control; that is, the portion corresponding to values less than the value currently selected by the thumb. ...
...by the thumb. A slider control is one possible representation of <input type="
range">.::-ms-fill-upperThe ::-ms-fill-upper CSS pseudo-element is a Microsoft extension that represents the upper portion of the track of a slider control; that is, the portion corresponding to values greater than the value currently selected by the thumb. A slider control is one possible representation of <input type="
range">.::-ms-revealThe ::-ms-reveal CSS pseudo-element is a Microsoft extension that is used to display a password reveal button for use with a password field created by <input type="password">. The user presses the button to reveal the actual field value rather than asterisks.::-ms-thumbThe ::-ms-thumb CSS pseudo-element is a Microsoft extension that represents the thumb that the user moves within th...
...on for use with a password field created by <input type="password">. The user presses the button to reveal the actual field value rather than asterisks.::-ms-thumbThe ::-ms-thumb CSS pseudo-element is a Microsoft extension that represents the thumb that the user moves within the track of a slider control to alter its numerical value. ...
...And 3 more matches
Profiling with the Firefox Profiler
he user to pan and zoom around thanks to APZ. Tracing markers Red: These indicate that the event loop is being unresponsive. Note that high priority events such as vsync are not included here. Also note that this indicates what would have happened had there been an event waiting and not necessarily that there was an event pending for that long. Black: These indicate synchronous IPC calls.
Ranges
Ranges of time can be zoomed in on by clicking and dragging anywhere in the tracing marker or thread areas. Once a
range is selected, a magnifying glass appears which zooms into that
range. Clicking on a tracing marker will create a selection corresponding with its duration allowing for easy zooming in on interesting time
ranges. As you zoom in on
ranges, breadcrumbs are created allowing you ...
... Thread Timeline(s) Thread/Process Timelines: Below the tracing markers we have a list of profiled threads. ...
...r or thread areas. Once a
range is selected, a magnifying glass appears which zooms into that
range. Clicking on a tracing marker will create a selection corresponding with its duration allowing for easy zooming in on interesting time
ranges. As you zoom in on
ranges, breadcrumbs are created allowing you to easily navigate back to previously-selected
ranges or the entire profile (denoted as "Full
Range"). Tip: While zooming out to a previously-selected
range deletes the narrower
range, the browser back button can be used to restore the narrower
range. Thread Timeline(s) Thread/Process Timelines: Below the tracing markers we have a list of profiled threads. These threads may come from different processes. In this case, we have the 'GeckoMain [default]' process' main thread, a content proces...
...And 3 more matches
Python binding for NSS
textual data. ...
...ELEASE_0_16_0/src/ Change Log The primary enhancements in this version is adding support for the setting trust attributes on a Certificate, the SSL version
range API, information on the SSL cipher suites and information on the SSL connection. ...
... The primary enhancements in this version is adding support for the setting trust attributes on a Certificate, the SSL version
range API, information on the SSL cipher suites and information on the SSL connection. ...
...And 3 more matches
Redis Tips
li. Things are Strings, Mostly As you can see from that last example, the values pointed to by keys are strings or they are nil. Nil values will be given as null in node, not undefined. But some commands only work with numbers (like INCR); for these, if your key can't be parsed as a number, it's an error: redis> set foo pie OK redis> incr foo (error) ERR value is not an integer or out of
range Atomic Counters I guess that sounds like Geiger counters. I mean counters you can update atomically. GET key SET key value EXISTS key SETNX key value INCR key INCRBY key int INCRBYFLOAT key float GETSET key value GET and SET are fairly obvious. SETNX sets a value on a key only if there is no existing value. This is so useful. And it is a single, atomic command. redis> get f...
... console.log(JSON.stringify(results, null, 2)) } Whenever someone logs into my site, I record them in my 'last-login' zset. I'll simulate some logins like so: > r.zadd('last-login', now(), 'lloyd'); > r.zadd('last-login', now(), 'jparsons'); > r.zadd('last-login', now(), 'zarter'); > r.zadd('last-login', now(), 'lloyd'); // he logged in again! w00t! Here's what the zset contains now: > r.z
range('last-login', 0, -1, print); // remember, I defined 'print' above ["jparsons", "zcarter", "lloyd"] Since this is a set, lloyd only appears once, with updated login timestamp. Z
RANGE gives you everything in the zset, in order of score, from the beginning offset to the end offset. (0 from the front, -1 from the end.) As you can see, the scores are sorted smallest to biggest. To get the mo...
... As a rule, the name of the optional argument is given as a string in the node function call. ...
...And 3 more matches
Mailnews and Mail code review requirements
mit it. A bug should be filed on the needed test framework. The in-testsuite? flag should be set on the bug until the framework has been completed and the test code is running automatically. Certain build-config or tooling bugs which don't affect the actual product cannot be usefully tested. These bugs should have the in-testsuite- flag set. ...
...mework has been completed and the test code is running automatically. Certain build-config or tooling bugs which don't affect the actual product cannot be usefully tested. These bugs should have the in-testsuite- flag set. Rubber-Stamp Approvals for Intermittently Failing ("O
range") Test Fixes/Debugging In order to make it easier to debug and fix tests that fail intermittently ("intermittent o
range" tests), we have created the following two rubber-stamps based on this proposal on the tb-planning mailing list. ...
...ld have the in-testsuite- flag set. Rubber-Stamp Approvals for Intermittently Failing ("O
range") Test Fixes/Debugging In order to make it easier to debug and fix tests that fail intermittently ("intermittent o
range" tests), we have created the following two rubber-stamps based on this proposal on the tb-planning mailing list. The procedure to use these is to be sure to: include "rs=simple-o
range-fix" or "rs=o
range-debugging" in the first line of the commit message paste a link to the pushed commit with the rubber stamp in the bug make sure you pasted a link to any try-server pushes of the patch in the bug rs=simple-o
range-fix Requirements: The patch is fixing an intermittent o
range test failure. The patch is a change exclusively to test logic. The patch has identified a likely ...
...And 3 more matches
DocumentOrShadowRoot.caretPositionFromPoint() - Web APIs
low the demo. Demo HTML Content <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. ...
...pscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. ...
... aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. ...
...And 3 more matches
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
: black; -moz-appearance: progressbar; -webkit-appearance: progressbar; } <div>Lorem</div> Firefox The element is styled like a progress bar. ...
...: progressbar; } <div>Lorem</div> Firefox The element is styled like a progress bar. ...
...>Lorem</div> Firefox The element is styled like a progress bar. ...
...And 3 more matches
<color> - CSS: Cascading Style Sheets
lues may differ from the corresponding color on X11 systems since manufacturers sometimes tailor X11 colors to their specific hardware. Note: The list of accepted keywords has undergone many changes during the evolution of CSS: CSS Level 1 only included 16 basic colors, called the VGA colors as they were taken from the set of displayable colors on VGA graphics cards. CSS Level 2 added the o
range keyword. Although various colors not in the specification (mostly adapted from the X11 colors list) were supported by early browsers, it wasn't until SVG 1.0 and CSS Colors Level 3 that they were formally defined. They are called the extended color keywords, the X11 colors, or the SVG colors. CSS Colors Level 4 added the rebeccapurple keyword to honor web pioneer Eric Meyer. Specifi...
... maroon #800000 red #ff0000 purple #800080 fuchsia #ff00ff green #008000 lime #00ff00 olive #808000 yellow #ffff00 navy #000080 blue #0000ff teal #008080 aqua #00ffff CSS Level 2 (Revision 1) o
range #ffa500 CSS Color Module Level 3 aliceblue #f0f8ff antiquewhite #faebd7 aquamarine #7fffd4 azure #f0ffff beige #f5f5dc bisque #ffe4c4 blanchedalmond #ffebcd blueviolet #8a2be2 brown #a52a2a burlywood #deb887 cadetblue ...
...rimson #dc143c cyan (synonym of aqua) #00ffff darkblue #00008b darkcyan #008b8b darkgoldenrod #b8860b darkgray #a9a9a9 darkgreen #006400 darkgrey #a9a9a9 darkkhaki #bdb76b darkmagenta #8b008b darkolivegreen #556b2f darko
range #ff8c00 darkorchid #9932cc darkred #8b0000 darksalmon #e9967a darkseagreen #8fbc8f darkslateblue #483d8b darkslategray #2f4f4f darkslategrey #2f4f4f darkturquoise #00ced1 darkviolet #9400d3 deeppink #ff1493 deepskyblue #...
...And 3 more matches
Audio and Video Delivery - Developer guides
Encrypted Media Extensions is a W3C proposal to extend HTMLMediaElement, providing APIs to control playback of protected content. The API supports use cases ranging from simple clear key decryption to high value video (given an appropriate user agent implementation). License/key exchange is controlled by the application, facilitating the development of robust playback applications supporting a
range of content decryption and protection technologies. One of the principle uses of EME is to allow browsers to implement DRM (Digital Rights Management), which helps to prevent web-based content (especially video) from being copied. Adaptive Streaming New formats and protocols are being rolled out to facilitate adaptive streaming. Adaptive streaming media means that the bandwidth and typically ...
...nts provide support for moving the current playback position to specific points in the media's content. This is done by setting the value of the currentTime property on the element; see HTMLMediaElement for further details on the element's properties. Simply set the value to the time, in seconds, at which you want playback to continue. You can use the element's seekable property to determine the
ranges of the media that are currently available for seeking to. This returns a Time
Ranges object listing the
ranges of times that you can seek to. var mediaElement = document.querySelector('#mediaElementID'); mediaElement.seekable.start(0); // Returns the starting time (in seconds) mediaElement.seekable.end(0); // Returns the ending time (in seconds) mediaElement.currentTime = 122; // Seek to 122...
... that you can seek to. ...
...And 3 more matches
HTML attribute: min - HTML: Hypertext Markup Language
valid for the input containing the attribute. If the value of the element is less than this, the element fails constraint validation. This value must be less than or equal to the value of the max attribute. If a value is specified for min that isn't a valid number, the input has no minimum value. Valid for the numeric input types, including the date, month, week, time, datetime-local, number and
range types, and the <meter> element, the min attribute is a number that specifies the most negative value a form control to be considered valid. Syntax If any is not explicity set, valid values for the number, date/time input types, and
range input types are equal to the basis for stepping - the min value and increments of the step value, up to the max value, if specified. For example, if we have <...
... For the <meter> element, the min attribute defines the lower numeric bound of the...
...This must be less...
...And 3 more matches
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, labelable content, palpable content. Permitted content Phrasing content, but there must be no <meter> element among its descendants. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. ...
...orresponding role Permitted ARIA roles No role permitted DOM interface HTMLMeterElement Attributes This element includes the global attributes. value The current numeric value. This must be between the minimum and maximum values (min attribute and max attribute) if they are specified. If unspecified or malformed, the value is 0. If specified, but not within the
range given by the min attribute and max attribute, the value is equal to the nearest end of the
range. Note: Unless the value attribute is between 0 and 1 (inclusive), the min and max attributes should define the
range so that the value attribute's value is within it. min The lower numeric bound of the measured
range. This must be less than the maximum value (max attribute), if specified. If unsp...
...This must be greater than the minimum value (min attribute), and it also must be less than the high value and maximum value (high attribute and max attribute, respectively), if any are specified. ...
...And 3 more matches
Index - HTTP
programming languages.) Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Language response header. Browsers set adequate values for this header according to their user interface language and even if a user can change it, this happens rarely (and is frowned upon as it leads to fingerprinting). 6 Accept-
Ranges HTTP, HTTP Header,
Range Requests, Reference, Response Header The Accept-
Ranges response HTTP header is a marker used by the server to advertise its support of partial requests. The value of this field indicates the unit that can be used to define a
range. 7 Access-Control-Allow-Credentials CORS, HTTP, Reference, header The Access-Control-Allow-Credentials response...
...rs, Reference The Content-Length entity header indicates the size of the entity-body, in bytes, sent to the recipient. 26 Content-Location HTTP, Reference, header The Content-Location header indicates an alternate location for the returned data. The principal use is to indicate the URL of a resource transmitted as the result of content negotiation. 27 Content-
Range HTTP, HTTP Header, Reference, Response Header, header The Content-
Range response HTTP header indicates where in a full body message a partial message belongs. 28 Content-Security-Policy CSP, HTTP, Reference, Security, header The HTTP Content-Security-Policy response header allows web site administrators to control resources the user agent is allowed to load for a gi...
...ce, Request header The If-None-Match HTTP request header makes the request conditional. For GET and HEAD methods, the server will send back the requested resource, with a 200 status, only if it doesn't have an ETag matching the given ones. For other methods, the request will be processed only if the eventually existing resource's ETag doesn't match any of the values listed. 80 If-
Range Condtional Requests, HTTP, HTTP Header,
Range Requests, Reference, Request header The If-
Range HTTP request header makes a
range request conditional: if the condition is fulfilled, the
range request will be issued and the server sends back a 206 Partial Content answer with the appropriate body. If the condition is not fulfilled, the full resource is sent back, with a 200 OK status. ...
...And 3 more matches
The "codecs" parameter in common media types - Web media technologies
.709). mc The two-digit matrix_coefficients constant selects the matrix coefficients used to convert the red, blue, and green channels into luma and chroma signals. For example, the standard coefficients used for BT.709 are indicated using the value 01. The default value is 01 (ITU-R BT.709). F A one-digit flag indicating whether the color should be allowed to use the full
range of possible values (1), or should be constrained to those values considered legal for the specified color configuration (that is, the studio swing representation). The default is 0 (use the studio swing representation). All fields from M (monochrome flag) onward are optional; you may stop including fields at any point (but can't arbitrarily leave out fields). The default values are include...
...p4a.40.17. Single digit values can be given either as one digit (which is the best choice, since it will be the most broadly compatible) or with a leading zero padding it to two digits, such as mp4a.40.02. Note: The specification originally mandated that the Audio Object Type number in the third component be only one decimal digit. However, amendments to the specification over time extended the
range of these values well beyond one decimal digit, so now the third parameter may be either one or two digits. Padding values below 10 with a leading 0 is optional. Older implementations of MPEG-4 codecs may not support two-digit values, however, so using a single digit when possible will maximize compatibility. The Audio Object Types are defined in ISO/IEC 14496-3 subpart 1, section 1.5.1. The tab...
... ISO/IEC Color primary identifiers Value Details 00 Reserved for future use by ITU or ISO/IEC 01 BT.709, sRGB, sYCC. BT.709 is the standard for high definition (HD) television; sRGB is the most common color space used for computer displays. Broadcast BT.709 uses 8-bit color depth with the legal
range being from 16 (black) to 235 (white). 02 Image characteristics are unknown, or are to be determined by the application 03 Reserved for future use by ITU or ISO/IEC 04 BT.470 System M, NTSC (standard definition television in the United States) 05 BT.470 System B, G; BT.601; BT.1358 625; ...
...And 3 more matches
SVG documentation index - SVG: Scalable Vector Graphics
erscript. 33 bbox Deprecated, SVG, SVG Attribute The bbox attribute defines the maximal bounding box of a font. 34 begin NeedsCompatTable, SVG, SVG Attribute The begin attribute defines when an animation should begin or when an element should be discarded. 35 bias Filters, NeedsExample, SVG, SVG Attribute The bias attribute shifts the
range of the filter. After applying the kernelMatrix of the <feConvolveMatrix> element to the input image to yield a number and applied the divisor attribute, the bias attribute is added to each component. This allows representation of values that would otherwise be clamped to 0 or 1. 36 by SVG, SVG Attribute The by attribute specifies a relative offset value for an attribute that ...
...VG Attribute, filter The type attribute is a generic attribute and it has different meaning based on the context in which it's used. ...
... 228 underline-position Attribute, Reference, Reference(2), SVG, font The underline-position attribute represents the ideal vertical position of the underline. The underline position is expressed in the font's coordinate system. ...
...And 3 more matches
indexed-db - Archive of obsolete content
rds. Here's a complete add-on that adds two buttons to the browser: the button labeled "Add" adds the title of the current tab to a database, while the button labeled "List" lists all the titles in the database. The add-on implements helper functions open(), addItem() and getItems() to open the database, add a new item to the database, and get all items in the database. ...
...e = new Date().getTime(); var request = store.put({ "name": name, "time": time }); request.onerror = database.onerror; }; function getItems(callback) { var cb = callback; var db = database.db; var trans = db.transaction(["items"], "readwrite"); var store = trans.objectStore("items"); var items = new Array(); trans.oncomplete = function() { cb(items); } var key
Range = IDBKey
Range.lowerBound(0); var cursorRequest = store.openCursor(key
Range); cursorRequest.onsuccess = function(e) { var result = e.target.result; if(!!result == false) return; items.push(result.value.name); result.continue(); }; cursorRequest.onerror = database.onerror; }; function listItems(itemList) { console.log(itemList); } open("1"); var add = require("...
... DOMException Provides more detailed information about an exception. See the DOMException documentation. ...
...And 2 more matches
Index - Archive of obsolete content
437 International characters in XUL JavaScript Firefox, Gecko, Guide, Internationalization, JavaScript, Mozilla, XPCOM, XUL Gecko 1.8, as used in Firefox 1.5 and other applications, added support for non-ASCII characters in JavaScript files loaded from XUL files. 438 Introduction to XUL Guide, XUL Mozilla has configurable, downloadable chrome, meaning that the ar
rangement and even presence or absence of controls in the main window is not hardwired into the application, but loaded from a separate UI description. In fact, most of Mozilla's windows (and dialogs) will be described using this mechanism. XUL (pronounced "zool," as if that spelling helped any, and short for "XML User Interface Language") is our name for the language in which these UI descriptions are...
... 571 scrollByPixels XUL Methods, XUL Reference No summary! 572 scrollToIndex XUL Methods, XUL Reference No summary! 573 select XUL Methods, XUL Reference No summary! 574 selectAll XUL Methods, XUL Reference No summary! 575 selectItem XUL Methods, XUL Reference No summary! 576 selectItem
Range XUL Methods, XUL Reference No summary! 577 selectTabAtIndex Method, Reference, Reference(2), XUL, XUL Methods, XUL Reference No summary! 578 setIcon XUL, XUL Methods, XUL Reference No summary! 579 setSelection
Range XUL Methods, XUL Reference No summary! 580 showOnlyTheseTabs Method, Reference, Reference(2), XU...
...checked menus 1047 More Tree Features Tutorials, XUL, XUL_Tutorial Here, we'll see more features of trees. 1048 More Wizards Tutorials, XUL, XUL_Tutorial This section describes some additional features of wizards. 1049 Numeric Controls Firefox 3, Tutorials, XUL, XUL_Tutorial XUL has two elements used for the entry of numeric values or
ranges, and well as two elements for entering dates and times. These elements are only available in Firefox 3 and later. 1050 Open and Save Dialogs Tutorials, XUL, XUL_Tutorial A common type of dialog is one where the user can select a file to open or save. 1051 Persistent Data Tutorials, XUL, XUL_Tutorial No summary! 1052 Popup Menus Tutorials, ...
...And 2 more matches
Numeric Controls - Archive of obsolete content
These elements are only available in Firefox 3 and later. Number Fields A textbox may be used for entering numbers by setting the value of the type attribute to the value number. This type of textbox may only be used to enter numbers. Other characters are not allowed and are just ignored if typed. In addition, arrow buttons appear beside the textbox to allow the user to cycle through the values. As with other textboxes, the default value can be specified with the value attribute. Naturally, this value should be a number. ...
...ed and are just ignored if typed. In addition, arrow buttons appear beside the textbox to allow the user to cycle through the values. As with other textboxes, the default value can be specified with the value attribute. Naturally, this value should be a number. However, the minimum and maximum values can also be specified using the min and max attributes. If these are set, you can control the
range of values that the textbox may be set to. If the user enters a value less or greater than this value, it will be reset to the minimum or maximum value as necessary. For instance, the following numeric textbox has a
range between 1 and 20. <textbox type="number" min="1" max="20"/> As the default value isn't specified, it will default to 1, the minimum value. The min attribute is set to 1 to indic...
...ute indicates how many decimal places to show. The default value is 0, which means show integers only. However a different value may be used to show decimal values. <textbox type="number" decimalplaces="2"/> In this example, two digits right of the decimal point are shown. Values with additional fractional digits are rounded to two digits. Scales A scale element may also be used to select from a
range of values. Instead of a textbox however, a sliding scale is used. The user may drag the thumb of the scale to adjust the value. Many of the same attributes as a numeric textbox may be used with a scale: value, min, max and increment may all be used in a similar fashion. The scale does not actually show the value as a number, but it may be used in a script. A scale will fire a change event whe...
...And 2 more matches
listbox - Archive of obsolete content
ems, selType, suppressOnSelect, tabIndex, value Methods addItemToSelection, appendItem, clearSelection, ensureElementIsVisible, ensureIndexIsVisible, getIndexOfFirstVisibleRow, getIndexOfItem, getItemAtIndex, getNumberOfVisibleRows, getRowCount, getSelectedItem, insertItemAt, invertSelection, moveByOffset, removeItemAt, removeItemFromSelection, scrollToIndex, selectAll, selectItem, selectItem
Range, timedSelect, toggleItemSelection Examples <listbox id="theList"> <listitem label="Ruby"/> <listitem label="Emerald"/> <listitem label="Sapphire" selected="true"/> <listitem label="Diamond"/> </listbox> <listbox id="theList" rows="10" width="400"> <listhead> <listheader label="1ct Gem" width="240"/> <listheader label="Price" width="150"/> </listhead> <listcols> ...
...el, value ) Return type: element This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned. invertSelection() Return type: no return value Reverses the selected state of all items. Selected items become deselected, and deselected items become selected. ...
...Items that are hidden are skipped. ...
...And 2 more matches
richlistbox - Archive of obsolete content
You can click on any richlistitem element and use the keyboard to move ...
..., value ) Return type: element This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned. invertSelection() Return type: no return value Reverses the selected state of all items. Selected items become deselected, and deselected items become selected. ...
...Items that are hidden are skipped. ...
...And 2 more matches
sslfnc.html
Parameters This function has the parameters listed below. maxCacheEntries The maximum number of entries in the cache. If a NULL value is passed, the server default value of 10,000 is used. timeout The lifetime in seconds of an SSL2 session. The minimum timeout value is 5 seconds and the maximum is 24 hours. Values outside this
range are replaced by the server default value of 100 seconds. ssl3_timeout The lifetime in seconds of an SSL3 session. The minimum timeout value is 5 seconds and the maximum is 24 hours. Values outside this
range are replaced by the server default value of 24 hours. directory A pointer to a string specifying the pathname of the directory ...
...ssion cache, or server cache), and theclient-auth certificate cache (also called the client cert cache, or client auth cache). Both caches are used only for sessions where the program handshakes as a server. The client-auth certificate cache is used to remember the certificates previously presented by clients for client certificate authentication. Passing a NULL value or a value that is out of
range for any of the parameters causes the server default value to be used in the server cache. The values that you pass affect only the server cache, not the client cache. Initializing Multi-Processing with a Shared SSL Server Cache To start a multi-processing application, the initial parent process calls SSL_ConfigMPServerSIDCache, and then creates child processes, by one of these methods: ...
... Parameters This function has the parameters listed below. maxCacheEntries The maximum number of entries in the cache. If a NULL value is passed, the server default value of 10,000 is used. timeout The lifetime in seconds of an SSL2 session. The minimum timeout value is 5 seconds and the maximum is 24 hours. Values outside this
range are replaced by the server default value of 100 seconds. ssl3_timeout The lifetime in seconds of an SSL3 session. The minimum timeout value is 5 seconds and the maximum is 24 hours. Values outside this
range are replaced by the server default value of 24 hours. directory A pointer to a string specifying the pathname of the directory ...
...And 2 more matches
nsIEditorIMESupport
Read only. Methods Native code only!beginComposition Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some bro...
...Read only. Methods Native code only!beginComposition Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some browsers, its use is ...
... Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. ...
...And 2 more matches
nsITreeBoxObject
void scrollToCell(in long row, in nsITreeColumn col); void scrollToColumn(in nsITreeColumn col); void scrollToHorizontalPosition(in long horizontalPosition); void invalidate(); void invalidateColumn(in nsITreeColumn col); void invalidateRow(in long index); void invalidateCell(in long row, in nsITreeColumn col); void invalidate
Range(in long startIndex, in long endIndex); void invalidateColumn
Range(in long startIndex, in long endIndex, in nsITreeColumn col); long getRowAt(in long x, in long y); void getCellAt(in long x, in long y, out long row, out nsITreeColumn col, out ACString childElt); void getCoordsForCellItem(in long row, in nsITreeColumn col, in ACString element, out long x, out lon...
...f possible). void scrollToColumn(in nsITreeColumn col); Parameters col The nsITreeColumn to scroll to scrollToHorizontalPosition() Scroll to a specific horizontal pixel position. ...
...lToColumn(in nsITreeColumn col); Parameters col The nsITreeColumn to scroll to scrollToHorizontalPosition() Scroll to a specific horizontal pixel position. ...
...And 2 more matches
Document - Web APIs
the document's content), else false. Document.xmlVersion Obsolete since Gecko 10 Returns the version number as specified in the XML declaration or "1.0" if the declaration is absent. Methods This interface also inherits from the Node and EventTarget interfaces. Document.adoptNode() Adopt node from an external document. Document.captureEvents() See Window.captureEvents. Document.caret
RangeFromPoint() Gets a
Range object for the document fragment under the specified coordinates. Document.createAttribute() Creates a new Attr object and returns it. Document.createAttributeNS() Creates a new attribute node in a given namespace and returns it. Document.createCDATASection() Creates a new CDATA node and returns it. Document.createComment() Creates a new comment node and returns...
... Document.createElementNS() Creates a new element with the given tag name and namespace URI. Document.createEntityReference() Creates a new entity reference object and returns it. Document.createEvent() Creates an event object. Document.createNodeIterator() Creates a NodeIterator object. Document.createProcessingInstruction() Creates a new ProcessingInstruction object. Document.create
Range() Creates a
Range object. Document.createTextNode() Creates a text node. Document.createTouch() Creates a Touch object. Document.createTouchList() Creates a TouchList object. Document.createTreeWalker() Creates a TreeWalker object. Document.enableStyleSheetsForSet() Enables the style sheets for the specified style sheet set. Document.exitPointerLock() Release the pointer lock. D...
...On an editable document, executes a formating command. Document.getElementsByName() Returns a list of elements with the given name. Document.hasFocus() Returns true if the focus is currently located anywhere inside the specified document. Document.open() Opens a document stream for writing. Document.queryCommandEnabled() Returns true if the formating command can be executed on the current
range. Document.queryCommandIndeterm() Returns true if the formating command is in an indeterminate state on the current
range. Document.queryCommandState() Returns true if the formating command has been executed on the current
range. Document.queryCommandSupported() Returns true if the formating command is supported on the current
range. Document.queryCommandValue() Returns the current value o...
...And 2 more matches
HTMLTextAreaElement - Web APIs
was performed in the start-to-end direction of the current locale, or "backward" for the opposite direction. This can also be "none" if the direction is unknown. selectionEnd unsigned long: Returns / Sets the index of the end of selected text. If no text is selected, contains the index of the character that follows the input cursor. ...
... tabIndex long: Returns / Sets the position of the element in the tabbing navigation order for the current document. textLength Read only long: Returns the codepoint length of the control's value. ...
... inherited from HTMLElement from HTML5 on, but were defined on HTMLTextAreaElement in DOM Level 2 HTML and earlier specifications. Methods blur() Removes focus from the control; keystrokes will subsequently go nowhere. focus() Gives focus to the control; keystrokes will subsequently go to this element. select() Selects the contents of the control. set
RangeText() Replaces a
range of text in the element with new text. setSelection
Range() Selects a
range of text in the element (but does not focus it). checkValidity() Returns false if the element is a candidate for constraint validation, and it does not satisfy its constraints. In this case, it also fires a cancelable invalid event at the control. It returns true if the contr...
...And 2 more matches
IDBIndex - Web APIs
n index are automatically populated whenever records in the referenced object store are inserted, updated, or deleted. Each record in an index can point to only one record in its referenced object store, but several indexes can reference the same object store. When the object store changes, all indexes that refers to the object store are automatically updated. You can grab a set of keys within a
range. To learn more, see IDBKey
Range. Note: This feature is available in Web Workers. Properties IDBIndex.isAutoLocale Read only Returns a Boolean indicating whether the index had a locale value of auto specified upon its creation (see createIndex()'s optionalParameters.) IDBIndex.locale Read only Returns the locale of the index (for example en-US, or pl) if it had a locale value specifi...
...array. If true, there is one record in the index for each item in an array of keys. If false, then there is one record for each key that is an array. IDBIndex.unique Read only If true, this index does not allow duplicate values for a key. Methods Inherits from: EventTarget IDBIndex.count() Returns an IDBRequest object, and in a separate thread, returns the number of records within a key
range. IDBIndex.get() Returns an IDBRequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is an IDBKey
Range. IDBIndex.getKey() Returns an IDBRequest object, and, in a separate thread, finds either the given key or the primary key, if key is an IDBKey
Range. IDBIndex.getAll() Return...
... to the given key or the first corresponding value, if key is an IDBKey
Range. IDBIndex.getKey() Returns an IDBRequest object, and, in a separate thread, finds either the given key or the primary key, if key is an IDBKey
Range. IDBIndex.getAll() Returns an IDBRequest object, in a separate thread, finds all matching values in the referenced object store that correspond to the given key or are in
range, if key is an IDBKey
Range. IDBIndex.getAllKeys() Returns an IDBRequest object, in a separate thread, finds all matching keys in the referenced object store that correspond to the given key or are in
range, if key is an IDBKey
Range. IDBIndex.openCursor() Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key
range. IDBIndex.openKeyCursor() Returns an...
...And 2 more matches
Basic concepts - Web APIs
nt to only one record in its referenced object store, but several indexes can reference the same object store. When the object store changes, all indexes that refer to the object store are automatically updated. Alternatively, you can also look up records in an object store using the key. To learn more on using indexes, see Using IndexedDB. For the reference documentation on index, see IDBKey
Range. Key and value key A data value by which stored values are organized and retrieved in the object store. The object store can derive the key from one of three sources: a key generator, a key path, or an explicitly specified value. The key must be of a data type that has a number that is greater than the one before it. Each record in an object store must have a key that is unique within t...
...r an explicitly specified value. The key must be of a data type that has a number that is greater than the one before it. Each record in an object store must have a key that is unique within the same store, so you cannot have multiple records with the same key in a given object store. A key can be one of the following types: string, date, float, a binary blob, and array. For arrays, the key can
range from an empty value to infinity. And you can include an array within an array. Alternatively, you can also look up records in an object store using the index. key generator A mechanism for producing new keys in an ordered sequence. If an object store does not have a key generator, then the application must provide keys for records being stored. Generators are not shared between stores. This...
...It cannot include spaces. value Each record has a value, which could include anything that can be expressed in JavaScript, including boolean, number, string, date, object, array, regexp, undefined, and null. When an object or array is stored, the properties and values in that object or array can also be anything that is a valid value. Blobs and files can be stored, cf. specification .
Range and scope scope The set of object stores and indexes to which a transaction applies. The scopes of read-only transactions can overlap and execute at the same time. On the other hand, the scopes of writing transactions cannot overlap. You can still start several transactions with the same scope at the same time, but they just queue up and execute one after another. cursor A mechanism for ite...
...And 2 more matches
MediaTrackConstraints - Web APIs
The MediaTrackConstraints dictionary is used to describe a set of capabilities and the value or values each can take on. A constraints dictionary is passed into applyConstraints() to allow a script to establish a set of exact (required) values or
ranges and/or preferred values or
ranges of values for the track, and the most recently-requested set of custom constraints can be retrieved by calling getConstraints(). For each constraint, you can typically specify an exact value you need, an ideal value you want, a
range of acceptable values, and/or a value which you'd like to be as close to as possible. The specifics vary somewhat depending on the type of the constrainable property. To learn more about how constraints work, see Capabilities, constraints, and settings. Properties Some combinati...
... an array of device IDs which are acceptable and/or required. groupId A ConstrainDOMString object specifying a group ID or an array of group IDs which are acceptable and/or required. Properties of audio tracks autoGainControl A ConstrainBoolean object which specifies whether automatic gain control is preferred and/or required. channelCount A ConstrainLong specifying the channel count or
range of channel counts which are acceptable and/or required. echoCancellation A ConstrainBoolean object specifying whether or not echo cancellation is preferred and/or required. latency A ConstrainDouble specifying the latency or
range of latencies which are acceptable and/or required. noiseSuppression A ConstrainBoolean which specifies whether noise suppression is preferred and/or required. sa...
... echoCancellation A ConstrainBoolean object specifying whether or not echo cancellation is preferred and/or required. latency A ConstrainDouble specifying the latency or
range of latencies which are acceptable and/or required. noiseSuppression A ConstrainBoolean which specifies whether noise suppression is preferred and/or required. sampleRate A ConstrainLong specifying the sample rate or
range of sample rates which are acceptable and/or required. sampleSize A ConstrainLong specifying the sample size or
range of sample sizes which are acceptable and/or required. volume A ConstrainDouble specifying the volume or
range of volumes which are acceptable and/or required. Properties of image tracks whiteBalanceMode A String specifying one of "none", "manual", "single-shot", or "conti...
...And 2 more matches
WebGL best practices - Web APIs
Set up your hot framebuffers ahead of time. In Firefox, setting the pref w...
...your precision requirements, getShaderPrecisionFormat() will tell you what the system supports. If highp float is available, GL_FRAGMENT_PRECISION_HIGH will be defined as 1. ...
...else precision mediump float; #endif ESSL100 minimum requirements (WebGL 1) float think
range min above zero precision highp float24* (-2^62, 2^62) 2^-62 2^-16 relative mediump IEEE float16 (-2^14, 2^14) 2^-14 2^-10 relative lowp 10-bit signed fixed (-2, 2) 2^-8 2^-8 absolute int think
range highp int17 (-2^16, 2^16) mediump int11 (-2^10, 2^10) lowp int9 (-2^8, 2^8) *float24: sign bit, 7-bit for exponent, 16-bit for mantissa ESSL300 minimum requirements (WebGL 2) float think
range min above zero precision highp IEEE float32 (-2^126, 2^127) 2^-126 2^-24 relative mediump ...
...And 2 more matches
Example and tutorial: Simple synth keyboard - Web APIs
for configuring the layer. For now, we will have two controls: one to set the master volume and another to select what periodic waveform to use when generating notes. The volume control First we create the <div> to contain the settings bar, so it can be styled as needed. ...
...ring the layer. For now, we will have two controls: one to set the master volume and another to select what periodic waveform to use when generating notes. The volume control First we create the <div> to contain the settings bar, so it can be styled as needed. Then we establish a box that will be presented on the left side of the bar and place a label and an <input> element of type "
range". ...
...be styled as needed. Then we establish a box that will be presented on the left side of the bar and place a label and an <input> element of type "
range". The
range element will typically be presented as a slider control; we configure it to allow any value between 0.0 and 1.0, stepping by 0.01 each position. ...
...And 2 more matches
Accessibility documentation index - Accessibility
aria-required attribute is used to indicate that user input is required on an element before a form can be submitted. This attribute can be used with any typical HTML form element; it is not limited to elements that have an ARIA role assigned. 26 Using the aria-valuemax attribute ARIA, Accessibility The aria-valuemax attribute is used to define the maximum value allowed for a
range widget such as a slider, spinbutton or progressbar. 27 Using the aria-valuemin attribute ARIA, Accessibility, NeedsContent The aria-valuemin attribute is used to define the minimum value allowed for a
range widget such as a slider, spinbutton or progressbar. If the aria-valuenow has a known maximum and minimum, the author SHOULD provide properties for aria-valuemax and aria-...
...pinbutton or progressbar. If the aria-valuenow has a known maximum and minimum, the author SHOULD provide properties for aria-valuemax and aria-valuemin.The value of aria-valuemin MUST be less than or equal to the value of aria-valuemax. 28 Using the aria-valuenow attribute ARIA, Accessibility, NeedsContent The aria-valuenow attribute is used to define the current value for a
range widget such as a slider, spinbutton or progressbar. If the current value is not known, the author should not set the aria-valuenow attribute. If the aria-valuenow has a known minimum and maximum value, authors should set the aria-valuemin and aria-valuemax attributes. 29 Using the aria-valuetext attribute ARIA, Accessibility, Attribute The aria-valuetext attribute is used to ...
...t value is not known, the author should not set the aria-valuenow attribute. If the aria-valuenow has a known minimum and maximum value, authors should set the aria-valuemin and aria-valuemax attributes. 29 Using the aria-valuetext attribute ARIA, Accessibility, Attribute The aria-valuetext attribute is used to define the human readable text alternative of aria-valuenow for a
range widget such as progressbar, spinbutton or slider. 30 Using the article role ARIA, Accessible, NeedsContent The article role is used to identify a section of a page that forms an independent part of a document, page or site. Examples of an article include web log posts, newspaper or magazine articles and use-submitted comments. It is independent in that its contents could stan...
...And 2 more matches
@font-face - CSS: Cascading Style Sheets
penSans-Regular-webfont.woff") format("woff"); } Descriptors font-display Determines how a font face is displayed based on whether and when it is downloaded and ready to use. font-family Specifies a name that will be used as the font face value for font properties. font-stretch A font-stretch value. Since Firefox 61 (and in other modern browsers) this also accepts two values to specify a
range that is supported by a font-face, for example font-stretch: 50% 200%; font-style A font-style value. Since Firefox 61 (and in other modern browsers) this also accepts two values to specify a
range that is supported by a font-face, for example font-style: oblique 20deg 50deg; font-weight A font-weight value. Since Firefox 61 (and in other modern browsers) this also accepts two values to specif...
... font-feature-settings Allows control over advanced typographic features in OpenType fonts. ...
...mputer. To provide the browser with a hint as to what format a font resource is -- so it can select a suitable one -- it is possible to include a format type inside a format() function: src: url(ideal-sans-serif.woff) format("woff"), url(basic-sans-serif.ttf) format("truetype"); The available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg". unicode-
range The
range of Unicode code points to be used from the font. Description If the local() function is provided, specifying a font name to look for on the user's computer, and the user agent finds a match, that local font is used. Otherwise, the font resource specified using the url() function is downloaded and used. By allowing authors to provide their own fonts, @font-face makes it possible to ...
...And 2 more matches
@media - CSS: Cascading Style Sheets
Added in Media Queries Level 4. any-pointer Is any available input mechanism a pointing device, and if so, how accurate is it? Added in Media Queries Level 4. aspect-ratio Width-to-height aspect ratio of the viewport color Number of bits per color component of the output device, or zero if the device isn't color color-gamut Approximate
range of colors that are supported by the user agent and output device Added in Media Queries Level 4. color-index Number of entries in the output device's color lookup table, or zero if the device does not use such a table device-aspect-ratio Width-to-height aspect ratio of the output device Deprecated in Media Queries Level 4. device-height Height of ...
...'='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>where <mf-name> = <ident><mf-value> = <number> | ...
...'='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? ...
...And 2 more matches
Using CSS gradients - CSS: Cascading Style Sheets
120px; height: 120px; } .angled-gradient { background: linear-gradient(70deg, blue, pink); } When using an angle, 0deg creates a vertical gradient running bottom to top, 90deg creates a horizontal gradient running left to right, and so on in a clockwise direction. Negative angles run in the counterclockwise direction. Declaring colors & creating effects All CSS gradient types are a
range of position-dependent colors. The colors produced by CSS gradients can vary continuously with position, producing smooth color transitions. It is also possible to create bands of solid colors, and hard transitions between two colors. The following are valid for all gradient functions: Using more than two colors You don't have to limit yourself to two colors--you may use as many as you like! By...
...rs. The following are valid for all gradient functions: Using more than two colors You don't have to limit yourself to two colors--you may use as many as you like! By default, colors are evenly spaced along the gradient. <div class="auto-spaced-linear-gradient"></div> div { width: 120px; height: 120px; } .auto-spaced-linear-gradient { background: linear-gradient(red, yellow, blue, o
range); } Positioning color stops You don't have to leave your color stops at their default positions. To fine-tune their locations, you can give each one zero, one, or two percentage or, for radial and linear gradients, absolute length values. If you specify the location as a percentage, 0% represents the starting point, while 100% represents the ending point; however, you can use values outsid...
... Positioning color stops You don't have to leave your color stops at their default positions. To fine-tune their locations, you can give each one zero, one, or two percentage or, for radial and linear gradients, absolute length values. If you specify the location as a percentage, 0% represents the starting point, while 100% represents the ending point; however, you can use values outside that
range if necessary to get the effect you want. If you leave a location unspecified, the position of that particular color stop will be automatically calculated for you, with the first color stop being at 0% and the last color stop being at 100%, and any other color stops being half way between their adjacent color stops. <div class="multicolor-linear"></div> div { width: 120px; height: 120px; }...
...And 2 more matches
<easing-function> - CSS: Cascading Style Sheets
n the specific function used, the calculated output can sometimes grow to be greater than 1.0 or smaller than 0.0 during the course of an animation. This causes the animation to go farther than the final state, and then return. For some properties, such as left or right, this creates a kind of "bouncing" effect. However, certain properties will restrict the output if it goes outside an allowable
range. For example, a color component greater than 255 or smaller than 0 will be clipped to the closest allowed value (255 and 0, respectively). Some cubic-bezier() curves exhibit this property. Syntax There are three types of easing function: linear, cubic Bezier curves, and staircase functions. The value of an <easing-function> type describes the easing function using one of those three types. Eas...
...e curves are continuous, they are often used to smooth down the start and end of the animation and are therefore sometimes called easing functions. A cubic Bezier curve is defined by four points P0, P1, P2, and P3. P0 and P3 are the start and the end of the curve and, in CSS these points are fixed as the coordinates are ratios (the abscissa the ratio of time, the ordinate the ratio of the output
range). P0 is (0, 0) and represents the initial time and the initial state, P3 is (1, 1) and represents the final time and the final state. Not all cubic Bezier curves are suitable as easing functions as not all are mathematical functions; i.e., curves that for a given abscissa have zero or one value. With P0 and P3 fixed as defined by CSS, a cubic Bezier curve is a function, and is therefore valid, i...
...state, P3 is (1, 1) and represents the final time and the final state. Not all cubic Bezier curves are suitable as easing functions as not all are mathematical functions; i.e., curves that for a given abscissa have zero or one value. With P0 and P3 fixed as defined by CSS, a cubic Bezier curve is a function, and is therefore valid, if and only if the abscissas of P1 and P2 are both in the [0, 1]
range. Cubic Bezier curves with the P1 or P2 ordinate outside the [0, 1]
range may generate bouncing effects. When you specify an invalid cubic-bezier curve, CSS ignores the whole property. Syntax cubic-bezier(x1, y1, x2, y2) where: x1, y1, x2, y2 Are <number> values representing the abscissas, and ordinates of the P1 and P2 points defining the cubic Bezier curve. x1 and x2 must be in the ran...
...And 2 more matches
Constraint validation - Developer guides
Attribute Input types supporting the attribute Possible values Constraint description Associated violation pattern text, search, url, tel, email, password A JavaScript regular expression (compiled with the ECMAScript 5 global, ignoreCase, and multiline flags disabled) The value must match the pattern. ...
...scription Associated violation pattern text, search, url, tel, email, password A JavaScript regular expression (compiled with the ECMAScript 5 global, ignoreCase, and multiline flags disabled) The value must match the pattern. patternMismatch constraint violation min
range, number A valid number The value must be greater than or equal to the value. ...
...pt 5 global, ignoreCase, and multiline flags disabled) The value must match the pattern. patternMismatch constraint violation min
range, number A valid number The value must be greater than or equal to the value. ...
...And 2 more matches
HTML attribute: step - HTML: Hypertext Markup Language
Valid for the numeric input types, including the date, month, week, time, datetime-local, number and
range types, the step attribute is a number that specifies the granularity that the value must adhere to or the keyword any. The step sets the stepping interval when clicking up and down spinner buttons, moving a slider left and right on a
range, and validating the different date types. If not explicitly included, step defaults to 1 for number and
range, and 1 unit type (minute, week, month, day) for the date/time input types. The value can must be a positive number - integer or float -- or the special value any, which means no stepping is implied, and any value is allowed (barring other constraints, such as min and max). The default stepping value for number inputs is 1, allowing on...
...For example, if we have <input type="number" min="10" step="2"> any even integer, 10 or great, is valid. If omitt...
...For example, if we have <input type="number" min="10" step="2"> any even integer, 10 or great, is valid. If omitted, <input type="number">, ...
...And 2 more matches
Regular expression syntax cheatsheet - JavaScript
neither "Jack" nor "Tom" is part of the match results. (?<!y)x Negative lookbehind assertion: Matches "x" only if "x" is not preceded by "y". For example, /(?<!-)\d+/ matches a number only if it is not preceded by a minus sign. /(?<!-)\d+/.exec('3') matches "3". /(?<!-)\d+/.exec('-3') match is not found because the number is preceded by the minus sign. ...
...It is also possible to include a character class in a character set. For example, [abcd] is the same as [a-d]. ...
...match the "b" in "brisket", the "c" in "chop", and the "-" (hyphen) in "non-profit". For example, [\w-] is the same as [A-Za-z0-9_-]. They both match the "b" in "brisket", the "c" in "chop", and the "n" in "non-profit". [^xyz] [^a-c] A negated or complemented character set. That is, it matches anything that is not enclosed in the brackets. You can specify a
range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character set as a normal character. For example, [^abc] is the same as [^a-c]. They initially match "o" in "bacon" and "h" in "chop". The ^ character may also indicate the beginning of input. (x...
...And 2 more matches
Codecs used by WebRTC - Web media technologies
APIs can support Opus, in the corresponding section of our guide to audio codecs used on the web. Both the speech and general audio modes should be supported. Opus's scalability and flexibility are useful when dealing with audio that may have varying degrees of complexity. Its support of in-band stereo signals allows support for stereo without complicating the demultiplexing process. ...
...multiplexing process. The entire
range of bit rates supported by Opus (6 kbps to 510 kbps) is supported in WebRTC, with the bit rate allowed to be dynamically changed. Higher bit rates typically improve quality. Bit rate recommendations Given a 20 millisecond frame size, the following table shows the recommended bit rates for various forms of media. Media type Recommended bit rate
range Narrow-band speech (NB) 8 to 12 kbps Wide-band speech (WB) 16 to 20 kbps Full-band speech (FB) 28 to 40 kbps Full-band monaural music (FB mono) 48 to 64 kbps Full-band stereo music (FB stereo) 64 to 128 kbps The bit rate may be adjusted at any time. In order to avoid network congestion, the average audio bit rate should not ex...
... one-byte value which uniquely identifies the described configuration. Note: The two methods for obtaining lists of codecs shown here use different output types in their codec lists. Be aware of this when using the results. Customizing the codec list Once you have a list of the available codecs, you can alter it and then send the revised list to RTCRtpTransceiver.setCodecPreferences() to rear
range the codec list. This changes the order of preference of the codecs, letting you tell WebRTC to prefer a different codec over all others. function changeVideoCodec(mimeType) { const transceivers = peerConnection.getTransceivers(); transceivers.forEach(transceiver => { const kind = transceiver.sender.track.kind; let sendCodecs = RTCRtpSender.getCapabilities(kind).codecs; let recvC...
...And 2 more matches
StringView - Archive of obsolete content
StringView.prototype.encoding = "UTF-8"; /* Default encoding... ...
...han StringView itself will be added to the global scope. StringView is a highly extensible library, that anyone can extend by adding methods to the object StringView.prototype. For example, imagine you want to create a method similar to string.replace(), but for stringView objects. ...
...ds to the object StringView.prototype. For example, imagine you want to create a method similar to string.replace(), but for stringView objects. ...
...r oMyStringView = new StringView("Hello, st
range people!"); // UTF-8 var oMyRegExp = new CLikeRegExp(" ", "g"); alert(oMyStringView.replace(oMyRegExp, " ")); // "Hello, st
range people!\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" /* stringView.replace() will be different from string.replace() because it act also on the source: */ alert(oMyStringView); // "Hello, st
range people!\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" As you can see, the previous example needs you to create two new algorithms: the CLikeRegExp() constructor - a constructor of C-like regular expression objects - and StringView.prototype.replace() - the new method, able to act on stringView instances. Well, just include stringview.js to your scope and work on them in another s...
Connecting to Remote Content - Archive of obsolete content
l executes any code contained in the string, workarounds had to be devised in order to close security holes. Luckily, Firefox now provides a few alternatives for extension developers. The JSON page explains in detail how to parse JSON data in different versions of Firefox and other applications. ...
... let string = JSON.stringify(jsObject); XML content XML is possibly the most popular data interchange format. ...
...=> 2; }; The JavaScript object can also be serialized back with the stringify method. let string = JSON.stringify(jsObject); XML content XML is possibly the most popular data interchange format. Let's assume that the XML returned from remote server is this: <?xml version="1.0"?> <data> <shops> <shop> <name>Apple</name> <code>A001</code> </shop> <shop> <name>O
range</name> </shop> </shops> <total>2</total> </data> When a valid XML response comes back from the remote server, the XML document object can be manipulated using different DOM methods, to display the data in the UI or store it into a local datasource. request.onload = function(aEvent) { let responseXML = aEvent.target.responseXML; let rootElement = responseXML.documentElement; if (...
...There are a couple of tools you can use to process these documents more efficiently: Using XPath XPath stands for XML Path Language, it uses a non-X...
Introduction to Public-Key Cryptography - Archive of obsolete content
and password across the network, either in the clear or over an encrypted SSL connection. The server looks up the name and password in its local password database and, if they match, accepts them as evidence authenticating the user's identity. The server determines whether the identified user is permitted to access the requested resource, and if so allows the client to access it. With this ar
rangement, the user must supply a new password for each server, and the administrator must keep track of the name and password for each user, typically on separate servers. Proper implementation does not store passwords in plaintext. Instead it concatenates the password with a random per-user value (so called "salt") and stores the hash value of the result along with the salt. This makes certain kinds...
... CA-that the certificate identifies. The CAs that are directly subordinate to the root CA have CA certificates signed by the root CA. CAs under the subordinate CAs in the hierarchy have their CA certificates signed by the higher-level subordinate CAs. Organizations have a great deal of flexibility in terms of the way they set up their CA hierarchies. Figure 6 shows just one example; many other ar
rangements are possible. Certificate Chains CA hierarchies are reflected in certificate chains. A certificate chain is series of certificates issued by successive CAs. Figure 7 shows a certificate chain leading from a certificate that identifies some entity through two subordinate CA certificates to the CA certificate for the root CA (based on the CA hierarchy shown in Figure 6). A certificate cha...
...s. In other cases, your UNIX or Windows login and password may be sufficient. At the other end of the scale, for certificates that identify people who can authorize large expenditures or make other sensitive decisions, the issuing process may require notarized documents, a background check, and a personal interview. Depending on an organization's policies, the process of issuing certificates can
range from being completely transparent for the user to requiring significant user participation and complex procedures. In general, processes for issuing certificates should be highly flexible, so organizations can tailor them to their changing needs. Issuing certificates is one of several managements tasks that can be handled by separate Registration Authorities. Certificates and the LDAP Directory...
...cates within an organization. System administrators can store much of the information required to manage certificates in an LDAP-compliant directory. For example, a CA can use information in a directory to prepopulate a certificate with a new employee's legal name and other information. The CA can leverage directory information in other ways to issue certificates one at a time or in bulk, using a
range of different identification techniques depending on the security policies of a given organization. Other routine management tasks, such as key management and renewing and revoking certificates, can be partially or fully automated with the aid of the directory. Information stored in the directory can also be used with certificates to control access to various network resources by different users ...
Implementation Status - Archive of obsolete content
xforms-disabled supported 4.4.12 DOMActivate supported 4.4.13 DOMFocusIn supported 4.4.14 DOMFocusOut supported 4.4.15 xforms-select xforms-deselect supported 4.4.16 xforms-in-
range supported 4.4.17 xforms-out-of-
range supported 4.4.18 xforms-scroll-first xforms-scroll-last supported 4.4.19 xforms-submit-done supported 4.5 Error Indications partial We don't support the xforms-version-except...
... 4.5.5 xforms-output-exception unsupported 4.5.6 xforms-submit-error supported 4.5.7 xforms-version-exception unsupported 4.6 Event Sequencing supported 4.6.1 For input, secret, textarea,
range, or upload Controls supported 4.6.2 For output Controls supported 4.6.3 For select or select1 Controls partial 4.6.4 For trigger Controls supported 4.6.5 For submit Controls supported 4...
...uirements n/a 8.1.2 input supported 8.1.3 secret supported 8.1.4 textarea supported 8.1.5 output supported 8.1.6 upload supported 8.1.7
range partial 316355; 343523; 8.1.8 trigger supported 8.1.9 submit supported 8.1.10 select partial @selection does not work, select inside repeat may not work correctly, select that mixes itemsets with items may show them in the wrong order 282840; 371595; ...
... 8.1.10 select partial @selection does not work, select inside repeat may not work correctly, select that mixes itemsets with items may show them in the wrong order 282840; 371595; 372127; 8.1.11 select1 partial There are some resize issues, select/deselect/valuechange firing in wrong order. Getting a few issues with in/out of
range notifications. 282840; 303351; 333464; 333529; 352398; 8.2.1 choices supported 8.2.2 item supported 8.2.3 value supported 8.3.1 filename supported 8.3.2 mediatype supported ...
Advanced form styling - Learn web development
le, requiring more complex CSS or some more specific tricks: Checkboxes and radio buttons <input type="search"> The ugly: Some elements can't be styled thoroughly using CSS. These include: Elements involved in creating dropdown widgets, including <select>, <option>, <optgroup> and <datalist>. <input type="color"> Date-related controls such as <input type="datetime-local"> <input type="
range"> <input type="file"> <progress> and <meter> Let's first talk about the appearance property, which is pretty useful for making all of the above more stylable. appearance: controlling OS-level styling In the previous article we said that historically, styling of web form controls was largely taken from the underlying operating system, which is part of the problem with customizing the look of...
... Let's talk about some specifics of each of these types of control, highlighting difficulties along the way. Selects and datalists In modern browsers, selects and datalists are generally not too bad to style provided you don't want to vary the look and feel too much from the defaults. ...
...our own. Note: It is worth mentioning <input type="number"> here too -- this also has a spinner that you can use to increment/decrement values, so potentially suffers from the same problem. However, in the case of the number type the data being collected is simpler, and it is easy to just use a text input type instead if desired (or tel if you want mobile browsers to show the numeric keypad).
Range input types <input type="
range"> is annoying to style. You can use something like the following to remove the default slider track completely and replace it with a custom style (a thin red track, in this case): input[type="
range"] { appearance: none; -webkit-appearance: none; background: red; height: 2px; padding: 0; outline: 1px solid transparent; } However, it is very difficult t...
...nge"> is annoying to style. You can use something like the following to remove the default slider track completely and replace it with a custom style (a thin red track, in this case): input[type="
range"] { appearance: none; -webkit-appearance: none; background: red; height: 2px; padding: 0; outline: 1px solid transparent; } However, it is very difficult to customize the style of the
range control's drag handle -- to get full control over
range styling you'll need to use a whole bunch of complex CSS code, including multiple non-standard, browser-specific pseudo-elements. Check out Styling Cross-Browser Compatible
Range Inputs with CSS on CSS tricks for a detailed write up of what's needed. Color input types Input controls of type color are not too bad. In supporting browsers, the...
The HTML5 input types - Learn web development
ease buttons change its value by 2. <input type="number" name="age" id="age" min="1" max="10" step="2"> The second one creates a number control whose value is restricted to any value between 0 and 1 inclusive, and whose increase and decrease buttons change its value by 0.01. <input type="number" name="change" id="pennies" min="0" max="1" step="0.01"> The number input type makes sense when the
range of valid values is limited, for example a person's age or height. If the
range is too large for incremental increases to make sense (such as USA ZIP codes, which
range from 00001 to 99999), the tel type might be a better option; it provides the numeric keypad while forgoing the number's spinner UI feature. Note: number inputs are not supported in versions of Internet Explorer below 10. Slider...
... You see these quite often on sites like housebuying sites where you want to set a maximum property price to filter by. Let's look at a live example to illustrate this: Usage-wise, sliders are less accurate than text fields. Therefore, they are used to pick a number whose precise value is not necessarily important. A slider is created using the <input> with its type attribute set to the value
range. The slider-thumb can be moved via mouse or touch, or with the arrows of the keypad. It's important to properly configure your slider. To that end, it's highly recommended that you set the min, max, and step attributes which set the minimum, maximum and increment values, respectively. Let's look at the code behind the above example, so you can see how its done. First of all, the basic HTML: <l...
...s of the keypad. It's important to properly configure your slider. To that end, it's highly recommended that you set the min, max, and step attributes which set the minimum, maximum and increment values, respectively. Let's look at the code behind the above example, so you can see how its done. First of all, the basic HTML: <label for="price">Choose a maximum house price: </label> <input type="
range" name="price" id="price" min="50000" max="500000" step="100" value="250000"> <output class="price-output" for="price"></output> This example creates a slider whose value may
range between 50000 and 500000, which increments/decrements by 100 at a time. We've given it default value of 250000, using the value attribute. One problem with sliders is that they don't offer any kind of visual feedback ...
... came from. To actually display the current value, and update it as it changed, you must use JavaScript, but this is relatively easy to do: const price = document.querySelector('#price'); const output = document.querySelector('.price-output'); output.textContent = price.value; price.addEventListener('input', function() { output.textContent = price.value; }); Here we store references to the
range input and the output in two variables. Then we immediately set the output's textContent to the current value of the input. Finally, an event listener is set to ensure that whenever the
range slider is moved, the output's textContent is updated to the new value. Note:
range inputs are not supported in versions of Internet Explorer below 10. Date and time pickers Gathering date and time values...
Styling web forms - Learn web development
icult to style, requiring more complex CSS or some more specific tricks: Checkboxes and radio buttons <input type="search"> We describe how to handle these more specific features in the article Advanced form styling. The ugly Some elements can't be styled thoroughly using CSS. These include: <input type="color"> Date-related controls such as <input type="datetime-local"> <input type="
range"> <input type="file"> Elements involved in creating dropdown widgets, including <select>, <option>, <optgroup> and <datalist>. <progress> and <meter> Again, we'll describe what can be done in terms of styling these elements in Advanced form styling. The real problem with all these controls is that they have a very complex structure, and beyond some basic styling (such as changing the width ...
...If you want to thoroughly customize those widgets, you really have to create your own using HTML, CSS, and JavaScript. This is beyond the scope of the core form articles, but we do look at this in an advanced article How to build custom form controls. Note: there are some proprietary CSS pseudo-elements available that allow you to style internal components of these form controls, such as ::-moz-
range-track, but these are not consistent across browsers, so can't be relied upon. We will mention these later as well. The good To style form controls that are easy to style with CSS, you shouldn't face much if any difficulties, since they mostly behave like any other HTML element. We already looked at some simple form styling in Your first form, and the CSS building blocks module contains some us...
...lect>, <textarea>, <input type="submit">, and a <button> in Chrome on macOS, with the platform's default font style in use. On the right are the same elements, with our above style rule applied. The defaults differed in a number of ways. Inheriting should change their fonts to that of the parent's font family -- in this case the default serif font of the parent container. They all do, with a st
range exception -- <input type="submit"> does not inherit from the parent paragraph in Chrome. Rather, it uses the font-family: system-ui. This is another reason to use <button> elements over their equivalent input types! There's a lot of debate as to whether forms look better using the system default styles, or customized styles designed to match your content. This decision is yours to make, as the d...
... and margin. To give the same size to several different widgets, you can use the box-sizing property along with some consistent values for other properties: input, textarea, select, button { width : 150px; padding: 0; margin: 0; box-sizing: border-box; } In the screenshot below, the left column shows the default rendering of an <input type="radio">, <input type="checkbox">, <input type="
range">, <input type="text">, <input type="date"> input, <select>, <textarea>,<input type="submit">, and <button>. The right column on the other hand shows the same elements with our above rule applied to them. Notice how this lets us ensure that all of the elements occupy the same amount of space, despite the platform's default rules for each kind of widget. What may not be apparent via the screens...
PRExplodedTime
s the day of week and the day of year. In addition, PRExplodedTime includes a PRTimeParameters structure representing the local time zone information, so that the time point is non-ambiguously specified. The essential members of PRExplodedTime are: tm_year: absolute year, AD (by "absolute," we mean if the year is 2000, this field's value is 2000). tm_month: number of months past tm_year. The
range is [0, 11]. 0 is January and 11 is December. tm_mday: the day of month. The
range is [1, 31]. Note that it starts from 1 as opposed to 0. tm_hour: number of hours past tm_mday. The
range is [0, 23]. tm_min: number of minutes past tm_hour. The
range is [0, 59]. tm_sec: number of seconds past tm_min. The
range is [0, 61]. The values 60 and 61 are for accommodating up to two leap seconds. tm_us...
...0 is the 1st of January. ...
...0 is the 1st of January. On input to NSPR functions, only the essential members of PRExplodedTime must be specified. The two nonessential members (day of week and day of year) are ignored by NSPR functions as input. ...
...0 is the 1st of January. On input to NSPR functions, only the essential members of PRExplodedTime must be specified. The two nonessential members (day of week and day of year) are ignored by NSPR functions as input. ...
Add to iPhoto
} Shutting down Core Foundation While the Core Foundation system framework itself doesn't need to be shut down, we do need to close the library we opened using the js-ctypes API; that's where the shutdown() method comes in: shutdown: function() { this.lib.close(); } Select API declarations Let's take a look at a few of the key APIs we declare for Core Foundation, to see how it's done. ...
...ing down Core Foundation While the Core Foundation system framework itself doesn't need to be shut down, we do need to close the library we opened using the js-ctypes API; that's where the shutdown() method comes in: shutdown: function() { this.lib.close(); } Select API declarations Let's take a look at a few of the key APIs we declare for Core Foundation, to see how it's done. ...
...e Foundation system framework itself doesn't need to be shut down, we do need to close the library we opened using the js-ctypes API; that's where the shutdown() method comes in: shutdown: function() { this.lib.close(); } Select API declarations Let's take a look at a few of the key APIs we declare for Core Foundation, to see how it's done. CF
Range CF
Range is a structure that identifies a
range; that is, it identifies an offset to an item in a list and a number of items. In C, the declaration looks like this: typedef struct { CFIndex location; CFIndex length; } CF
Range; To declare this for use with js-ctypes, we use the following code: this.CF
Range = new ctypes.StructType("CF
Range", [ {'location': ctypes.int32_t}, {'length': ctypes.i...
... Generic CFType routines All Core Foundation data types are based upon a core CFType data type. ...
AudioContext.createMediaStreamSource() - Web APIs
the specified source stream. Example In this example, we grab a media (audio + video) stream from navigator.getUserMedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a MediaStreamAudioSourceNode. Next, we feed this source audio into a low pass BiquadFilterNode (which effectively serves as a bass booster), then a AudioDestinationNode. ...
...stinationNode. The
range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! Note: You can see this example running live, or view the source. var pre = document.querySelector('pre'); var video = document.querySelector('video'); var myScript = document.querySelector('script'); var
range = document.querySelector('input'); // getUserMedia block - grab stream // put it into a MediaStreamAudioSourceNode // also output the visuals into a video element if (navigator.mediaDevices) { console.log('getUserMedia supported.'); navigator.mediaDevices.getUserMedia ({audio: true, video: true}) .then(function(stream) { video.srcObject = stream; video.onloadedmetada...
.../ Create a MediaStreamAudioSourceNode // Feed the HTMLMediaElement into it var audioCtx = new AudioContext(); var source = audioCtx.createMediaStreamSource(stream); // Create a biquadfilter var biquadFilter = audioCtx.createBiquadFilter(); biquadFilter.type = "lowshelf"; biquadFilter.frequency.value = 1000; biquadFilter.gain.value =
range.value; // connect the AudioBufferSourceNode to the gainNode // and the gainNode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadFilter); biquadFilter.connect(audioCtx.destination); // Get new mouse pointer coordinates when mouse is moved // then set new gain value r...
...ode // and the gainNode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadFilter); biquadFilter.connect(audioCtx.destination); // Get new mouse pointer coordinates when mouse is moved // then set new gain value
range.oninput = function() { biquadFilter.gain.value =
range.value; } }) .catch(function(err) { console.log('The following gUM error occured: ' + err); }); } else { console.log('getUserMedia not supported on your browser!'); } // dump script to pre element pre.innerHTML = myScript.innerHTML; Note: As a consequence of calling createMediaStreamSource(), audio playback from the media stream will be re-routed into the process...
BiquadFilterNode.type - Web APIs
highpass Standard second-order resonant highpass filter with 12dB/octave rolloff. Frequencies below the cutoff are attenuated; frequencies above it pass through. The cutoff frequency. Indicates how peaked the frequency is around the cutoff. The greater the value, the greater the peak. Not used bandpass Standard second-order bandpass filter. Frequencies outside the given
range of frequencies are attenuated; the frequencies inside it pass through. The center of the
range of frequencies. Controls the width of the frequency band. The greater the Q value, the larger the frequency band. Not used lowshelf Standard second-order lowshelf filer. Frequencies lower than the frequency get a boost, or an attenuation; frequencies over it are unchanged. The up...
... will be an attenuation. highshelf Standard second-order highshelf filer. Frequencies higher than the frequency get a boost or an attenuation; frequencies lower than it are unchanged. The lower limit of the frequencies getting a boost or an attenuation. Not used The boost, in dB, to be applied; if negative, it will be an attenuation. peaking Frequencies inside the
range get a boost or an attenuation; frequencies outside it are unchanged. The middle of the frequency
range getting a boost or an attenuation. Controls the width of the frequency band. The greater the Q value, the larger the frequency band. The boost, in dB, to be applied; if negative, it will be an attenuation. notch Standard notch filter, also called a band-stop or band-rejectio...
... Controls the width of the frequency band. The greater the Q value, the larger the frequency band. Not used allpass Standard second-order allpass filter. ...
... Controls the width of the frequency band. ...
BiquadFilterNode - Web APIs
ass Standard second-order resonant highpass filter with 12dB/octave rolloff. Frequencies below the cutoff are attenuated; frequencies above it pass through. The cutoff frequency. Indicates how peaked the frequency is around the cutoff. The greater the value, the greater the peak. Not used bandpass Standard second-order bandpass filter. Frequencies outside the given
range of frequencies are attenuated; the frequencies inside it pass through. The center of the
range of frequencies. Controls the width of the frequency band. The greater the Q value, the smaller the frequency band. Not used lowshelf Standard second-order lowshelf filter. Frequencies lower than the frequency get a boost, or an attenuation; frequencies over it are unchanged. ...
...attenuation. highshelf Standard second-order highshelf filter. Frequencies higher than the frequency get a boost or an attenuation; frequencies lower than it are unchanged. The lower limit of the frequencies getting a boost or an attenuation. Not used The boost, in dB, to be applied; if negative, it will be an attenuation. peaking Frequencies inside the
range get a boost or an attenuation; frequencies outside it are unchanged. The middle of the frequency
range getting a boost or an attenuation. Controls the width of the frequency band. The greater the Q value, the smaller the frequency band. The boost, in dB, to be applied; if negative, it will be an attenuation. notch Standard notch filter, also called a band-stop or band-...
... Controls the width of the frequency band. The greater the Q value, the smaller the frequency band. Not used allpass Standard second-order allpass filter. ...
... Controls the width of the frequency band. ...
IDBCursor - Web APIs
Note: Not to be confused with IDBCursorWithValue which is just an IDBCursor interface with an additional value property. The IDBCursor interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. The cursor has a source that indicates which index or object store it is iterating over. It has a position within the
range, and moves in a direction that is increasing or decreasing in the order of record keys. The cursor enables an application to asynchronously process all the records in the cursor's
range. You can have an unlimited number of cursors at the same time. You always get the same IDBCursor object representing a given cursor. Operations are performed on the underlying index or object store. Note: This feature is available in Web...
...g. This function never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not active. IDBCursor.direction Read only Returns the direction of traversal of the cursor. See Constants for possible values. IDBCursor.key Read only Returns the key for the record at the cursor's position. If the cursor is outside its
range, this is set to undefined. The cursor's key can be any data type. IDBCursor.primaryKey Read only Returns the cursor's current effective primary key. If the cursor is currently being iterated or has iterated outside its
range, this is set to undefined. The cursor's primary key can be any data type. IDBCursor.request Read only Returns the IDBRequest that was used to obtain the cursor. Metho...
...thread, updates the value at the current position of the cursor in the object store. This can be used to update specific records. Constants These constants are no longer available -- they were removed in Gecko 25. You should use the string constants directly instead. (bug 891944) NEXT : "next" : The cursor shows all records, including duplicates. It starts at the lower bound of the key
range and moves upwards (monotonically increasing in the order of keys). NEXTUNIQUE : "nextunique" : The cursor shows all records, excluding duplicates. If multiple records exist with the same key, only the first one iterated is retrieved. It starts at the lower bound of the key
range and moves upwards. PREV : "prev" : The cursor shows all records, including duplicates. It starts at the upper bound o...
... upwards (monotonically increasing in the order of keys). NEXTUNIQUE : "nextunique" : The cursor shows all records, excluding duplicates. If multiple records exist with the same key, only the first one iterated is retrieved. It starts at the lower bound of the key
range and moves upwards. PREV : "prev" : The cursor shows all records, including duplicates. It starts at the upper bound of the key
range and moves downwards (monotonically decreasing in the order of keys). PREVUNIQUE : "prevunique" : The cursor shows all records, excluding duplicates. If multiple records exist with the same key, only the first one iterated is retrieved. It starts at the upper bound of the key
range and moves downwards. Examples In this simple fragment we create a transaction, retrieve an object store, then use...
IDBFactory.open() - Web APIs
xes // of implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...ions you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...w.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...exedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
IDBFactory - Web APIs
efixes of implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...ions you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...w.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...exedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
IDBIndex.openKeyCursor() - Web APIs
The openKeyCursor() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key
range, as ar
ranged by this index. The method sets the position of the cursor to the appropriate key, based on the specified direction. If the key
range is not specified or is null, then the
range includes all the keys. A success event is always fired on the result object. If at least one key matches the key
range, then the result property of the event is set to the new IDBCursor object; the key property of the cursor object is set to the found key and the primaryKey property is set to the the corresponding primary key of the found record. If no keys match the key
range, then then the result property of the event is set to null. ...
... direction Optional The cursor's direction. See IDBCursor Constants for possible values. ...
...ult property of the event is set to null. Note: Cursors returned by openKeyCursor() do not make the referenced value available as IDBIndex.openCursor does. This makes obtaining a list of keys much more efficient. Note: This feature is available in Web Workers. Syntax var request = myIndex.openKeyCursor(); var request = myIndex.openKeyCursor(
range); var request = myIndex.openKeyCursor(
range, direction); Parameters
range Optional A key or IDBKey
Range to use as the cursor's
range. If nothing is passed, this will default to a key
range that selects all the records in this object store. direction Optional The cursor's direction. See IDBCursor Constants for possible values. Return value An IDBRequest object on which subsequent events related to this operation are fired. Except...
...e An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description TransactionInactiveError This IDBIndex's transaction is inactive. TypeError The value for the direction parameter is invalid. DataError The key or key
range provided contains an invalid key. InvalidStateError The IDBIndex has been deleted or removed. Example In the following example we open a transaction and an object store, then get the index lName from a simple contacts database. We then open a key cursor on the index using openKeyCursor() -- this works the same as opening a cursor directly on an ObjectStore using IDBObjec...
IDBObjectStore.count() - Web APIs
Return value An IDBRequest object on which subsequent events related to this operation are fired. ...
... Return value An IDBRequest object on which subsequent events related to this operation are fired. ...
...nd, in a separate thread, returns the total number of records that match the provided key or IDBKey
Range. If no arguments are provided, it returns the total number of records in the store. Note: This feature is available in Web Workers. Syntax var request = ObjectStore.count(); var request = ObjectStore.count(query); Parameters query Optional A key or IDBKey
Range object that specifies a
range of records you want to count. Return value An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description InvalidStateError This IDBObjectStore has been deleted. TransactionInactiveError This IDBObjectStore's transaction is inacti...
...DBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description InvalidStateError This IDBObjectStore has been deleted. TransactionInactiveError This IDBObjectStore's transaction is inactive. DataError The specified key or key
range is invalid. Example In this simple fragment we create a transaction, retrieve an object store, then count the number of records in the store using count() -- when the success handler fires, we log the count value (an integer) to the console. var transaction = db.transaction(['fThings'], 'readonly'); var objectStore = transaction.objectStore('fThings'); var countRequest = objectStore...
IDBObjectStoreSync - Web APIs
synchronous access to an object store of a database. ...
...ronous access to an object store of a database. ...
...eturns any The value retrieved from the object store. Exceptions This method can raise a IDBDatabaseException with the following codes: SERIAL_ERR If the data being stored could not be deserialized by the internal structured cloning algorithm. NOT_FOUND_ERR If no record exists in this index for the given key. openCursor() Creates a cursor over the records of this object store. The
range of the new cursor matches the specified key
range; if the key
range is not specified or is null, then the
range includes all the records. CursorSync openCursor ( in optional Key
Range range, in optional unsigned short direction ) raises (DatabaseException); Parameters
range The key
range to use as the cursor's
range. direction The cursor's required direction. Returns IDBIndexSync...
... openIndex() Opens the index with the given name, using the mode of the current transaction. IDBIndexSync openIndex ( in DOMString name ) raises (IDBDatabaseException); Parameters name The name of the index to open. Returns IDBIndexSync An object to access the index. ...
IDBVersionChangeEvent.newVersion - Web APIs
xes of // implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...ions you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...w.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...exedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
IDBVersionChangeEvent - Web APIs
efixes of implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...ions you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...w.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
...exedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. ...
MediaStreamAudioSourceNode - Web APIs
tion, so it's more reliable. Example In this example, we grab a media (audio + video) stream from navigator.getUserMedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a MediaStreamAudioSourceNode. Next, we feed this source audio into a low pass BiquadFilterNode (which effectively serves as a bass booster), then a AudioDestinationNode. ...
...stinationNode. The
range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! Note: You can see this example running live, or view the source. var pre = document.querySelector('pre'); var video = document.querySelector('video'); var myScript = document.querySelector('script'); var
range = document.querySelector('input'); // getUserMedia block - grab stream // put it into a MediaStreamAudioSourceNode // also output the visuals into a video element if (navigator.mediaDevices) { console.log('getUserMedia supported.'); navigator.mediaDevices.getUserMedia ({audio: true, video: true}) .then(function(stream) { video.srcObject = stream; video.onloadedmetada...
.../ Create a MediaStreamAudioSourceNode // Feed the HTMLMediaElement into it var audioCtx = new AudioContext(); var source = audioCtx.createMediaStreamSource(stream); // Create a biquadfilter var biquadFilter = audioCtx.createBiquadFilter(); biquadFilter.type = "lowshelf"; biquadFilter.frequency.value = 1000; biquadFilter.gain.value =
range.value; // connect the AudioBufferSourceNode to the gainNode // and the gainNode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadFilter); biquadFilter.connect(audioCtx.destination); // Get new mouse pointer coordinates when mouse is moved // then set new gain value r...
...ode // and the gainNode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadFilter); biquadFilter.connect(audioCtx.destination); // Get new mouse pointer coordinates when mouse is moved // then set new gain value
range.oninput = function() { biquadFilter.gain.value =
range.value; } }) .catch(function(err) { console.log('The following gUM error occured: ' + err); }); } else { console.log('getUserMedia not supported on your browser!'); } // dump script to pre element pre.innerHTML = myScript.innerHTML; Note: As a consequence of calling createMediaStreamSource(), audio playback from the media stream will be re-routed into the process...
MediaStreamTrackAudioSourceNode - Web APIs
from its parent, AudioNode. Example In this example, we grab a media (audio + video) stream from navigator.getUserMedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a MediaStreamAudioSourceNode. Next, we feed this source audio into a low pass BiquadFilterNode (which effectively serves as a bass booster), then a AudioDestinationNode. ...
...stinationNode. The
range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! Note: You can see this example running live, or view the source. var pre = document.querySelector('pre'); var video = document.querySelector('video'); var myScript = document.querySelector('script'); var
range = document.querySelector('input'); // getUserMedia block - grab stream // put it into a MediaStreamAudioSourceNode // also output the visuals into a video element if (navigator.mediaDevices) { console.log('getUserMedia supported.'); navigator.mediaDevices.getUserMedia ({audio: true, video: true}) .then(function(stream) { video.srcObject = stream; video.onloadedmetada...
.../ Create a MediaStreamAudioSourceNode // Feed the HTMLMediaElement into it var audioCtx = new AudioContext(); var source = audioCtx.createMediaStreamSource(stream); // Create a biquadfilter var biquadFilter = audioCtx.createBiquadFilter(); biquadFilter.type = "lowshelf"; biquadFilter.frequency.value = 1000; biquadFilter.gain.value =
range.value; // connect the AudioBufferSourceNode to the gainNode // and the gainNode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadFilter); biquadFilter.connect(audioCtx.destination); // Get new mouse pointer coordinates when mouse is moved // then set new gain value r...
...ode // and the gainNode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadFilter); biquadFilter.connect(audioCtx.destination); // Get new mouse pointer coordinates when mouse is moved // then set new gain value
range.oninput = function() { biquadFilter.gain.value =
range.value; } }) .catch(function(err) { console.log('The following gUM error occured: ' + err); }); } else { console.log('getUserMedia not supported on your browser!'); } // dump script to pre element pre.innerHTML = myScript.innerHTML; Note: As a consequence of calling createMediaStreamSource(), audio playback from the media stream will be re-routed into the process...
Capabilities, constraints, and settings - Web APIs
if you have any that you can't get by without, you can start by checking to be sure they're on the list. Once the script knows whether the property or properties it wishes to use are supported, it can then check the capabilities of the API and its implementation by examining the object returned by the track's getCapabilities() method; this object lists each supported constraint and the values or
range of values which are supported. Finally, the track's applyConstraints() method is called to configure the API as desired by specifying the values or
ranges of values it wishes to use for any of the constrainable properties about which it has a preference. The track's getConstraints() method returns the set of constraints passed into the most recent call to applyConstraints(). This may not repres...
...dConstraints(); document.getElementById("frameRateSlider").disabled = !supported["frameRate"]; In this example, the supported constraints are fetched, and a control that lets the user configure the frame rate is disabled if the frameRate constraint isn't supported. How constraints are defined A single constraint is an object whose name matches the constrainable property whose desired value or
range of values is being specified. This object contains zero or more individual constraints, as well as an optional sub-object named advanced, which contains another set of zero or more constraints which the user agent must satisfy if at all possible. The user agent attempts to satisfy constraints in the order specified in the constraint set. The most important thing to understand is that most const...
...nts like these, specifying a single value, are always treated as non-required. The user agent will try to provide what you request but will not guarantee that what you get will match. However, if you use simple values for properties when calling MediaStreamTrack.applyConstraints(), the request will always succeed, because these values will be considered a request, not a requirement. Specifying a
range of values Sometimes, any value within a
range is acceptable for a property's value. You can specify
ranges with either or both minimum and maximum values, and you can even specify an ideal value within the
range, if you choose. If you provide an ideal value, the browser will try to get as close as possible to matching that value, given the other constraints specified. let supports = navigator.m...
...al. There are few if any use cases for this feature, and there is some interest in removing it from the specification, so it will not be discussed here. If you wish to learn more, see section 11 of the Media Capture and Streams specification, past example 2. Checking capabilities You can call MediaStreamTrack.getCapabilities() to get a list of all of the supported capabilities and the values or
ranges of values which each one accepts on the current platform and user agent. This function returns a MediaTrackCapabilities object which lists each constrainable property supported by the browser and a value or
range of values which are supported for each one of those properties. Note: getCapabilities() hasn't been implemented yet by all major browsers. For the time being, you'll have to try to ge...
PointerEvent - Web APIs
only A unique identifier for the pointer causing the event. PointerEvent.width Read only The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer. PointerEvent.height Read only The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer. PointerEvent.pressure Read only The normalized pressure of the pointer input in the
range 0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively. PointerEvent.tangentialPressure Read only The normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress) in the
range -1 to 1, where 0 is the neutral position of the control. PointerEvent.tiltX Read only The plane angle (in degrees,...
... where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively. PointerEvent.tangentialPressure Read only The normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress) in the
range -1 to 1, where 0 is the neutral position of the control. PointerEvent.tiltX Read only The plane angle (in degrees, in the
range of -90 to 90) between the Y-Z plane and the plane containing both the pointer (e.g. pen stylus) axis and the Y axis. PointerEvent.tiltY Read only The plane angle (in degrees, in the
range of -90 to 90) between the X-Z plane and the plane containing both the pointer (e.g. pen stylus) axis and the X axis. PointerEvent.twist Read only The clockwise rotation of the pointer (e.g. pen stylus) aro...
... PointerEvent.pointerType Read only Indicates the device type that caused the event (mouse, pen, touch, etc.) PointerEvent.isPrimary Read only Indicates if the pointer represents the primary pointer of this pointer type. ...
...ll no longer be able to generate events (for example the related device is deactived). pointerout This event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not support hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover
range detectable by the digitizer. pointerleave This event is fired when a pointing device is moved out of the hit test boundaries of an element. For pen devices, this event is fired when the stylus leaves the hover
range detectable by the digitizer. gotpointercapture This event is fired when an element receives pointer capture. lostpointercapture This event is fired after pointer capture is rele...
Pointer events - Web APIs
ing properties. (All of the following properties are Read only .) pointerId A unique identifier for the pointer causing the event. width The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer. height the height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer. ...
...tude on the Y axis), in CSS pixels, of the contact geometry of the pointer. pressure the normalized pressure of the pointer input in the
range of 0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively. tangentialPressure The normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress) in the
range -1 to 1, where 0 is the neutral position of the control. tiltX The plane angle (in degrees, in the
range of -90 to 90) between the Y-Z plane and the plane containing both the pointer (e.g. pen stylus) axis and the Y axis. tiltY the plane angle (in degrees, in the
range of -90 to 90) between the X-Z plane and the plane containing both the pointer (e.g. pen stylus) axis and the X axis. twist ...
... pointerType Indicates the device type that caused the event (mouse, pen, touch, etc.) isPrimary Indicates if the pointer represents the primary pointer of this pointer type. ...
...o longer be able to generate events (for example the related device is deactived). pointerout onpointerout Fired for several reasons including: pointer is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not support hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover
range detectable by the digitizer. pointerleave onpointerleave Fired when a pointer is moved out of the hit test boundaries of an element. For pen devices, this event is fired when the stylus leaves the hover
range detectable by the digitizer. gotpointercapture ongotpointercapture Fired when an element receives pointer capture. lostpointercapture onlostpointerc...
ValidityState - Web APIs
owser is unable to convert. customError Read only A Boolean indicating whether the element's custom validity message has been set to a non-empty string by calling the element's setCustomValidity() method. patternMismatch Read only A Boolean that is true if the value does not match the specified pattern, and false if it does match. If true, the element matches the :invalid CSS pseudo-class. ...
... only A Boolean that is true if the value does not match the specified pattern, and false if it does match. If true, the element matches the :invalid CSS pseudo-class.
rangeOverflow Read only A Boolean that is true if the value is greater than the maximum specified by the max attribute, or false if it is less than or equal to the maximum. If true, the element matches the :invalid and :out-of-
range and CSS pseudo-classes.
rangeUnderflow Read only A Boolean that is true if the value is less than the minimum specified by the min attribute, or false if it is greater than or equal to the minimum. If true, the element matches the :invalid and :out-of-
range CSS pseudo-classes. stepMismatch Read only A Boolean that is true if the value does not fit the rules determined by the step attribute ...
... tooLong Read only A Boolean that is true if the value exceeds the specified maxlength for HTMLInputElement or HTMLTextAreaElement objects, or false if its length is less than or equal to the maximum length. ...
...seudo-classes. tooLong Read only A Boolean that is true if the value exceeds the specified maxlength for HTMLInputElement or HTMLTextAreaElement objects, or false if its length is less than or equal to the maximum length. Note: This property is never true in Gecko, because elements' values are prevented from being longer than maxlength. If true, the element matches the the :invalid and :out-of-
range CSS pseudo-classes. tooShort Read only A Boolean that is true if the value fails to meet the specified minlength for HTMLInputElement or HTMLTextAreaElement objects, or false if its length is greater than or equal to the minimum length. If true, the element matches the :invalid and :out-of-
range CSS pseudo-classes. typeMismatch Read only A Boolean that is true if the value is not in the req...
WebGLRenderingContext.blendColor() - Web APIs
Return value None. ...
... Return value None. ...
... Return value None. ...
... Return value None. Examples To set the blend color, use: gl.blendColor(0, 0.5, 1, 1); To get the blend color, query the BLEND_COLOR constant which returns a Float32Array. ...
Using the Web Audio API - Web APIs
t.destination); This will make our audio graph look like this: The default value for gain is 1; this keeps the current volume the same. Gain can be set to a minimum of about -3.4 and a max of about 3.4. Here we'll allow the boombox to move the gain up to 2 (double the original volume) and down to 0 (this will effectively mute our sound). Let's give the user control to do this -- we'll use a
range input: <input type="
range" id="volume" min="0" max="2" value="1" step="0.01"> Note:
Range inputs are a really handy input type for updating values on audio nodes. You can specify a
range's values and use them directly with the audio node's parameters. So let's grab this input's value and update the gain value when the input node has its value changed by the user: const volumeControl = docu...
...ating a node this time. When we do it this way, we have to pass in the context and any options that that particular node may take: const pannerOptions = { pan: 0 }; const panner = new StereoPannerNode(audioContext, pannerOptions); Note: The constructor method of creating nodes is not supported by all browsers at this time. The older factory methods are supported more widely. ...
...s in the context and any options that that particular node may take: const pannerOptions = { pan: 0 }; const panner = new StereoPannerNode(audioContext, pannerOptions); Note: The constructor method of creating nodes is not supported by all browsers at this time. The older factory methods are supported more widely. Here our values
range from -1 (far left) and 1 (far right). ...
...ode may take: const pannerOptions = { pan: 0 }; const panner = new StereoPannerNode(audioContext, pannerOptions); Note: The constructor method of creating nodes is not supported by all browsers at this time. The older factory methods are supported more widely. Here our values
range from -1 (far left) and 1 (far right). ...
@counter-style - CSS: Cascading Style Sheets
ative. prefix Specifies a symbol that should be prepended to the marker representation. Prefixes are added to the representation in the final stage, so in the final representation of the counter, it comes before the negative sign. suffix Specifies, similar to the prefix descriptor, a symbol that is appended to the marker representation. Suffixes come after the marker representation.
range Defines the
range of values over which the counter style is applicable. If a counter style is used to represent a counter value outside of its
ranges, the counter style will drop back to its fallback style. pad Is used when you need the marker representations to be of a minimum length. For example if you want the counters to start at 01 and go through 02, 03, 04 etc, then the pad descriptor...
...xample if you want the counters to start at 01 and go through 02, 03, 04 etc, then the pad descriptor is to be used. For representations larger than the specified pad value, the marker is constructed as normal. fallback Specifies a system to fall back into if either the specified system is unable to construct the representation of a counter value or if the counter value outside the specified
range. If the specified fallback also fails to represent the value, then the fallback style's fallback is used, if one is specified. If there are either no fallback systems described or if the chain of fallback systems are unable to represent a counter value, then it will ultimately fall back to the decimal style. symbols Specifies the symbols that are to be used for the marker representations. Sy...
... can be read out as numbers or alphabets for ordered lists or as audio cues for unordered lists, based on the value of this descriptor. ...
...read out as numbers or alphabets for ordered lists or as audio cues for unordered lists, based on the value of this descriptor. ...
CSS reference - CSS: Cascading Style Sheets
dient>grayscale()gridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-startgrid-rowgrid-row-endgrid-row-startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rowsHHzhanging-punctuationheightheight (@viewport)@historical-forms:hoverhsl()hsla()hue-rotate()hyphensI<ident><image>image()image-orientationimage-renderingimage-set()@importin:in-
range:indeterminateinheritinitialinline-sizeinsetinset()inset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-start<integer>:invalidinvert()isolationJjustify-contentjustify-itemsjustify-selfKkHz@keyframesL:lang:last-child:last-of-typeleader():leftleft@left-bottom<length><length-percentage>letter-spacingline-breakline-heightlinear-gradient():linklist-stylelist-style-imageli...
...@viewport)min-inline-sizemin-widthmin-width (@viewport)min-zoom (@viewport)minmax()mix-blend-modemmmsN@namespacenegative (@counter-style):not:nth-child:nth-last-child:nth-last-of-type:nth-of-type<number>Oobject-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-rotate:only-child:only-of-typeopacityopacity():optionalorderorientation (@viewport)@ornamentsornaments()orphans:out-of-
rangeoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-blockoverflow-inlineoverflow-wrapoverflow-xoverflow-yoverscroll-behavioroverscroll-behavior-blockoverscroll-behavior-inlineoverscroll-behavior-xoverscroll-behavior-yPpad (@counter-style)paddingpadding-blockpadding-block-endpadding-block-startpadding-bottompadding-inlinepadding-inline-endpadding-inline-start...
...padding-block-startpadding-bottompadding-inlinepadding-inline-endpadding-inline-startpadding-leftpadding-rightpadding-top@pagepage-break-afterpage-break-beforepage-break-insidepaint()paint-orderpath()pc<percentage>perspectiveperspective()perspective-originplace-contentplace-itemsplace-self::placeholderpointer-eventspolygon()<position>positionprefix (@counter-style)ptpxQQquotesRradradial-gradient()
range (@counter-style)<ratio>:read-only:read-writerect()remrepeat()repeating-linear-gradient()repeating-radial-gradient():requiredresize<resolution>revertrgb()rgba():rightright@right-bottom:rootrotaterotate()rotate3d()rotateX()rotateY()rotateZ()row-gapSssaturate()scalescale()scale3d()scaleX()scaleY()scaleZ():scopescroll-behaviorscroll-marginscroll-margin-blockscroll-margin-block-endscroll-margin-block-...
...enderingtext-shadowtext-transformtext-underline-offsettext-underline-position<time><time-percentage><timing-function>top@top-centertouch-actiontransformtransform-box<transform-function>transform-origintransform-styletransitiontransition-delaytransition-durationtransition-propertytransition-timing-functiontranslatetranslate()translate3d()translateX()translateY()translateZ()turnUunicode-bidiunicode-
range (@font-face)unset<url>url()user-zoom (@viewport)V:validvar()vertical-alignvh@viewportviewport-fit (@viewport)visibility:visitedvmaxvminvwWwhite-spacewidowswidthwidth (@viewport)will-changeword-breakword-spacingword-wrapwriting-modeXxZz-indexzoom (@viewport)Others--* Selectors The following are the various selectors, which allow styles to be conditional based on various features of elements wit...
linear-gradient() - CSS: Cascading Style Sheets
ore color-stop points on the gradient line, you can create a highly customized transition between multiple colors. A color-stop's position can be explicitly defined by using a <length> or a <percentage>. If you don't specify the location of a color, it is placed halfway between the one that precedes it and the one that follows it. The following two gradients are equivalent. linear-gradient(red, o
range, yellow, green, blue); linear-gradient(red 0%, o
range 25%, yellow 50%, green 75%, blue 100%); By default, colors transition smoothly from the color at one color stop to the color at the subsequent color stop, with the midpoint between the colors being the half way point between the color transition. You can move this midpoint to any position between two color stops by adding an unlabelled % colo...
...ansition. The following changes from red to yellow at the 30% mark, and then transitions from yellow to blue over 35% of the gradient linear-gradient(red 40%, yellow 30%, blue 65%); Multi-position color stop are allowed. A color can be declared as two adjacent color stops by including both positions in the CSS declaration. The following three gradients are equivalent: linear-gradient(red 0%, o
range 10%, o
range 30%, yellow 50%, yellow 70%, green 90%, green 100%); linear-gradient(red, o
range 10% 30%, yellow 50% 70%, green 90%); linear-gradient(red 0%, o
range 10% 30%, yellow 50% 70%, green 90% 100%); By default, if there is no color with a 0% stop, the first color declared will be at that point. Similarly, the last color will continue to the 100% mark, or be at the 100% mark if no length has ...
...olor will continue to the 100% mark, or be at the 100% mark if no length has been declared on that last stop. ...
... Specifications Specification Status Comment CSS Images Module Level 4The definition of 'Gradient Color-Stops' in that specification. ...
Challenge solutions - Developer guides
This page provides solutions to the challenges posed in the CSS Getting Started tutorial. These are not the only possible solutions. The sections below correspond to the titles of the tutorial sections. Why use CSS Colors Challenge Without looking up a reference, find five more color names that work in your stylesheet. Solution CSS supports common color names like o
range, yellow, blue, green, or black. It also supports some more exotic color names like chartreuse, fuschia, or burlywood. See CSS Color value for a complete list as well as other ways of specifying colors. How CSS works DOM inspector Challenge In DOMi, click on a STRONG node. Use DOMi's right-hand pane to find out where the node's color is set to red, and where its appearance is made bolder than normal tex...
...l resource defines the font-weight property as bolder; your stylesheet defines the color property as red. Cascading and inheritance Inherited styles Challenge Change your stylesheet so that only the red letters are underlined. Solution Move the declaration for underlining from the rule for <p> to the one for <strong>. The resulting file looks like this: p {color: blue; } strong {color: o
range; text-decoration: underline;} Later sections of this tutorial describe style rules and declarations in greater detail. Selectors Second paragraph blue Challenge Without changing your HTML file, add a single rule to your CSS file that keeps all the initial letters the same color as they are now, but makes all the other text in the second paragraph blue. Solution Add a rule with an ID ...
...} The rules for the other colors all have more specific selectors, so they override the blue of the paragraph. Readable CSS Commenting out a rule Challenge Comment out part of your stylesheet, without changing anything else, to make the very first letter of your document red. Solution One way to do this is to put comment delimiters around the rule for .carrot: /* .carrot { color: o
range; } */ Text styles Big initial letters Challenge Without changing anything else, make all six initial letters twice the size in the browser's default serif font. Solution Add the following style declaration to the strong rule: font: 200% serif; If you use separate declarations for font-size and font-family, then the font-style setting on the first paragraph is not overridden. Co...
... on the first paragraph is not overridden. Color Three-digit color codes Challenge In your CSS file, change all the color names to 3-digit color codes without affecting the result. Solution The following values are reasonable approximations of the named colors: strong { color: #f00; /* red */ background-color: #ddf; /* pale blue */ font: 200% serif; } .carrot { color: #fa0; /* o
range */ } .spinach { color: #080; /* dark green */ } p { color: #00f; /* blue */ } Content Add an image Challenge Add a one rule to your stylesheet so that it displays the image at the start of each line. Solution Add this rule to your stylesheet: p:before{ content: url("yellow-pin.png"); } Lists Lower Roman numerals Challenge Add a rule to your stylesheet, to number the...
HTML attribute: max - HTML: Hypertext Markup Language
or equal to the value of the min attribute. If the max attribute is present by is not specified or is invalid, no max value is applied. If the max attribute is valid and a non-empty value is greater than the maximum allowed by the max attribute, constraint validation will prevent form submission. Valid for the numeric input types, including the date, month, week, time, datetime-local, number and
range types, and both the <progress> and <meter> elements, the max attribute is a number that specifies the most positive value a form control to be considered valid. If the value exceeds the max value allowed, the validityState.
rangeOverflow will be true, and the the control will be matched by the :out-of-
range and :invalid pseudo-classes. Syntax Syntax for max values by input type Input ...
... For the<progress> element, the max attribute describes how m...
... For the<progress> element, the max attribute describes how much work the task indicated by the...
... <input type="datetime-local" min="2019-12-25T23:59"> number <number> <input type="number" min="0" step="5" max="100">
range <number> <input type="
range" min="60" step="5" max="100"> Note: When the data entered by the user doesn't adhere to the maximum value set, the value is considered invalid in contraint validation and will match the :invalid and :out-of-
range pseudoclasses See Client-side validation and
rangeOverflow for more information. For the<progress> element, the max attribute describes how much work the task indicated by the progress element requires. If present, must have a value greater than zero and be a valid floating point number. For the <meter> element, the max attribute defines the upper numeric bound of the measured
range. This mus...
Date and time formats used in HTML - HTML: Hypertext Markup Language
seconds to the calendar (seriously) to handle the remaining three ten-thousandths of a day and to compensate for the gradual, naturally occurring slowing of Earth's rotation. While month 02, February, normally has 28 days, it has 29 days in leap years. Months of the year There are 12 months in the year, numbered 1 through 12. They are always represented by a two-digit ASCII string whose value
ranges from 01 through 12. See the table in the section Days of the month for the month numbers and their corresponding names (and lengths in days). Days of the month Month numbers 1, 3, 5, 7, 8, 10, and 12 are 31 days long. Months 4, 6, 9, and 11 are 30 days long. Month 2, February, is 28 days long most years, but is 29 days long in leap years. This is detailed in the following table. The months ...
...ecember 29--is considered the first week of the year. Therefore, December 30, 1952 occurs during the week 1953-W01. A year has 53 weeks if: The first day of the calendar year (January 1) is a Thursday or The first day of the year (January 1) is a Wednesday and the year is a leap year All other years have 52 weeks. ...
...o-digit minute. The minute may optionally be followed by another colon and a two-digit number of seconds. Milliseconds may be specified, optionally, by adding a decimal point character (".", U+002E) followed by one, two, or three digits. There are some additional basic rules: The hour is always specified using the 24-hour clock, with 00 being midnight and 11 PM being 23. No values outside the
range 00-23 are permitted. The minute must be a two-digit number between 00 and 59. No values outside that
range are allowed. If the number of seconds is omitted (to specify a time accurate only to the minute), no colon should follow the number of minutes. If specified, the integer portion of the number of seconds must be between 00 and 59. You cannot specify leap seconds by using values like 60 or ...
... character ("-", or U+002D) for time zones to the west of the prime meridian. A two-digit number of hours that the time zone is offset from the prime meridian. This value must be between 00 and 23. An optional colon (":") character. A two-digit number of minutes past the hour; this value must be between 00 and 59. While this format allows for time zones between -23:59 and +23:59, the current
range of time zone offsets is -12:00 to +14:00, and no time zones are currently offset from the hour by anything other than 00, 30, or 45 minutes. This may change at more or less anytime, since countries are free to tamper with their time zones at any time and in any way they wish to do so. Examples of valid global date and time strings Global date and time string Actual global date and t...
<input type="time"> - HTML: Hypertext Markup Language
ttributes such as size, since times are always about the same number of characters long. You'll have to resort to CSS for sizing needs. Using the step attribute You can use the step attribute to vary the amount of time jumped whenever the time is incremented or decremented (for example, so the time moves by 10 minutes at a time when clicking the little arrow widgets). This property has some st
range effects across browsers, so is not completely reliable. It takes an integer value that equates to the number of seconds you want to increment by; the default value is 60 seconds, or one minute. If you specify a value of less than 60 seconds (1 minute), the time input will show a seconds input area alongside the hours and minutes: <form> <label for="appt-time">Choose an appointment time: </la...
...This functionality...
...t:invalid+span:after { position: absolute; content: '?'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '?'; padding-left: 5px; } The result here is that: Only times between 12:00 and 18:00 will be seen as valid; times outside that
range will be denoted as invalid. Depending on what browser you're using, you might find that times outside the specified
range might not even be selectable in the time picker (e.g. Edge). Making min and max cross midnight By setting a min attribute greater than the max attribute, the valid time
range will wrap around midnight to produce a valid time
range which crosses midnight. This functionality is not supported by any other input types. While this feature is in the HTML spec, it is not yet universally supported. Ch...
...support it starting in version 82 and Firefox added it in version 76. No information is yet available about when or if Safari will add it. Be prepared for this situation to arise: const input = document.createElement('input'); input.type = 'time'; input.min = '23:00'; input.max = '01:00'; input.value = '23:59'; if (input.validity.valid && input.type === 'time') { // <input type=time> reversed
range supported } else { // <input type=time> reversed
range unsupported } Making times required In addition, you can use the required attribute to make filling in the time mandatory. As a result, supporting browsers will display an error if you try to submit a time that is outside the set bounds, or an empty time field. Let's look at an example; here we've set minimum and maximum times, and also...
HTTP conditional requests - HTTP
e is different to each listed in this header. By default, unless the etag is prefixed with 'W/', it performs a strong validation. If-Modified-Since Succeeds if the Last-Modified date of the distant resource is more recent than the one given in this header. If-Unmodified-Since Succeeds if the Last-Modified date of the distant resource is older or the same than the one given in this header. If-
Range Similar to If-Match, or If-Unmodified-Since, but can have only one single etag, or one date. If it fails, the
range request fails, and instead of a 206 Partial Content response, a 200 OK is sent with the complete resource. Use cases Cache update The most common use case for conditional requests is updating a cache. With an empty cache, or without a cache, the requested resource is sent back ...
...l browsers manage a cache and send such conditional requests without any special work to be done by Web developers. Integrity of a partial download Partial downloading of files is a functionality of HTTP that allows to resume previous operations, saving bandwidth and time, by keeping the already obtained information: A server supporting partial downloads broadcasts this by sending the Accept-
Ranges header. Once this happens, the client can resume a download by sending a
Ranges header with the missing
ranges: The principle is simple, but there is one potential problem: if the downloaded resource has been modified between both downloads, the obtained
ranges will correspond to two different versions of the resource, and the final document will be corrupted. To prevent this, conditional re...
...appens, the client can resume a download by sending a
Ranges header with the missing
ranges: The principle is simple, but there is one potential problem: if the downloaded resource has been modified between both downloads, the obtained
ranges will correspond to two different versions of the resource, and the final document will be corrupted. To prevent this, conditional requests are used. For
ranges, there are two ways of doing this. The more flexible one makes use of If-Unmodified-Since and If-Match and the server returns an error if the precondition fails; the client then restarts the download from the beginning: Even if this method works, it adds an extra response/request exchange when the document has been changed. This impairs performance, and HTTP has a specific header to avoid thi...
...o ways of doing this. The more flexible one makes use of If-Unmodified-Since and If-Match and the server returns an error if the precondition fails; the client then restarts the download from the beginning: Even if this method works, it adds an extra response/request exchange when the document has been changed. This impairs performance, and HTTP has a specific header to avoid this scenario: If-
Range: This solution is more efficient, but slightly less flexible, as only one etag can be used in the condition. Rarely is such additional flexibility needed. Avoiding the lost update problem with optimistic locking A common operation in Web applications is to update a remote document. This is very common in any file system or source control applications, but any application that allows to store...
206 Partial Content - HTTP
The HTTP 206 Partial Content success status response code indicates that the request has succeeded and has the body contains the requested
ranges of data, as described in the
Range header of the request. If there is only one
range, the Content-Type of the whole response is set to the type of the document, and a Content-
Range is provided. If several
ranges are sent back, the Content-Type is set to multipart/byte
ranges and each fragment covers one
range, with Content-
Range and Content-Type describing it. Status 206 Partial Content Examples A response containing one single
range: HTTP/1.1 206 Partial Content Date: Wed, 15 Nov 2015 06:25:24 GMT Last-Modified: Wed, 15 Nov 2015 04:58:08 GMT Content-
Range: bytes 21010-47021/47022 Content-Length: 26012 Content-Type: image/gif ... 26012 bytes o...
...ith Content-
Range and Content-Type describing it. Status 206 Partial Content Examples A response containing one single
range: HTTP/1.1 206 Partial Content Date: Wed, 15 Nov 2015 06:25:24 GMT Last-Modified: Wed, 15 Nov 2015 04:58:08 GMT Content-
Range: bytes 21010-47021/47022 Content-Length: 26012 Content-Type: image/gif ... 26012 bytes of partial image data ... A response containing several
ranges: HTTP/1.1 206 Partial Content Date: Wed, 15 Nov 2015 06:25:24 GMT Last-Modified: Wed, 15 Nov 2015 04:58:08 GMT Content-Length: 1741 Content-Type: multipart/byte
ranges; boundary=String_separator --String_separator Content-Type: application/pdf Content-
Range: bytes 234-639/8000 ...the first
range... --String_separator Content-Type: application/pdf Content-
Range: bytes 4590-7999/8000 ...the sec...
...HTTP/1.1 206 Partial Content Date: Wed, 15 Nov 2015 06:25:24 GMT Last-Modified: Wed, 15 Nov 2015 04:58:08 GMT Content-Length: 1741 Content-Type: multipart/byte
ranges; boundary=String_separator --String_separator Content-Type: application/pdf Content-
Range: bytes 234-639/8000 ...the first
range... ...
...=String_separator --String_separator Content-Type: application/pdf Content-
Range: bytes 234-639/8000 ...the first
range... ...
Indexed collections - JavaScript
nterpreted as an arrayLength, not as a single element. let arr = [42] // Creates an array with only one element: // the number 42. let arr = Array(42) // Creates an array with no elements // and arr.length set to 42. // // This is equivalent to: let arr = [] arr.length = 42 Calling Array(N) results in a
RangeError, if N is a non-whole number whose fractional portion is non-zero. The following example illustrates this behavior. let arr = Array(9.3) //
RangeError: Invalid array length If your code needs to create arrays with single elements of an arbitrary data type, it is safer to use array literals. Alternatively, create an empty array first before adding the single element to it. In ES2015, you...
...ngth'] // 3 Populating an array You can populate an array by assigning values to its elements. For example: let emp = [] emp[0] = 'Casey Jones' emp[1] = 'Phil Lesh' emp[2] = 'August West' Note: If you supply a non-integer value to the array operator in the code above, a property will be created in the object representing the array, instead of an array element. ...
... The length property is special. ...
...at to read and write the contents of the buffer. Typed array views Typed array views have self descriptive names and provide views for all the usual numeric types like Int8, Uint32, Float64 and so forth. There is one special typed array view, {jsxref("Uint8ClampedArray")}}, which clamps the values between 0 and 255. This is useful for Canvas data processing, for example. ...
Iterators and generators - JavaScript
. The most common iterator in JavaScript is the Array iterator, which simply returns each value in the associated array in sequence. While it is easy to imagine that all iterators could be expressed as arrays, this is not true. Arrays must be allocated in their entirety, but iterators are consumed only as necessary. Because of this, iterators can express sequences of unlimited size, such as the
range of integers between 0 and Infinity. Here is an example which can do just that. It allows creation of a simple
range iterator which defines a sequence of integers from start (inclusive) to end (exclusive) spaced step apart. Its final return value is the size of the sequence it created, tracked by the variable iterationCount. function make
RangeIterator(start = 0, end = Infinity, step = 1) { l...
...h can do just that. It allows creation of a simple
range iterator which defines a sequence of integers from start (inclusive) to end (exclusive) spaced step apart. Its final return value is the size of the sequence it created, tracked by the variable iterationCount. ...
...= start; let iterationCount = 0; const
rangeIterator = { next: function() { let result; if (nextIndex < end) { result = { value: nextIndex, done: false } nextIndex += step; iterationCount++; return result; } return { value: iterationCount, done: true } } }; return
rangeIterator; } Using the iterator then looks like this: const it = make
RangeIterator(1, 10, 2); let result = it.next(); while (!result.done) { console.log(result.value); // 1 3 5 7 9 result = it.next(); } console.log("Iterated over sequence of size: ", result.value); // [5 numbers returned, that took interval in between: 0 to 10] Note: It is not possible to know reflectively whether a part...
...by calling the generator's next method, the Generator function executes until it encounters the yield keyword. The function can be called as many times as desired, and returns a new Generator each time. Each Generator may only be iterated once. We can now adapt the example from above. The behavior of this code is identical, but the implementation is much easier to write and read. function* make
RangeIterator(start = 0, end = 100, step = 1) { let iterationCount = 0; for (let i = start; i < end; i += step) { iterationCount++; yield i; } return iterationCount; } Iterables An object is iterable if it defines its iteration behavior, such as what values are looped over in a for...of construct. Some built-in types, such as Array or Map, have a default iteration beha...
Regular expressions - JavaScript
descriptions and examples. Assertions Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions). Character classes Distinguish different types of characters. For example, distinguishing between letters and digits. Groups and
ranges Indicate groups and
ranges of expression characters. Quantifiers Indicate numbers of characters or expressions to match. Unicode property escapes Distinguish based on unicode character properties, for example, upper- and lower-case letters, math symbols, and punctuation. If you want to look at all the special characters that can be used in regular expressions in a single table, see the fo...
...lowing: Special characters in regular expressions. Characters / constructs Corresponding article \, ., \cX, \d, \D, \f, \n, \r, \s, \S, \t, \v, \w, \W, \0, \xhh, \uhhhh, \uhhhhh, [\b] Character classes ^, $, x(?=y), x(?!y), (?<=y)x, (?<!y)x, \b, \B Assertions (x), (?:x), (?<Name>x), x|y, [xyz], [^xyz], \Number Groups and
ranges *, +, ?, x{n}, x{n,}, x{n,m} Quantifiers \p{UnicodeProperty}, \P{UnicodeProperty} Unicode property escapes Note: A larger cheatsheet is also available (only aggregating parts of those individual articles). Escaping If you need to use any of the special characters literally (actually searching for a "*", for instance), you must escape it by putting ...
...xplained in detail below in Advanced Searching With Flags. Why isn't this built into JavaScript? There is a proposal to add such a function to RegExp, but it was rejected by TC39. Using parentheses Parentheses around any part of the regular expression pattern causes that part of the matched substring to be remembered. Once remembered, the substring can be recalled for other use. See Groups and
ranges for more details. Using regular expressions in JavaScript Regular expressions are used with the RegExp methods test() and exec() and with the String methods match(), replace(), search(), and split(). These methods are explained in detail in the JavaScript reference. Methods that use regular expressions Method Description exec() Executes a search for a match in a s...
...ing should be treated as multiple lines. If the m flag is used, ^ and $ match at the start or end of any line within the input string instead of the start or end of the entire string. Examples Note: Several examples are also available in: The reference pages for exec(), test(), match(), matchAll(), search(), replace(), split() This guide articles': character classes, assertions, groups and
ranges, quantifiers, Unicode property escapes Using special characters to verify input In the following example, the user is expected to enter a phone number. When the user presses the "Check" button, the script checks the validity of the number. If the number is valid (matches the character sequence specified by the regular expression), the script shows a message thanking the user and confirming t...
Array.prototype.filter() - JavaScript
element the Array object being traversed If a thisArg parameter is provided to filter, it will be used as the callback's this value. Otherwise, the value undefined will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. filter() does not mutate the array on which it is called. The
range of elements processed by filter() is set before the first invocation of callback. Elements which are appended to the array (from callback) after the call to filter() begins will not be visited by callback. If existing elements of the array are deleted in the same way they will not be visited. Polyfill filter() was added to the ECMA-262 standard in the 5th edition. Therefore, it may not be prese...
... arrByID = arr.filter(filterByID) console.log('Filtered Array\n', arrByID) // Filtered Array // [{ id: 15 }, { id: -1 }, { id: 3 }, { id: 12.2 }] console.log('Number of Invalid Entries = ', invalidEntries) // Number of Invalid Entries = 5 Searching in array Following example uses filter() to filter array content based on search criteria. ...
... let fruits = ['apple', 'banana', 'grapes', 'mango', 'o
range'] /** * Filter array items based on search criteria (query) */ function filterItems(arr, query) { return arr.filter(function(el) { return el.toLowerCase().indexOf(query.toLowerCase()) !== -1 }) } console.log(filterItems(fruits, 'ap')) // ['apple', 'grapes'] console.log(filterItems(fruits, 'an')) // ['banana', 'mango', 'o
range'] ES2015 Implementation const fruits = ['apple', 'banana', 'grapes', 'mango', 'o
range'] /** * Filter array items based on search criteria (query) */ const filterItems = (arr, query) => { return arr.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) !== -1) } console.log(filterItems(fruits, 'ap')) // ['apple', 'grapes'] console.log(filterItems(fruits, 'an')) // ['banana', 'mango'...
...ES2015 Implementation const fruits = ['apple', 'banana', 'grapes', 'mango', 'o
range'] /** * Filter array items based on search criteria (query) */ const filterItems = (arr, query) => { return arr.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) !== -1) } console.log(filterItems(fruits, 'ap')) // ['apple', 'grapes'] console.log(filterItems(fruits, 'an')) // ['banana', 'mango', 'o
range'] Affecting Initial Array (modifying, appending and deleting) The following examples tests the behavior of the filter method when the array is modified. // Modifying each words let words = ['spray', 'limit', 'exuberant', 'destruction','elite', 'present'] const modifiedWords = words.filter( (word, index, arr) => { arr[index+1] +=' extra' return word.length < 6 }) console.log(modifiedWor...
String.prototype.repeat() - JavaScript
ry. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax str.repeat(count) Parameters count An integer between 0 and +Infinity, indicating the number of times to repeat the string. Return value A new string containing the specified number of copies of the given string. Exceptions
RangeError: repeat count must be non-negative.
RangeError: repeat count must be less than infinity and not overflow maximum string size. Polyfill This method has been added to the ECMAScript 2015 specification and may not be available in all JavaScript implementations yet. However, you can polyfill String.prototype.repeat() with the following snippet: if (!String.prototype.repeat) { String.proto...
...epeat() with the following snippet: if (!String.prototype.repeat) { String.prototype.repeat = function(count) { 'use strict'; if (this == null) throw new TypeError('can\'t convert ' + this + ' to object'); var str = '' + this; // To convert string to integer. count = +count; // Check NaN if (count != count) count = 0; if (count < 0) throw new
RangeError('repeat count must be non-negative'); if (count == Infinity) throw new
RangeError('repeat count must be less than infinity'); count = Math.floor(count); if (str.length == 0 || count == 0) return ''; // Ensuring count is a 31-bit integer allows us to heavily optimize the // main part. But anyway, most current (August 2014) browsers can't handle // string...
...w
RangeError('repeat count must be less than infinity'); count = Math.floor(count); if (str.length == 0 || count == 0) return ''; // Ensuring count is a 31-bit integer allows us to heavily optimize the // main part. ...
... if (str.length * count >= 1 << 28) throw new
RangeError('repeat count must not overflow maximum string size'); var maxCount = str.length * count; count = Math.floor(Math.log(count) / Math.log(2)); while (count) { str += str; count--; } str += str.substring(0, maxCount - str.length); return str; } } Examples Using repeat 'abc'.repeat(-1) //
RangeError 'abc'.repeat(0) // '' 'abc'.repeat(1) // 'abc' 'abc'.repeat(2) // 'abcabc' 'abc'.repeat(3.5) // 'abcabcabc' (count will be converted to integer) 'abc'.repeat(1/0) //
RangeError ({ toString: () => 'abc', repeat: String.prototype.repeat }).repeat(2) // 'abcabc' (repeat() is a generic method) Specifications Specification ECMAScript (ECMA-262)The definit...
Lexical grammar - JavaScript
0; // 2147483648 var FLT_EXPONENT = 0b01111111100000000000000000000000; // 2139095040 var FLT_MANTISSA = 0B00000000011111111111111111111111; // 8388607 Octal Octal number syntax uses a leading zero followed by a lowercase or uppercase Latin letter "O" (0o or 0O). Because this syntax is new in ECMAScript 2015, see the browser compatibility table, below. ...
... 0xFFFFFFFFFFFFFFFFF // 295147905179352830000 0x123456789ABCDEF // 81985529216486900 0XA // 10 BigInt literal The BigInt type is a numeric primitive in JavaScript that can represent integers with arbitrary precision. ...
... unescaped in string literals. Any code points may appear in the form of an escape sequence. String literals evaluate to ECMAScript String values. When generating these String values Unicode code points are UTF-16 encoded. 'foo' "bar" Hexadecimal escape sequences Hexadecimal escape sequences consist of \x followed by exactly two hexadecimal digits representing a code unit or code point in the
range 0x0000 to 0x00FF. '\xA9' // "(C)" Unicode escape sequences A Unicode escape sequence consists of exactly four hexadecimal digits following \u. It represents a code unit in the UTF-16 encoding. For code points U+0000 to U+FFFF, the code unit is equal to the code point. Code points U+10000 to U+10FFFF require two escape sequences representing the two code units (a surrogate pair) used to encode...
... the two code units (a surrogate pair) used to encode the character; the surrogate pair is distinct from the code point. See also String.fromCharCode() and String.prototype.charCodeAt(). '\u00A9' // "(C)" (U+A9) Unicode code point escapes A Unicode code point escape consists of \u{, followed by a code point in hexadecimal base, followed by }. The value of the hexadecimal digits must be in the
range 0 and 0x10FFFF inclusive. Code points in the
range U+10000 to U+10FFFF do not need to be represented as a surrogate pair. Code point escapes were added to JavaScript in ECMAScript 2015 (ES6). See also String.fromCodePoint() and String.prototype.codePointAt(). '\u{2F804}' // CJK COMPATIBILITY IDEOGRAPH-2F804 (U+2F804) // the same character represented as a surrogate pair '\uD87E\uDC04' Regular...
spreadMethod - SVG: Scalable Vector Graphics
may be defined as outer and inner circles by the cx, cy and r (outer) and fx, fy and fr (inner) attributes. ...
.../svg"> <defs> <linearGradient id="PadGradient" x1="33%" x2="67%"> <stop offset="0%" stop-color="fuchsia"/> <stop offset="100%" stop-color="o
range"/> </linearGradient> <linearGradient id="ReflectGradient" spreadMethod="reflect" x1="33%" x2="67%"> <stop offset="0%" stop-color="fuchsia"/> <stop offset="100%" stop-color="o
range"/> </linearGradient> <linearGradient id="RepeatGradient" spreadMethod="repeat" x1="33%" x2="67%"> <stop offset="0%" stop-color="fuchsia"/> <stop offset="100%" stop-color="o
range"/> </linearGradient> </defs> <rect fill="url(#PadGradient)" x="10" y="0" width="200" height="40"/> <rect fill="url(#ReflectGradient)" x="10" y="50" ...
...e difference between the three spread methods. ...
...fr="17%"> <stop offset="0%" stop-color="fuchsia"/> <stop offset="100%" stop-color="o
range"/> </radialGradient> <radialGradient id="RadialReflectGradient" spreadMethod="reflect" cx="75%" cy="25%" r="33%" fx="64%" fy="18%" fr="17%"> <stop offset="0%" stop-color="fuchsia"/> <stop offset="100%" stop-color="o
range"/> </radialGradient> <radialGradient id="RadialRepeatGradient" spreadMethod="repeat" cx="75%" cy="25%" r="33%" fx="64%" fy="18%" fr="17%"> <stop offset="0%" stop-color="fuchsia"/> <stop offset="100%" stop-color="o
range"/> </radialGradient> </defs> <rect fill="url(#RadialPadGradient)" x="10" y="10" ...
Content type - SVG: Scalable Vector Graphics
No embedded white space is allowed in clock values, although leading and trailing white space characters will be ignored. The following are ...
...No embedded white space is allowed in clock values, although leading and trailing white space characters will be ignored. The following are examples of legal clock values: Full clock va...
...icc-color(" name (, number)+ ")" The corresponding SVG DOM interface for <icccolor> is SVGICCColor. Integer <integer> An <integer> is specified as an optional sign character (+ or -) followed by one or more digits 0 to 9: integer ::= [+-]? [0-9]+ If the sign character is not present, the number is non-negative. Unless stated otherwise for a particular attribute or property, the
range for an <integer> encompasses (at a minimum) -2147483648 to 2147483647. Within the SVG DOM, an <integer> is represented as a number or an SVGAnimatedInteger. IRI <IRI> An Internationalized Resource Identifier. On the Internet, resources are identified using IRIs (Internationalized Resource Identifiers). For example, an SVG file called someDrawing.svg located at http://example.com mig...
...r>s, where the second <number> is optional. number-optional-number ::= number | number, number In the SVG DOM, a <number-optional-number> is represented using a pair of SVGAnimatedInteger or SVGAnimatedNumber objects. Opacity value <opacity-value> The opacity of the color or the content the current object is filled with, as a <number>. Any values outside the
range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this
range. Paint <paint> The values for properties fill and stroke are specifications of the type of paint to use when filling or stroking a given graphics element. The available options and syntax for <paint> are described in Specifying paint. Within the SVG DOM, <paint> values are represented using SVGPaint objects. ...
No Proxy For configuration - Archive of obsolete content
Port-only filters ":80" or "*:80" are not supported. all non-FQDN hosts, such as intranet hosts The string "<local>" (without quotes) "<local>" By...
...Port-only filters ":80" or "*:80" are not supported. ...
... 127.0.0.1 proxy Ports 1 127.0.0.1 proxy no port .mozilla.org www.mozilla.org:80 www.mozilla.org:81 direct direct port number .mozilla.org:80 www.mozilla.org:80 www.mozilla.org direct...
LIR - Archive of obsolete content
integer 32 bit load an int parameter (register or stack location). 4 paramq quad 64 bit load a quad parameter (register or stack location). ...
...k location). 4 paramq quad 64 bit load a quad parameter (register or stack location). ...
...d parameter (register or stack location). ...
Scroll Bars - Archive of obsolete content
Scroll bars can be created in a number of ways. In XUL, one can be created using the scrollbar tag. Some elements, such as text boxes, will also add scroll bars as necessary when the content inside is too large. ...
...he scroll bar orient This specifies the direction of the scroll bar. The default is horizontal, which creates a scroll bar that extends from left to right. You can also specify vertical which creates a scroll bar that extends from top to bottom. curpos This indicates the current position of the scroll bar thumb (the box that you can slide back and forth.) The value
ranges from 0 to the value of maxpos. This value does not need a unit. The default value is 0. maxpos This indicates the maximum position of the scroll bar thumb. The is a numeric value and does not have a unit. The default value is 100. increment The value here specifies how much the value of curpos changes by when the user clicks on one of the scroll bar arrows. The de...
... by when the user clicks on one of the scroll bar arrows. The default value is 1. pageincrement The value here specifies how much the value of curpos changes by when the user clicks pages through the scroll bar, which can be done by clicking on the tray between the box and the arrows. The default value is 10. The example given in the syntax above will create a scroll bar that can
range from a value of 0 to 100. The value 100 might be the number of lines in a list, but it could be anything you want. The initial value in this example is 20. When clicking on one of the scroll bar arrows, the value would change by 1 either up or down. By paging through the scroll bar, the value will change by 10. When the user clicks the scroll bar arrows, the thumb will move by the amount specifie...
Trees - Archive of obsolete content
Some examples of trees include the list of messages in a mail application, or the Bookmarks window in Mozilla. ...
...Some examples of trees include the list of messages in a mail application, or the Bookmarks window in Mozilla. ...
...tem> </treechildren> </tree> As can be seen in the image, the tree has been created with two rows of data. This tree has two columns, the second of which will take up more space than the first. You will usually make the columns flexible. You can also supply widths with the width attribute. You should include the same number of treecol elements as there are columns in the tree. Otherwise st
range things might happen. The header row is created automatically. The button in the upper right corner can be used to hide and show the columns. You can place a hidecolumnpicker attribute on the tree and set it to true if you would like to hide this button. If this button is hidden, the user will not be able to hide columns. Make sure that you set an id attribute on each column or the hiding and sh...
NPP_Write - Archive of obsolete content
e(NPP instance, NPStream* stream, int32 offset, int32 len, void* buf); Parameters The function has the following parameters: instance Pointer to the current plug-in instance. stream Pointer to the current stream. offset Offset in bytes of buf from the beginning of the data in the stream. Can be used to check stream progress or by
range requests from NPN_RequestRead. len Length in bytes of buf; number of bytes accepted. buf Buffer of data, delivered by the stream, that contains len bytes of data offset bytes from the start of the stream. The buffer is allocated by the browser and is deleted after returning from the function, so the plug-in should make a copy of the data it needs to keep. Returns The plug-in should return the...
...s indicated in the NPP_WriteReady call. After a stream is created by a call to NPP_NewStream, the browser calls NPP_Write either: If the plug-in requested a normal-mode stream, the data in the stream is delivered to the plug-in instance in a series of calls to NPP_WriteReady and NPP_Write. If the plug-in requested a seekable stream, the NPN_RequestRead function requests reads of a specified byte
range that results in a series of calls to NPP_WriteReady and NPP_Write. The plug-in can use the offset parameter to track the bytes that are written. This gives you different information depending in the type of stream. In a normal-mode stream., the parameter value increases as the each buffer is written. The buf parameter is not persistent, so the plug-in must process data immediately or allocate me...
...P_Write. The plug-in can use the offset parameter to track the bytes that are written. This gives you different information depending in the type of stream. ...
Introduction to SSL - Archive of obsolete content
to U.S. government restrictions on products that support anything stronger than 40-bit encryption, disabling support for all 40-bit ciphers effectively restricts access to network browsers that are available only in the United States (unless the server involved has a special Global Server ID that permits the international client to "step up" to stronger encryption). To serve the largest possible
range of users, it's a good idea for administrators to enable as broad a
range of SSL cipher suites as possible. That way, when a domestic client or server is dealing with another domestic server or client, respectively, it will negotiate the use of the strongest ciphers available. And when an domestic client or server is dealing with an international server or client, it will negotiate the use of thos...
...s requirement, which provides some assurance of the server's identity and thus helps protect against a form of security attack known as "man in the middle." An SSL-enabled client goes through these steps to authenticate a server's identity: Is today's date within the validity period? The client checks the server certificate's validity period. If the current date and time are outside of that
range, the authentication process won't go any further. If the current date and time are within the certificate's validity period, the client goes on to Step. Is the issuing CA a trusted CA? Each SSL-enabled client maintains a list of trusted CA certificates, represented by the shaded area on the right side of Figure 3. This list determines which server certificates the client will accept. If the dist...
...cified in the certificate has not yet been established. The certificate might have been created by someone attempting to impersonate the user. To validate the binding between the public key and the DN, the server must also complete Step 3 and Step 4. Is today's date within the validity period? The server checks the certificate's validity period. If the current date and time are outside of that
range, the authentication process won't go any further. If the current date and time are within the certificate's validity period, the server goes on to Step 3. Is the issuing CA a trusted CA? Each SSL-enabled server maintains a list of trusted CA certificates, represented by the shaded area on the right side of Figure 3. This list determines which certificates the server will accept. If the DN of the...
Beginner's guide to media queries - Learn web development
s. These features are used to create layouts that respond to different screen sizes. For example, to change the body text color to red if the viewport is exactly 600 pixels, you would use the following media query. @media screen and (width: 600px) { body { color: red; } } Open this example in the browser, or view the source. The width (and height) media features can be used as
ranges, and therefore be prefixed with min- or max- to indicate that the given value is a minimum, or a maximum. For example, to make the color blue if the viewport is narrower than 600 pixels, use max-width: @media screen and (max-width: 600px) { body { color: blue; } } Open this example in the browser, or view the source. In practice, using minimum or maximum values is much more us...
... design at the size where the content starts to break in some way. Perhaps the line lengths become far too long, or a boxed out sidebar gets squashed and hard to read. That's the point at which you want to use a media query to change the design to a better one for the space you have available. This approach means that it doesn't matter what the exact dimensions are of the device being used, every
range is catered for. The points at which a media query is introduced are known as breakpoints. The Responsive Design Mode in Firefox DevTools is very useful for working out where these breakpoints should go. You can easily make the viewport smaller and larger to see where the content would be improved by adding a media query and tweaking the design. Active learning: mobile first responsive design ...
...; } .grid li { border: 1px solid #666; padding: 10px; } Open the grid layout example in the browser, or view the source. With the example open in your browser, make the screen wider and narrower to see the number of column tracks change. The nice thing about this method is that grid is not looking at the viewport width, but the width it has available for this component. It might seem st
range to wrap up a section about media queries with a suggestion that you might not need one at all! However, in practice you will find that good use of modern layout methods, enhanced with media queries, will give the best results. Test your skills! You've reached the end of this article, but can you remember the most important information? You can find a test to verify that you've retained this inf...
Getting started with CSS - Learn web development
t and target that class. In your HTML document, add a class attribute to the second list item. Your list will now look like this: <ul> <li>Item one</li> <li class="special">Item two</li> <li>Item <em>three</em></li> </ul> In your CSS you can target the class of special by creating a selector that starts with a full stop character. Add the following to your CSS file: .special { color: o
range; font-weight: bold; } Save and refresh to see what the result is. You can apply the class of special to any element on your page that you want to have the same look as this list item. For example, you might want the <span> in the paragraph to also be o
range and bold. Try adding a class of special to it, then reload your page and see what happens. Sometimes you will see rules with a selector ...
...y the class of special to any element on your page that you want to have the same look as this list item. For example, you might want the <span> in the paragraph to also be o
range and bold. Try adding a class of special to it, then reload your page and see what happens. Sometimes you will see rules with a selector that lists the HTML element selector along with the class: li.special { color: o
range; font-weight: bold; } This syntax means "target any li element that has a class of special". ...
...ent selector along with the class: li.special { color: o
range; font-weight: bold; } This syntax means "target any li element that has a class of special". If you were to do this then you would no longer be able to apply the class to a <span> or another element by simply adding the class to it; you would have to add that element to the list of selectors: li.special, span.special { color: o
range; font-weight: bold; } As you can imagine, some classes might be applied to many elements and you don't want to have to keep editing your CSS every time something new needs to take on that style. Therefore it is sometimes best to bypass the element and simply refer to the class, unless you know that you want to create some special rules for one element alone, and perhaps want to make sure they ...
CSS property compatibility table for form controls - Learn web development
e to the complexity of CSS and HTML forms, these tables can't be considered a perfect reference. However, they will give you good insight into what can and can't be done, which will help you learn how to do things. How to read the tables Values For each property, there are four possible values: Yes There's reasonably consistent support for the property across browsers. You may still face st
range side effects in certain edge cases. Partial While the property works, you may frequently face st
range side effects or inconsistencies. You should probably avoid these properties unless you master those side effects first. No The property simply doesn't work or is so inconsistent that it's not reliable. n.a. The property has no meaning for this type of widget. Rendering For each property ...
... N.A. text-overflow N.A. N.A. text-shadow N.A. N.A. text-transform N.A. N.A. Border and background background No[1] No[1] Supported, but there is too much inconsistency between browsers to be reliable. border-radius No[1] No[1] box-shadow No[1] No[1]
Range See the
range input type. There is no standard way to change the style of the
range grip and Opera has no way to tweak the default rendering of the
range widget. Property N T Note CSS box model width Yes Yes height Partial[1] Partial[1] Chrome and Opera add some extra space around the widget, whereas Opera on Windows...
... border No Yes margin Yes Yes padding Partial[1] Yes The padding is applied, but has no visual effect. Text and font color N.A. N.A. font N.A. N.A. letter-spacing N.A. N.A. ...
HTML table basics - Learn web development
a few properties: border, background, width, and visibility. To set other properties you'll have to either style every <td> or <th> in the column, or use a complex selector such as :nth-child(). ...
...Instead of doing this, we can specify the information once, on a <col> element. <col> elements are specified inside a <colgroup> container just below the...
...information once, on a <col> element. <col> elements are specified inside a <colgroup> container just below the opening <table> tag. We could create the same effect as we see above by specifying our table as follows: <table> <colgroup> <col> <col style="background-color: yellow"> </colgroup> <tr> <th>Data 1</th> <th>Data 2</th> </tr> <tr> <td>Calcutta</td> <td>O
range</td> </tr> <tr> <td>Robots</td> <td>Jazz</td> </tr> </table> Effectively we are defining two "style columns", one specifying styling information for each column. We are not styling the first column, but we still have to include a blank <col> element -- if we didn't, the styling would just be applied to the first column. If we wanted to apply the styling information to both columns...
Error codes returned by Mozilla APIs
curred rather than continuing. NS_ERROR_OUT_OF_MEMORY (0x8007000E) This error occurs when there is not enough memory available to carry out an operation, or an error occurred trying to allocate memory. NS_ERROR_ILLEGAL_VALUE (0x80070057) An argument supplied to a method was not valid, for instance a null value was supplied as an argument which does not allow null values, or a value was out of
range. NS_ERROR_NO_AGGREGATION (0x80040110) NS_ERROR_NOT_AVAILABLE (0x80040111) An operation could not be completed because some other necessary component or resource was not available. NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154) Returned when a service could not be found. NS_ERROR_FACTORY_REGISTER_AGAIN (0x80040155) This error is returned when registering a component and the registration sh...
...OCK (0x80470007) This error occurs when an attempt is made to read from a non blocking stream yet there is not enough data available to read without waiting for more. Document and Node Errors The following errors can occur when using documents, nodes and elements. NS_ERROR_DOM_INDEX_SIZE_ERR (0x80530001) An attempt was made to adjust the value of a text node using an index that was out of
range. NS_ERROR_DOM_DOMSTRING_SIZE_ERR (0x80530002) An attempt was made to create a string larger than is supported. NS_ERROR_DOM_HIERARCHY_REQUEST_ERR (0x80530003) A node was inserted into a location where it cannot go. For instance, a node cannot be inserted into a descendant of itself. NS_ERROR_DOM_WRONG_DOCUMENT_ERR (0x80530004) An operation was performed on a document involving a node that w...
...lid value. NS_ERROR_DOM_INVALID_MODIFICATION_ERR (0x8053000D) An attempt was made to modify the type of the attribute. NS_ERROR_DOM_NAMESPACE_ERR (0x8053000E) A namespace was not valid. For instance, this error can occur when an invalid character was used in a namespace URI. NS_ERROR_DOM_INVALID_ACCESS_ERR (0x8053000F) A attempt was made to access a value that was not allowed. NS_ERROR_DOM_
RANGE_BAD_BOUNDARYPOINTS_ERR (0x805C0001) The boundary points of a
range are invalid. NS_ERROR_DOM_
RANGE_INVALID_NODE_TYPE_ERR (0x805C0002) The container of an boundary point of a
range is being set to either a node of an invalid type or a node with an ancestor of an invalid type. NS_ERROR_DOM_VALIDATION_ERR (0x805300 16) NS_ERROR_DOM_TYPE_MISMATCH_ERR (0x805300 17) NS_ERROR_DOM_SVG_WRONG_T...
A guide to searching crash reports
age by clicking on the "Super Search" link near the toolbar at the top right of any page in crash-stats. This brings up a search form like the one in the following screenshot. Fields are provided for four common search criteria: product, version, platform, and process type. The product field is pre-populated with "Firefox" because that is a common case. As the fine print says, the default date
range is the past week. The default search: Signature facet If you click on the "Search" button, you will get results like the ones in the following screenshot. By default, the "Signature facet" tab is selected. ("Facet" is a term that means "group".) In these results, the found crash reports are grouped according to crash signature and ranked by group size. The columns show each group's rank, sig...
... field to field. In particular, fields that can have many possible values (such as numeric fields) often don't group well. For example, if we do a default search grouped by uptime we get results like those in the following screenshot. In this example the top 10 groups account for less than 12% of all crashes, and there is an extremely long tail. These results would be improved by using numeric
ranges instead of individual values, but unfortunately that isn't supported. Advanced Usage The combination of searching and grouping is powerful. Searches find crash reports that match particular criteria, and grouping organizes those crash reports into interesting groups. When a search is performed, the page's URL is updated to include the search parameters. This means that the results of any sear...
.... Searches find crash reports that match particular criteria, and grouping organizes those crash reports into interesting groups. When a search is performed, the page's URL is updated to include the search parameters. This means that the results of any search can be easily shared by copying and pasting the page's URL. To become an expert at searching and grouping requires understanding the full
range of the 100+ fields available for searching and grouping. One way to learn about them is to read lots of individual crash reports; note that all fields shown in the Details tab of an individual crash report have a tool-tip that indicates its key for search. Alternatively, you can browse the complete list. There is also an API through which searches can be performed programmatically. See the API d...
NSS 3.14 release notes
nloaded from https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_14_RTM/src/. The CVS tag is NSS_3_14_RTM. New in NSS 3.14 The sections that follow discuss specific changes in NSS 3.14 in more detail. Support for TLS 1.1 (RFC 4346) has been added (https://bugzilla.mozilla.org/show_bug.cgi?id=565047). To better support TLS 1.1 and future versions of TLS, a new version
range API was introduced to allow applications to specify the desired minimum and maximum versions. These functions are intended to replace the now-deprecated use of the SSL_ENABLE_SSL3 and SSL_ENABLE_TLS socket options. The following functions have been added to the libssl library included in NSS 3.14 SSL_Version
RangeGet (in ssl.h) SSL_Version
RangeGetDefault (in ssl.h) S...
...ntroduced to allow applications to specify the desired minimum and maximum versions. These functions are intended to replace the now-deprecated use of the SSL_ENABLE_SSL3 and SSL_ENABLE_TLS socket options. The following functions have been added to the libssl library included in NSS 3.14 SSL_Version
RangeGet (in ssl.h) SSL_Version
RangeGetDefault (in ssl.h) SSL_Version
RangeGetSupported (in ssl.h) SSL_Version
RangeSet (in ssl.h) SSL_Version
RangeSetDefault (in ssl.h) To better ensure interoperability with peers that support TLS 1.1, NSS has altered how it handles certain SSL protocol layer events. Such changes may present interoperability concerns when enabling TLS 1.1. When connecting to a server, the record layer v...
...are NOT disabled by this change; those cipher suites use HMAC-MD5, not plain MD5, and are still considered safe. Maximum key sizes for RSA and Diffie-Hellman keys have been increased to 16K bits. Command line utilities tstclnt, strsclnt, and selfserv have changed. The old options to disable SSL 2, SSL 3 and TLS 1.0 have been removed and replaced with a new -V option that specifies the enabled
range of protocol versions (see usage output of those tools). Bugs fixed in NSS 3.14 This Bugzilla query returns all the bugs fixed in NSS 3.14: https://bugzilla.mozilla.org/buglist.cgi?list_id=4643675;resolution=FIXED;classification=Components;query_format=advanced;product=NSS;target_milestone=3.14 ...
NSS 3.31 release notes
ttribute with the given name. PK11URI_ParseURI - parse PKCS#11 URI and return a new PK11URI object. New Macros in pkcs11uri.h Several new macros that start with PK11URI_PATTR_ for path attributes defined in RFC7512. Several new macros that start with PK11URI_QATTR_ for query attributes defined in RFC7512. ...
...URI - parse PKCS#11 URI and return a new PK11URI object. New Macros in pkcs11uri.h Several new macros that start with PK11URI_PATTR_ for path attributes defined in RFC7512. Several new macros that start with PK11URI_QATTR_ for query attributes defined in RFC7512. Notable Changes in NSS 3.31 The APIs that set a TLS version
range have been changed to trim the requested
range to the overlap with a systemwide crypto policy, if configured. SSL_Version
RangeGetSupported can be used to query the overlap between the library's supported
range of TLS versions and the systemwide policy. Previously, SSL_Version
RangeSet and SSL_Version
RangeSetDefault returned a failure if the requested version
range wasn't fully allowed by the systemwide crypto policy. They have been changed to...
...angeGetSupported can be used to query the overlap between the library's supported
range of TLS versions and the systemwide policy. Previously, SSL_Version
RangeSet and SSL_Version
RangeSetDefault returned a failure if the requested version
range wasn't fully allowed by the systemwide crypto policy. They have been changed to return success, if at least one TLS version overlaps between the requested
range and the systemwide policy. An application may call SSL_Version
RangeGet and SSL_Version
RangeGetDefault to query the TLS version
range that was effectively activated. Corrected the encoding of Domain Name Constraints extensions created by certutil NSS supports a clean seeding mechanism for *NIX systems now using only /dev/urandom. This is used only when SEED_ONLY_DEV_URANDOM is set at compile tim...
Index
AN_TO_JSVAL JSAPI Reference, Obsolete, SpiderMonkey BOOLEAN_TO_JSVAL converts a bool argument, b, to a boolean jsval. 19 DOUBLE_TO_JSVAL JSAPI Reference, Obsolete, SpiderMonkey DOUBLE_TO_JSVAL is the inverse of JS::ToNumber. 20 INT_FITS_IN_JSVAL JSAPI Reference, Obsolete, SpiderMonkey Determines if a specified C integer value, i, lies within the
range allowed for integer jsvals. If so, INT_FITS_IN_JSVAL returns TRUE, and i can be cast to jsval by calling INT_TO_JSVAL(i). Otherwise, INT_FITS_IN_JSVAL returns FALSE. In this case, the application can still convert i to a jsval using JS_NewNumberValue. 21 INT_TO_JSVAL JSAPI Reference, Obsolete, SpiderMonkey INT_TO_JSVAL converts a C integer, i, to a jsval. 22 JS::Ad...
...ring, it is converted to a string as if by calling JS_ValueToString. 498 JS_ValueToInt32 JSAPI Reference, Obsolete, SpiderMonkey JS_ValueToInt32 converts a specified JS value, v, to a 32-bit signed integer (-2147483648 to 2147483647). First it converts v to a floating-point number as if by calling JS::ToNumber. If the result is NaN, an infinity, or a number outside the 32-bit
range, JS_ValueToInt32 reports an error and conversion fails. Otherwise, the floating-point number is rounded to the nearest integer value. 499 JS_ValueToNumber JSAPI Reference, Obsolete, SpiderMonkey JS_ValueToNumber converts a JavaScript value to a number. It implements the ToNumber operator described in ECMA 262-3 ?9.3. 500 JS_ValueToObject JSAPI Reference, Spider...
...In addition to the interpreter, SpiderMonkey contains a Just-In-Time (JIT) compiler, a garbage collector, code implementing the basic behavior of JavaScript values, a standard library implementing ECMA 262-5.1 ?15 with various extensions, and a few public APIs. 528 64-bit Compatibility SpiderMonkey The following types or typedefs are always 64-bit on 64-...
XForms Accessibility
ed for forms control elements. name It is formed from value of child XForms label element if the element doesn't have labelledby attribute. description It is formed from value of child XForms hint element if the element doesn't have describedby attribute. state It is formed as well from model item properties (MIPs) of instance node that XForms element is bound to as from valid/invalid or in-
range/out-of-
range states of instance node. Instance node states are mapped to accessibility state constants declared in nsIAccessibleStates interface like it shown below: relevant - STATE_UNAVAILABLE readonly - STATE_READONLY required - STATE_REQUIRED invalid - STATE_INVALID out of
range - STATE_INVALID attributes Redefines datatype ARIA attribute. Its value is XML Schema builit-in datatype ...
...ultiline text (see the spec, the docs). This element is represented by multiline text field. output Serves to show instance data that the element is bound to (see the spec, the docs). It can have the following presentations: text - see the docs. calendar - see the docs. upload Provides a means for the user to select a file (see the spec, the docs). This element is represented by upload.
range Allows the user to choose a value from within a specific
range of values (see the spec, the docs). Currently it is represented by a slider only. trigger Allows the user to initiate actions (see the spec, the docs). This element is represented by button. submit Invokes the submission of the selected instance data to its target destination (see the spec, the docs). This element is represented ...
... contextual help for the containing form control (see the spec, the docs). The help element has ROLE_ALERT role. hint Similar to a tooltip (see the spec, the docs). The value of hint element is used as description of accessible object. alert This message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified
range of selectable values (see the spec, the docs). The alert element has ROLE_ALERT role for both usual and inline alert elements. message Used in combination with event listeners to display a message to the user when the specified event occurs (see the spec, the docs). The message element has ROLE_ALERT role. Resources Below you will find a list of XForms/Accessiblity resources: Mozilla acces...
nsIControllers
controller to be added to the list of controllers. Exceptions thrown NS_ERROR_OUT_OF_MEMORY getControllerAt() Returns the controller instance at the given position. nsIController getControllerAt( in unsigned long index ); Parameters index The position of the wanted controller. Return value The controller at the given position. Exceptions thrown NS_ERROR_FAILURE The given index is out of
range. getControllerById() Returns a controller given by its order, rather than position, of insertion. nsIController getControllerById( in unsigned long controllerID ); Parameters controllerID The ID (insertion order) of a controller. Return value The controller element that was inserted with that ID. Exceptions thrown NS_ERROR_FAILURE The ID is greater than the number of controllers that have ...
...trollerId( in nsIController controller ); Parameters controller The controller for which you want to retrieve the insertion index. Return value The ID in which the controller was inserted. Exceptions thrown NS_ERROR_FAILURE The controller is not in the list of controllers. insertControllerAt() Inserts a controller at a specific position in the list of controllers. If the position is out of
range, nothing happens. void insertControllerAt( in unsigned long index, in nsIController controller ); Parameters index The position within the list where you want the controller to be inserted. controller The controller to be inserted into the list. Exceptions thrown NS_ERROR_OUT_OF_MEMORY removeController() Removes a controller from the list of controllers. void removeController( in nsICo...
... the list. Exceptions thrown NS_ERROR_FAILURE The controller was not in the list of controllers. removeControllerAt() Removes a controller from the list of controllers. nsIController removeControllerAt( in unsigned long index ); Parameters index The index of the controller to be removed. Return value The controller that was removed. Exceptions thrown NS_ERROR_FAILURE The index was out of
range. See also nsIController nsICommandController XUL Tutorial/Commands ...
nsIDialogParamBlock
void SetString( in PRInt32 inIndex, in wstring inString); Attributes Attribute Type Description objects nsIMutableArray A place where you can store an nsIMutableArray to pass nsISupports. Methods GetInt() Get a previously set integer. PRInt32 GetInt( in PRInt32 inIndex ); Parameters inIndex The index of the integer to get. Must be in the
range 0..7. Return value The previously set integer, or 0 if no integer has been previously set at that index. GetString() Get a previously set string. wstring GetString( in PRInt32 inIndex ); Parameters inIndex The index of the string to get. Must be in the
range 0..15 unless SetNumberStrings was called. Return value The string at the given index, or the empty string if no string has pre...
... inInt The integer to set at the given index. SetNumberStrings() Set the maximum number of strings to pass. Default is 16. Use before setting any string (if you want to change it from the default). This method can only be called once. ...
...is 16. Use before setting any string (if you want to change it from the default). This method can only be called once. void SetNumberStrings( in PRInt32 inNumStrings ); Parameters inNumStrings The new maximum number of strings to pass. SetString() void SetString( in PRInt32 inIndex, in wstring inString ); Parameters inIndex The index of the string to set. Must be in the
range 0..15 unless SetNumberStrings was called. inString The string to set at the given index. ...
XPIDL
terface. In addition, there are a few built-in native types. The built-in native types are those listed under the type_spec production above. ...
...\u00ff permitted double double double* number float float float* number long int32_t int32_t* number long long int64_t int64_t* number octet uint8_t uint8_t* number short int16_t int16_t* number string const char* char** string Only chars in
range \u0000-\u00ff permitted Most of the time you don't want to use this type but AUTF8String or ACString unsigned long uint32_t uint32_t* number unsigned long long uint64_t uint64_t* number unsigned short uint16_t uint16_t* number wchar char16_t char16_t* string Full Unicode set permitted wstring ...
...nsID const nsID nsID* ? nsCID const nsCID nsCID* ? ...
Edit fonts - Firefox Developer Tools
unit of measure changes the value relative to the font-size setting. Example: If the font is 20 pixels high and the line-height is 1.5em, when you change the unit of measure from em to px, the value will become 30px. Weight The font-weight for the inspected element. You can select values using the slider or enter a numeric value directly into the text box. For non-variable fonts the slider
ranges from 100 to 900 in increments of 100. Note: For variable fonts (see below) that define a wght variation axis, this
range is custom. Italic The font-style for the inspected element. This setting toggles between italic and normal values for the font-style CSS property. Note: As you change settings, Firefox applies inline styles to the element to make the changes instantly visible on the ...
... typeface inside a single font file. That means you no longer have to apply several different web fonts to a single page to represent a complete typeface for which a variable font is available, provided it includes the desired values for the different characteristics you want to vary. Variable fonts make it easy to vary font characteristics in a much more granular fashion because their allowable
ranges are defined by axes of variation (see Introducing the 'variation axis' for more information). For example, font-weight can be set to any value between 1 and 1000 in variable fonts (although it is not guaranteed that a variable font will support this entire
range). There are several registered axes. Although it isn't required that these axes be defined for every font, if the font designer does i...
...slant) font-style: oblique + angle "ital" font-style: italic "opsz" font-optical-sizing Any axis that is not on the list of registered axes is considered a custom axis. Custom axes do not have corresponding CSS font properties. Font designers can define whatever axis they want; each one needs to be given a unique four-character tag. The axis name and its
range is up to the font designer. Note: Registered axis tags are identified using lower-case tags, whereas custom axes should be given upper-case tags. Note that font designers aren't forced follow this practice in any way, and some won't. The important takeaway here is that axis tags are case-sensitive. Warning: In order to use variable fonts, you need to make sure that your operating system is u...
Examine and edit CSS - Firefox Developer Tools
e arrow besides them. ...
... Displaying pseudo-elements The Rule view displays the following pseudo-elements, if they are applied to the selected element: ::after ::backdrop ::before ::first-letter ::first-line ::selection :-moz-color-swatch :-moz-number-spin-box :-moz-number-spin-down :-moz-number-spin-up :-moz-number-text :-moz-number-wrapper :-moz-placeholder :-moz-progress-bar :-moz-
range-progress :-moz-
range-thumb :-moz-
range-track :-moz-selection If the selected element has pseudo-elements applied to it, they are displayed before the selected element but hidden by a disclosure triangle: Clicking the triangle displays them: Viewing common pseudo-classes There's a button to the right of the filter box: Click the button to see checkboxes that you can use to enable the :hover, :active and :...
...ngle displays them: Viewing common pseudo-classes There's a button to the right of the filter box: Click the button to see checkboxes that you can use to enable the :hover, :active and :focus, :focus-within and :visited pseudo-classes for the selected element: This feature can also be accessed from the popup menu in the HTML view. If you enable one of these pseudo-classes for a node, an o
range dot appears in the markup view next to all nodes to which the pseudo-class has been applied. In addition, the information that appears on the page itself show you what pseudo-class you are examining. For example: Viewing and changing classes on an element With an element selected in the HTML pane, you can click the .cls button in the Rules pane toolbar, to display the classes defined on that ...
Intensive JavaScript - Firefox Developer Tools
it will be something like this: The top half of this is the waterfall overview. It gives us a compressed view of the Waterfall, which tells us what kinds of operations the browser is doing during the recording. The pink says that we are mostly performing CSS calculations and possibly reflow: this is the CSS animation that's running throughout the profile. Then there are three solid blocks of o
range, representing JavaScript execution, one for each time we pressed the button. The bottom half, which is correlated with the timeline summary in time, shows frame rate. We can see that frame rate is pretty healthy for most of the recording, but collapses completely whenever we press the button. We can select one of these periods and have a closer look at it in the main Waterfall view: Here, wh...
...ame(testFunction); } var primes = []; var testFunction = testCandidate.bind(this, 0); window.requestAnimationFrame(testFunction); } Let's test this version out: select the radio button labeled "Use requestAnimationFrame" and capture another profile. This time, the recording should look something like this: This is exactly what we might have expected to see. Instead of a single solid o
range block, each button-press shows up as a long sequence of very short o
range blocks. The o
range blocks appear one frame apart, and each one represents one of the functions called from requestAnimationFrame(). Note that there are only two button-presses in this profile. The function calls are interleaved with the pink blocks from the CSS animation, and each function is short enough that the browser ...
...back when we are done. The code that actually performs the computations is exactly the same as the original code. So how does this version perform? Switch the radio button to "Use a worker", and capture a new profile. You should see something like this: In this profile we pushed the button three times. Compared with the original, each button-press is visible in the overview as two very short o
range markers: the doPointlessComputationsInWorker() function that handles the click event and starts the worker's processing the handleWorkerCompletion() function that runs when the worker calls "done". In between, the worker runs all the primality tests, and it doesn't seem to have any effect at all on the responsiveness of the main thread. This might seem unlikely, but because workers run in a...
BiquadFilterNode() - Web APIs
andard second-order resonant highpass filter with 12dB/octave rolloff. Q: Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. Please note that for this filter type, this value is not a traditional Q, but is a resonance value in decibels. frequency: The cutoff frequency. gain: Not used. bandpass: A bandpass filter allows a
range of frequencies to pass through and attenuates the frequencies below and above this frequency
range. It implements a second-order bandpass filter. Q: Controls the width of the band. The width becomes narrower as the Q value increases. frequency: The center of the frequency band. gain: Not used. lowshelf: The lowshelf filter allows all frequencies through, but adds a boost (or atten...
...adds a boost to the higher frequencies. It implements a second-order highshelf filter. Q: Not used. frequency: The lower limit of the frequences where the boost, or attenuation, is applied. gain: The boost, in dB, to be applied. If the value is negative, the frequencies are attenuated. peaking: The peaking filter allows all frequencies through, adding a boost, or attenuation, to a
range of frequencies. Q: The width of the band of frequencies that are boosted. A large value implies a narrow width. frequency: The center frequency of the boost
range. gain: The boost, in dB, to be applied. If the value is negative, the frequencies are attenuated. notch: The notch filter (also known as a band-stop, or band-rejection filter) is the opposite of a bandpass filter. It all...
... value is negative, the frequencies are attenuated. notch: The notch filter (also known as a band-stop, or band-rejection filter) is the opposite of a bandpass filter. It allows all frequencies through, except for a set of frequencies. Q: The width of the band of frequencies that are attenuated. A large value implies a narrow width. frequency: The center frequency of the attenuation
range. gain: Not used. allpass: An allpass filter allows all frequencies through, but changes the phase relationship between the various frequencies. It implements a second-order allpass filter. Q: The sharpness of the phase transition at the center frequency. A larger value implies a sharper transition and a larger group delay. frequency: The frequency where the center of the phase tra...
BiquadFilterNode.getFrequencyResponse() - Web APIs
esponse(frequencyArray, magResponseOutput, phaseResponseOutput); Parameters frequencyArray A Float32Array containing an array of frequencies, specified in Hertz, which you want to filter. magResponseOutput A Float32Array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyArray. ...
... Return value undefined Exceptions InvalidAccessError The three arrays provided are not all of the same length. ...
... function calcFrequencyResponse() { biquadFilter.getFrequencyResponse(myFrequencyArray,magResponseOutput,phaseResponseOutput); for(i = 0; i <= myFrequencyArray.length-1;i++){ var listItem = document.createElement('li'); listItem.innerHTML = '<strong>' + myFrequencyArray[i] + 'Hz</strong>: Magnitude ' + magResponseOutput[i] + ', Phase ' + phaseResponseOutput[i] + ' radia...
Applying styles and colors - Web APIs
or fillStyle property, the new value becomes the default for all shapes being drawn from then on. For every shape you want in a different color, you will need to reassign the fillStyle or strokeStyle property. The valid strings you can enter should, according to the specification, be CSS <color> values. Each of the following examples describe the same color. // these all set the fillStyle to 'o
range' ctx.fillStyle = 'o
range'; ctx.fillStyle = '#FFA500'; ctx.fillStyle = 'rgb(255, 165, 0)'; ctx.fillStyle = 'rgba(255, 165, 0, 1)'; A fillStyle example In this example, we once again use two for loops to draw a grid of rectangles, each in a different color. The resulting image should look something like the screenshot. There is nothing too spectacular happening here. We use the two variables i ...
...a color values, we can use the following notation to assign a transparent color to them. // Assigning transparent colors to stroke and fill style ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)'; ctx.fillStyle = 'rgba(255, 0, 0, 0.5)'; The rgba() function is similar to the rgb() function but it has one extra parameter. The last parameter sets the transparency value of this particular color. The valid
range is again between 0.0 (fully transparent) and 1.0 (fully opaque). A globalAlpha example In this example, we'll draw a background of four different colored squares. On top of these, we'll draw a set of semi-transparent circles. The globalAlpha property is set at 0.2 which will be used for all shapes from that point on. Every step in the for loop draws a set of circles with an increasing radius. T...
...); ctx.fillStyle = radgrad2; ctx.fillRect(0, 0, 150, 150); ctx.fillStyle = radgrad; ctx.fillRect(0, 0, 150, 150); } <canvas id="canvas" width="150" height="150"></canvas> draw(); In this case, we've offset the starting point slightly from the end point to achieve a spherical 3D effect. It's best to try to avoid letting the inside and outside circles overlap because this results in st
range effects which are hard to predict. The last color stop in each of the four gradients uses a fully transparent color. If you want to have a nice transition from this to the previous color stop, both colors should be equal. This isn't very obvious from the code because it uses two different CSS color methods as a demonstration, but in the first gradient #019F62 = rgba(1,159,98,1). ScreenshotLive ...
HTMLFontElement.size - Web APIs
The obsolete HTMLFontElement.size property is a DOMString that reflects the size HTML attribute. It contains either an integer number in the
range of 1-7 or a relative value to increase/decrease the value of the size attribute of the <basefont> element. ...
... a DOMString that reflects the size HTML attribute. It contains either an integer number in the
range of 1-7 or a relative value to increase/decrease the value of the size attribute of the <basefont> element. ...
...sefont> element. The format of the string must follow one of the following HTML microsyntaxes: Microsyntax Description Examples Valid size number string integer number in the
range of 1-7 6 Relative size string +x or -x, where x is the number relative to the value of the size attribute of the <basefont> element (the result should be in the same
range of 1-7) +2 -1 Syntax sizeString = fontObj.size; fontObj.size = sizeString; Examples // Assumes there is <font id="f"> element in the HTML var f = document.getElementById("f"); f.size = "6"; Specifications The <font> tag is not supported in HTML5 and as a result neither is <font>.size . ...
HTMLInputElement.stepUp() - Web APIs
The default value for the parameter, if no value is passed, is 1. The method will not cause the value to exceed the set max value, or defy...
...The default value for the parameter, if no value is passed, is 1. The method will not cause the value to exceed the set max value, or defy the constraints set by the step attribute. If ...
...CSS input:invalid { border: red solid 3px; } Result Note if you don't pass a parameter to the stepUp method, it defaults to 1. Any other value is a multiplier of the step attribute value, which in this case is 5. If you pass 4 as the stepIncrement, the input will stepUp by 4 * 5, or 20. If the parameter is 0, the number will not be incremented. The stepUp will not allow the input to out of
range, in this case stopping when it reaches 400, and rounding down any floats that are passed as a parameter. Try setting the step increment to 1.2. What happens when you invoke the method? Try setting the value to 4, which is not valid. What happens when you invoke the method? Specifications Specification Status Comment HTML Living StandardThe definition of 'stepUp()' ...
HTMLInputElement - Web APIs
laceholder text must not contain carriage returns or line-feeds. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored. readOnly boolean: Returns / Sets the element's readonly attribute, indicating that the user cannot modify the value of the control. HTML5This is ignored if the value of the type attribute is hidden,
range, color, checkbox, radio, file, or a button type. selectionStart unsigned long: Returns / Sets the beginning index of the selected text. When nothing is selected, this returns the position of the text input cursor (caret) inside of the <input> element. selectionEnd unsigned long: Returns / Sets the end index of the selected text. When there's no selection, this returns the ...
...) Removes focus from the input element; keystrokes will subsequently go nowhere. click() Simulates a click on the input element. focus() Focuses on the input element; keystrokes will subsequently go to this element. select() Selects all the text in the input element, and focuses it so the user can subsequently replace all of its content. setSelection
Range() Selects a
range of text in the input element (but does not focus it). set
RangeText() Replaces a
range of text in the input element with new text. setCustomValidity() Sets a custom validity message for the element. If this message is not the empty string, then the element is suffering from a custom validity error, and does not validate. checkValidity() Retu...
...dirName, files, formAction, formEncType, formMethod, formNoValidate, formTarget, height, indeterminate, labels, list, max, min, multiple, pattern, placeholder, required, selectionDirection, selectionEnd, selectionStart, step, validationMessage, validity, valueAsDate, valueAsNumber, width, and willValidate. The following methods have been added: checkValidity(), setCustomValidity(), setSelection
Range(), stepUp(), and stepDown(). Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLInputElement' in that specification. Obsolete The size property is now an unsigned long. The type property must be entirely given in lowercase characters. Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLInputElement' in that specification. Ob...
HTMLMediaElement - Web APIs
audio when the user doesn't expect or desire it is a poor user experience and should be avoided in most cases, though there are exceptions. See the Autoplay guide for media and Web Audio APIs for more information. Keep in mind that browsers may ignore autoplay requests, so you should ensure that your code isn't dependent on autoplay working. HTMLMediaElement.buffered Read only Returns a Time
Ranges object that indicates the
ranges of the media source that the browser has buffered (if any) at the moment the buffered property is accessed. HTMLMediaElement.controller Is a MediaController object that represents the media controller assigned to the element, or null if none is assigned. HTMLMediaElement.controls Is a Boolean that reflects the controls HTML attribute, indicating whether user ...
...networkState Read only Returns a unsigned short (enumeration) indicating the current state of fetching the media over the network. HTMLMediaElement.paused Read only Returns a Boolean that indicates whether the media element is paused. HTMLMediaElement.playbackRate Is a double that indicates the rate at which the media is being played back. HTMLMediaElement.played Read only Returns a Time
Ranges object that contains the
ranges of the media source that the browser has played, if any. HTMLMediaElement.preload Is a DOMString that reflects the preload HTML attribute, indicating what data should be preloaded, if any. Possible values are: none, metadata, auto. HTMLMediaElement.preservesPitch Is a Boolean that determines if the pitch of the sound will be preserved. If set to false, the p...
...determines if the pitch of the sound will be preserved. If set to false, the pitch will adjust to the speed of the audio. This is implemented with prefixes in Firefox (mozPreservesPitch) and WebKit (webkitPreservesPitch). HTMLMediaElement.readyState Read only Returns a unsigned short (enumeration) indicating the readiness state of the media. HTMLMediaElement.seekable Read only Returns a Time
Ranges object that contains the time
ranges that the user is able to seek to, if any. HTMLMediaElement.seeking Read only Returns a Boolean that indicates whether the media is in the process of seeking to a new position. HTMLMediaElement.sinkId Read only Returns a DOMString that is the unique ID of the audio device delivering output, or an empty string if it is using the user agent default. This...
IDBIndex.openCursor() - Web APIs
The openCursor() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key
range. The method sets the position of the cursor to the appropriate record, based on the specified direction. If the key
range is not specified or is null, then the
range includes all the records. A success event is always fired on the result object. If at least one record matches the key
range, then the result property of the event is set to the new IDBCursorWithValue object; the value of the cursor object is set to a structured clone of the referenced value. If no records match the key
range then then the result property of the event is set to null. Note: This feature is available in Web Workers. Syntax var request = myIn...
...e, then the result property of the event is set to the new IDBCursorWithValue object; the value of the cursor object is set to a structured clone of the referenced value. If no records match the key
range then then the result property of the event is set to null. Note: This feature is available in Web Workers. Syntax var request = myIndex.openCursor(); var request = myIndex.openCursor(
range); var request = myIndex.openCursor(
range, direction); Parameters
range Optional A key or IDBKey
Range to use as the cursor's
range. If nothing is passed, this will default to a key
range that selects all the records in this object store. direction Optional The cursor's direction. See IDBCursor Constants for possible values. Return value An IDBRequest object on which subsequent events rel...
...e An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description TransactionInactiveError This IDBIndex's transaction is inactive. TypeError The value for the direction parameter is invalid. DataError The key or key
range provided contains an invalid key. InvalidStateError The IDBIndex has been deleted or removed. Example In the following example we open a transaction and an object store, then get the index lName from a simple contacts database. We then open a basic cursor on the index using openCursor() -- this works the same as opening a cursor directly on an ObjectStore using IDBObjectSt...
IDBObjectStore.getKey() - Web APIs
t object, and, in a separate thread, returns the key selected by the specified query. This is for retrieving specific records from an object store. If a key is successfully found, then a structured clone of it is created and set as the result of the request object. Note: This feature is available in Web Workers. ...
... InvalidStateError The IDBObjectStore has been deleted or removed. ...
...teError The IDBObjectStore has been deleted or removed. Example let openRequest = indexedDB.open("telemetry"); openRequest.onsuccess = (event) => { let db = event.target.result; let store = db.transaction("netlogs").objectStore("netlogs"); let today = new Date(); let yesterday = new Date(today); yesterday.setDate(today.getDate() - 1); let request = store.getKey(IDBKey
Range(yesterday, today)); request.onsuccess = (event) => { let when = event.target.result; alert("The 1st activity in last 24 hours was occurred at " + when); }; }; Specifications Specification Status Comment Indexed Database API DraftThe definition of 'getKey()' in that specification. Recommendation Initial definition Browser compatibility The compa...
PhotoCapabilities - Web APIs
ns for an attached photographic device. A PhotoCapabilities object is retrieved by calling ImageCapture.getPhotoCapabilities(). Properties PhotoCapabilities.redEyeReduction Read only Returns one of "never", "always", or "controllable". The "controllable" value means the device's read-eye reduction is controllable by the user. PhotoCapabilities.imageHeight Read only Returns a MediaSettings
Range object indicating the image height
range supported by the user agent. PhotoCapabilities.imageWidth Read only Returns a MediaSettings
Range object indicating the image width
range supported by the user agent. PhotoCapabilities.fillLightMode Read only Returns an array of available fill light options. Options may include auto, off, or flash. Example The following example, extracted from Chro...
... MediaSettings
Range object indicating the image width
range supported by the user agent. PhotoCapabilities.fillLightMode Read only Returns an array of available fill light options. Options may include auto, off, or flash. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities() to modify the size of an input
range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
...tions may include auto, off, or flash. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities() to modify the size of an input
range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
SourceBuffer.appendWindowEnd - Web APIs
The default value of appendWindowEnd is positive infinity. Syntax var myAppendWindowEnd = sourceBuffer.appendWindowEnd; sourceBuffer.appendWindowEnd = 120.0; Value A double, indicating the end time of the append window, in seconds. ...
... The default value of appendWindowEnd is positive infinity. Syntax var myAppendWindowEnd = sourceBuffer.appendWindowEnd; sourceBuffer.appendWindowEnd = 120.0; Value A double, indicating the end time of the append window, in seconds. ...
... The default value of appendWindowEnd is positive infinity. Syntax var myAppendWindowEnd = sourceBuffer.appendWindowEnd; sourceBuffer.appendWindowEnd = 120.0; Value A double, indicating the end time of the append window, in seconds. ...
SourceBuffer.remove() - Web APIs
Return value undefined. ...
... Return value undefined. ...
... Return value undefined. Exceptions Exception Explanation InvalidAccessError The MediaSource.duration property is equal to NaN, the start parameter is negative or greater than MediaSource.duration, or the end parameter is less than or equal to start or equal to NaN. ...
SourceBuffer - Web APIs
o,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SourceBuffer</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties SourceBuffer.appendWindowEnd Controls the timestamp for the end of the append window. SourceBuffer.appendWindowStart Controls the timestamp for the start of the append window. ...
...a:hover text { fill: #0095DD; pointer-events: all;} Properties SourceBuffer.appendWindowEnd Controls the timestamp for the end of the append window. SourceBuffer.appendWindowStart Controls the timestamp for the start of the append window. This is a timestamp
range that can be used to filter what media data is appended to the SourceBuffer. Coded media frames with timestamps within this
range will be appended, whereas those outside the
range will be filtered out. SourceBuffer.audioTracks Read only A list of the audio tracks currently contained inside the SourceBuffer. SourceBuffer.buffered Read only Returns the time
ranges that are currently buffered in the SourceBuffer. SourceBuffer.mode Controls how the order of media segments in the SourceBuffer is handled, in terms of whet...
...fer to the SourceBuffer. Returns a Promise which is fulfilled once the buffer has been appended. SourceBuffer.appendStream() Appends media segment data from a ReadableStream object to the SourceBuffer. SourceBuffer.changeType() Changes the MIME type that future calls to appendBuffer() will expect the new data to conform to. SourceBuffer.remove() Removes media segments within a specific time
range from the SourceBuffer. SourceBuffer.removeAsync() Starts the process of asynchronously removing media segments in the specified
range from the SourceBuffer. Returns a Promise which is fulfilled once all matching segments have been removed. Examples The following simple example loads a video chunk by chunk as fast as possible, playing it as soon as it can. This example was written by Nick D...
WebGLRenderingContext.getParameter() - Web APIs
rameter(pname); Parameters pname A GLenum specifying which parameter value to return. See below for possible values. Return value Depends on the parameter. Parameter names WebGL 1 You can query the following pname parameters when using a WebGLRenderingContext. ...
...value to return. See below for possible values. Return value Depends on the parameter. Parameter names WebGL 1 You can query the following pname parameters when using a WebGLRenderingContext. ...
... ext.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR gl.CULL_FACE GLboolean gl.CULL_FACE_MODE GLenum gl.FRONT, gl.BACK or gl.FRONT_AND_BACK. See also cullFace gl.CURRENT_PROGRAM WebGLProgram or null See useProgram. gl.DEPTH_BITS GLint gl.DEPTH_CLEAR_VALUE GLfloat gl.DEPTH_FUNC GLenum gl.DEPTH_
RANGE Float32Array (with 2 elements) gl.DEPTH_TEST GLboolean gl.DEPTH_WRITEMASK GLboolean gl.DITHER GLboolean gl.ELEMENT_ARRAY_BUFFER_BINDING WebGLBuffer gl.FRAMEBUFFER_BINDING WebGLFramebuffer or null null corresponds to a binding to the default framebuffer. See also bindFramebuffer. gl.FRONT_FACE GLenum ...
WebGLShaderPrecisionFormat - Web APIs
WebGLShaderPrecisionFormat.precision Read only The number of bits of precision that can be represented. ...
... WebGLShaderPrecisionFormat.precision Read only The number of bits of precision that can be represented. ...
...ber of bits of precision that can be represented. For integer formats this value is always 0. Examples A WebGLShaderPrecisionFormat object is returned by the WebGLRenderingContext.getShaderPrecisionFormat() method. var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT); // WebGLShaderPrecisionFormat {
rangeMin: 127,
rangeMax: 127, precision: 23 } Specifications Specification Status Comment WebGL 1.0The definition of 'WebGLShaderPrecisionFormat' in that specification. Recommendation Initial definition. ...
A basic 2D WebGL animation example - Web APIs
exPosition.y * uRotationVector.y - aVertexPosition.x * uRotationVector.x ); gl_Position = vec4(rotatedPosition * uScalingFactor, 0.0, 1.0); } </script> The main program shares with us the attribute aVertexPosition, which is the position of the vertex in whatever coordinate system it's using. We need to convert these values so that both components of the position are in the
range -1.0 to 1.0. This can be done easily enough by multiplying by a scaling factor that's based on the context's aspect ratio. We'll see that computation shortly. We're also rotating the shape, and we can do that here, by applying a transform. We'll do that first. The rotated position of the vertex is computed by applying the rotation vector, found in the uniform uRotationVector, that's been compute...
...nd linked shader program. We'll look at how this works next. Once the shader program is built, we compute the aspect ratio of our context by dividing its width by its height. Then we set the current rotation vector for the animation to [0, 1], and the scaling vector to [1.0, aspectRatio]. The scaling vector, as we saw in the vertex shader, is used to scale the coordinates to fit the -1.0 to 1.0
range. The array of vertices is created next, as a Float32Array with six coordinates (three 2D vertices) per triangle to be drawn, for a total of 12 values. As you can see, we're using a coordinate system of -1.0 to 1.0 for each axis. Why, you may ask, do we need to do any adjustments at all? This is simply because our context is not square. We're using a context that's 600 pixels wide and 460 tall. ...
...as a Float32Array with six coordinates (three 2D vertices) per triangle to be drawn, for a total of 12 values. As you can see, we're using a coordinate system of -1.0 to 1.0 for each axis. Why, you may ask, do we need to do any adjustments at all? This is simply because our context is not square. We're using a context that's 600 pixels wide and 460 tall. Each of those dimensions is mapped to the
range -1.0 to 1.0. Since the two axes aren't the same length, if we don't adjust the values of one of the two axes, the square will get stretched out in one direction or the other. So we need to normalize these values. Once the vertex array has been created, we create a new GL buffer to contain them by calling gl.createBuffer(). We bind the standard WebGL array buffer reference to that by calling gl.b...
Using the Web Speech API - Web APIs
nstructions for use, and a form with some simple controls. The <select> element is initially empty, but is populated with <option>s via JavaScript (see later on.) <h1>Speech synthesiser</h1> <p>Enter some text in the input below and press return to hear it. ...
... <p>Enter some text in the input below and press return to hear it. change voices using the dropdown menu.</p> <form> <input type="text" class="txt"> <div> <label for="rate">Rate</label><input type="
range" min="0.5" max="2" value="1" step="0.1" id="rate"> <div class="rate-value">1</div> <div class="clearfix"></div> </div> <div> <label for="pitch">Pitch</label><input type="
range" min="0" max="2" value="1" step="0.1" id="pitch"> <div class="pitch-value">1</div> <div class="clearfix"></div> </div> <select> </select> </form> JavaScript Let's investigate the JavaScript that powers this app. Setting variables First of all, we capture references to all the DOM elements involved in the UI, but more interestingly, we capture a reference to Window.speechSynthes...
...erty to return the currently selected <option> element. We then use this element's data-name attribute, finding the SpeechSynthesisVoice object whose name matches this attribute's value. We set the matching voice object to be the value of the SpeechSynthesisUtterance.voice property. Finally, we set the SpeechSynthesisUtterance.pitch and SpeechSynthesisUtterance.rate to the values of the relevant
range form elements. Then, with all necessary preparations made, we start the utterance being spoken by invoking SpeechSynthesis.speak(), passing it the SpeechSynthesisUtterance instance as a parameter. inputForm.onsubmit = function(event) { event.preventDefault(); var utterThis = new SpeechSynthesisUtterance(inputTxt.value); var selectedOption = voiceSelect.selectedOptions[0].getAttribute('dat...
Window.getSelection() - Web APIs
The Window.getSelection() method returns a Selection object representing the
range of text selected by the user or the current position of the caret. Syntax selection = window.getSelection(); Return value A Selection object. When cast to string, either by appending an empty string ("") or using Selection.toString(), this object returns the text selected. When called on an <iframe> that is not displayed (eg. where display: none is set) Firefox will return null, whereas other browsers will return a Selection object with Selection.type set to None. ...
...r by appending an empty string ("") or using Selection.toString(), this object returns the text selected. When called on an <iframe> that is not displayed (eg. where display: none is set) Firefox will return null, whereas other browsers will return a Selection object with Selection.type set to None. Examples function foo() { var selObj = window.getSelection(); alert(selObj); var sel
Range = selObj.get
RangeAt(0); // do stuff with the
range } Notes String representation of the Selection object In JavaScript, when an object is passed to a function expecting a string (like window.alert() or document.write()), the object's toString() method is called and the returned value is passed to the function. This can make the object appear to be a string when used with other functions wh...
...Text = selObj.toString(); selObj is a Selection object. selectedText is a string (Selected text). Related objects You can call Document.getSelection(), which works identically to Window.getSelection(). It is worth noting that currently getSelection() doesn't work on the content of <textarea> and <input> elements in Firefox, Edge (Legacy) and Internet Explorer. HTMLInputElement.setSelection
Range() or the selectionStart and selectionEnd properties could be used to work around this. Notice also the difference between selection and focus. Document.activeElement returns the focused element. Specifications Specification Status Comment Selection APIThe definition of 'Window.getSelection()' in that specification. Working Draft New spec. ...
Using the aria-valuenow attribute - Accessibility
The aria-valuenow attribute is used to define the current value for a
range widget such as a slider, spinbutton or progressbar. If the current value is not known, the author should not set the aria-valuenow attribute. If the aria-valuenow has a known minimum and maximum value, authors should set the aria-valuemin and aria-valuemax attributes. When the rendered value cannot be accurately represented as a number, authors SHOULD use the aria-valuetext attribute in conjunction with aria-valuenow to provide a user-friendly representation of the
range's current value. For example, a slider may have rendered values of small, medium, and large. ...
...et the aria-valuemin and aria-valuemax attributes. When the rendered value cannot be accurately represented as a number, authors SHOULD use the aria-valuetext attribute in conjunction with aria-valuenow to provide a user-friendly representation of the
range's current value. For example, a slider may have rendered values of small, medium, and large. In this case, the values of aria-valuenow could
range from 1 through 3, which indicate the position of each value in the value space, but the aria-valuetext would be one of the strings: small, medium, or large. aria-valuenow is a required attribute of role slider, scrollbar and spinbutton. Value String representation of a number Possible effects on user agents and assistive technology For elements with role progressbar and scrollbar, assistive...
...valuetext would be one of the strings: small, medium, or large. aria-valuenow is a required attribute of role slider, scrollbar and spinbutton. Value String representation of a number Possible effects on user agents and assistive technology For elements with role progressbar and scrollbar, assistive technologies SHOULD render the actual value as a percentage, calculated as a position on the
range from aria-valuemin to aria-valuemax if both are defined, otherwise the actual value with a percent indicator. For elements with role slider and spinbutton, assistive technologies SHOULD render the actual value to users. Note: Opinions may differ on how assistive technology should handle this technique. The information provided above is one of those opinions and therefore not normative. Example...
Using the slider role - Accessibility
The slider role is assigned to the "thumb," the control that is adjusted to change the value. As the user interacts with the thumb, the application must programmatically adjust the slider's aria-valuenow (and possible aria-valuetext) attribute to reflect the current value. See the Examples section below for more information. ...
...r would drag. Arrow keys should operate as follows (localization for right-to-left languages should reverse the direction of the arrows): Key(s) Action Right and Up arrows Increase the selected value Left and Down arrows Decrease the selected value Page Up and Page Down Optionally increase and decrease the value by a set amount (e.g. by 10 on a
range from 0 to 100) Possible effects on user agents and assistive technology Note: Opinions may differ on how assistive technology should handle this technique. The information provided above is one of those opinions and therefore not normative. Examples Example 1: Simple Numerical
Range In the example below, a simple slider is used to select a value between 1 and 100. The current volume...
...s technique. The information provided above is one of those opinions and therefore not normative. Examples Example 1: Simple Numerical
Range In the example below, a simple slider is used to select a value between 1 and 100. The current volume is 50. The application will programmatically update the value of aria-valuenow in response to user input. ...
ARIA: listbox role - Accessibility
Select a color:</p> <div role="listbox" tabindex="0" id="listbox1" aria-labelledby="listbox1label" onclick="return listItemClick(event);" onkeydown="return listItemKeyEvent(event);" onkeypress="return listItemKeyEvent(event);" aria-activedescendant="listbox1-1"> <div role="option" id="listbox1-1" class="selected" aria-selected="true">Green</div> <div role="option" id="listbox1-2">O
range</div> <div role="option" id="listbox1-3">Red</div> <div role="option" id="listbox1-4">Blue</div> <div role="option" id="listbox1-5">Violet</div> <div role="option" id="listbox1-6">Periwinkle</div> </div> This could have more easily been handled with the native HTML <select> and <label> elements <label for="listbox1">Select a color:</label> <select id="listbox1"> <option sele...
... Collapsible Dropdown Listbox Example: Single-select collapsible listbox that expands when activated, simil...
...t</option> <option>Periwinkle</option> </select> More examples Scrollable Listbox Example: Single-select listbox that scrolls to reveal more options, similar to HTML select with size attribute greater than one. Collapsible Dropdown Listbox Example: Single-select collapsible listbox that expands when activated, similar to HTML select with the attribute size="1". Example Listboxes with Rear
rangeable Options: Examples of both single-select and multi-select listboxes with accompanying toolbars where options can be added, moved, and removed. Best practices To be keyboard accessible, authors should manage focus of all descendants of this role. It is recommended that authors use different styling for the selection when the list is not focused, e.g. a non-active selection is often shown ...
Using media queries - CSS: Cascading Style Sheets
Added in Media Queries Level 4. any-pointer Is any available input mechanism a pointing device, and if so, how accurate is it? Added in Media Queries Level 4. aspect-ratio Width-to-height aspect ratio of the viewport color Number of bits per color component of the output device, or zero if the device isn't color color-gamut Approximate
range of colors that are supported by the user agent and output device Added in Media Queries Level 4. color-index Number of entries in the output device's color lookup table, or zero if the device does not use such a table device-aspect-ratio Width-to-height aspect ratio of the output device Deprecated in Media Queries Level 4. device-height Height of ...
...e specific characteristics of a given user agent, output device, or environment. For instance, you can apply specific styles to widescreen monitors, computers that use mice, or to devices that are being used in low-light conditions. This example applies styles when the user's primary input mechanism (such as a mouse) can hover over elements: @media (hover: hover) { ... } Many media features are
range features, which means they can be prefixed with "min-" or "max-" to express "minimum condition" or "maximum condition" constraints. For example, this CSS will apply styles only if your browser's viewport width is equal to or narrower than 12450px: @media (max-width: 12450px) { ... } If you create a media feature query without specifying a value, the nested styles will be used as long as the fea...
...ng compatibility with older browsers The only keyword prevents older browsers that do not support media queries with media features from applying the given styles. It has no effect on modern browsers. @media only screen and (color) { ... } Syntax improvements in Level 4 The Media Queries Level 4 specification includes some syntax improvements to make media queries using features that have a "
range" type, for example width or height, less verbose. Level 4 adds a
range context for writing such queries. For example, using the max- functionality for width we might write the following: Note: The Media Queries Level 4 specification has reasonable support in modern browsers, but some media features are not well supported. See the @media browser compatibility table for more details. @media (ma...
Pseudo-classes - CSS: Cascading Style Sheets
in together as many pseudo-classes as you want in a selector. ...
... HTML Living Standard Living Standard Defines when particular selectors mat...
...Changed :empty to behave like :-moz-only-whitespace . No significant change for other pseudo-classes defined in Selectors Level 3 and HTML5 (though semantic meaning not taken over). HTML5 Recommendation Copies the relevant section from the canonical (WHATWG) HTML spec. CSS Basic User Interface Module Level 3 Recommendation Defined :default, :valid, :invalid, :in-
range, :out-of-
range, :required, :optional, :read-only and :read-write, but without the associated semantic meaning. Selectors Level 3 Recommendation Defined :target, :root, :nth-child(), :nth-last-of-child(), :nth-of-type(), :nth-last-of-type(), :last-child, :first-of-type, :last-of-type, :only-child, :only-of-type, :empty and :not(). Defined the syntax of :enabled, :disabled, :chec...
Specificity - CSS: Cascading Style Sheets
blue; } span { color: red; } No matter the order, text will be green because that rule is most specific. (Also, the rule for blue overwrites the rule for red, notwithstanding the order of the rules) As a nonsense special case for (2), duplicate simple selectors to increase specificity when you have nothing more to specify. #myId#myId span { color: yellow; } .myClass.myClass span { color: o
range; } How !important can be used: A) Overriding inline styles Your global CSS file that sets visual aspects of your site globally may be overwritten by inline styles defined directly on individual elements. Both inline styles and !important are considered very bad practice, but sometimes you need the latter to override the former. In this case, you could set certain styles in your global CSS ...
.../when-to-use-important-to-save-the-day-when-working-with-css The :is() and :not() exceptions The matches-any pseudo-class :is() and the negation pseudo-class :not() are not considered a pseudo-class in the specificity calculation. But selectors placed into the pseudo-class count as normal selectors when determining the count of selector types. This chunk of CSS ... div.outer p { color: o
range; } div:not(.outer) p { color: blueviolet; } ... when used with the following HTML ... <div class="outer"> <p>This is in the outer div.</p> <div class="inner"> <p>This text is in the inner div.</p> </div> </div> ... appears on the screen like this: The :where() exception The specificity-adjustment pseudo-class :where() always has its specificity replaced with zero. T...
...when used with the following HTML ... <div class="outer"> <p>This is in the outer div.</p> <div class="inner"> <p>This text is in the inner div.</p> </div> </div> ... appears on the screen like this: The :where() exception The specificity-adjustment pseudo-class :where() always has its specificity replaced with zero. This chunk of CSS ... div:where(.outer) p { color: o
range; } div p { color: blueviolet; } #no-where-support { margin: 0.5em; border: 1px solid red; } #no-where-support:where(*) { display: none !important; } ... when used with the following HTML ... <div id="no-where-support"> ? Your browser doesn't support the <code><a href="/docs/Web/CSS/:where" target="_top">:where()</a></code> pseudo-class. </div> <div class="outer"> <p>This is...
animation-timing-function - CSS: Cascading Style Sheets
ing increasing until complete. ease-out Equal to cubic-bezier(0, 0, 0.58, 1.0), starts quickly, slowing down the animation continues. o ease-in-out Equal to cubic-bezier(0.42, 0, 0.58, 1.0), with the animating properties slowly transitioning, speeding up, and then slowing down again. cubic-bezier(p1, p2, p3, p4) An author defined cubic-bezier curve, where the p1 and p3 values must be in the
range of 0 to 1. steps(n, <jumpterm>) Displays an animation iteration along n stops along the transition, displaying each stop for equal lengths of time. For example, if n is 5, there are 5 steps. Whether the animation holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the animation, or makes 5 stops including the 0% and ...
...name: changeme; animation-duration: 10s; animation-iteration-count: infinite; margin-bottom: 4px; } @keyframes changeme { 0% { min-width: 12em; width: 12em; background-color: black; border: 1px solid red; color: white; } 100% { width: 90vw; min-width: 24em; background-color: magenta; color: yellow; border: 1px solid o
range; } } .ease { animation-timing-function: ease; } .easein { animation-timing-function: ease-in; } .easeout { animation-timing-function: ease-out; } .easeinout { animation-timing-function: ease-in-out; } .linear { animation-timing-function: linear; } .cb { animation-timing-function: cubic-bezier(0.2,-2,0.8,2); } Step examples <div class="parent"> <div class="jump-sta...
...name: changeme; animation-duration: 10s; animation-iteration-count: infinite; margin-bottom: 4px; } @keyframes changeme { 0% { min-width: 12em; width: 12em; background-color: black; border: 1px solid red; color: white; } 100% { width: 90vw; min-width: 24em; background-color: magenta; color: yellow; border: 1px solid o
range; } } .jump-start { animation-timing-function: steps(5, jump-start); } .jump-end { animation-timing-function: steps(5, jump-end); } .jump-none { animation-timing-function: steps(5, jump-none); } .jump-both { animation-timing-function: steps(5, jump-both); } .start { animation-timing-function: steps(5, start); } .end { animation-timing-function: steps(5, end); } .step-start ...
font-weight - CSS: Cascading Style Sheets
300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values, although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts using the Fallback weights system. CSS Fonts Level 4 extends the syntax to accept any number between 1 and 1000 and introduces Variable fonts, which can make use of this much finer-grained
range of font weights. Fallback weights If the exact weight given is unavailable, then the following rule is used to determine the weight actually rendered: If the target weight given is between 400 and 500 inclusive: Look for available weights between the target and 500, in ascending order. If no match is found, look for available weights less than the target, in descending order. If...
... Normal (Regular) 500 Medium 600 Semi Bold (Demi Bold) 700 Bold 800 Extra Bold (Ultra Bold) 900 Black (Heavy) 950 Extra Black (Ultra Black) Variable fonts Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping. However some fonts, called variable fonts, can support a
range of weights with a more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying widths. For the example below to work, you'll need a browser that supports the CSS Fonts Level 4 syntax in which font-weight can be any number between 1 and 1000. HTML...
...ss fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying widths. For the example below to work, you'll need a browser that supports the CSS Fonts Level 4 syntax in which font-weight can be any number between 1 and 1000. ...
transition-timing-function - CSS: Cascading Style Sheets
ion speed increasing until complete. ease-out Equal to cubic-bezier(0, 0, 0.58, 1.0), starts transitioning quickly, slowing down the transition continues. o ease-in-out Equal to cubic-bezier(0.42, 0, 0.58, 1.0), starts transitioning slowly, speeds up, and then slows down again. cubic-bezier(p1, p2, p3, p4) An author defined cubic-Bezier curve, where the p1 and p3 values must be in the
range of 0 to 1. steps( n, <jumpterm>) Displays the transition along n stops along the transition, displaying each stop for equal lengths of time. For example, if n is 5, there are 5 steps. Whether the transition holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the transition, or makes 5 stops including the 0% and 10...
...ic-bezier(0.2,-2,0.8,2)</div> </div> .parent {} .parent > div[class] { width: 12em; min-width: 12em; margin-bottom: 4px; background-color: black; border: 1px solid red; color: white; transition-property: all; transition-duration: 7s; } .parent > div.box1{ width: 90vw; min-width: 24em; background-color: magenta; color: yellow; border: 1px solid o
range; transition-property: all; transition-duration: 2s; } function updateTransition() { var els = document.querySelectorAll(".parent > div[class]"); for(var c = els.length, i = 0; i < c; i++) { els[i].classList.toggle("box1"); } } var intervalID = window.setInterval(updateTransition, 10000); .ease { transition-timing-function: ease; } .easein { transition-timing-functio...
...lass="step-end">step-end</div> </div> .parent {} .parent > div[class] { width: 12em; min-width: 12em; margin-bottom: 4px; background-color: black; border: 1px solid red; color: white; transition-property: all; transition-duration:7s; } .parent > div.box1{ width: 90vw; min-width: 24em; background-color: magenta; color: yellow; border: 1px solid o
range; transition-property: all; transition-duration:2s; } function updateTransition() { var els = document.querySelectorAll(".parent > div[class]"); for(var c = els.length, i = 0; i < c; i++) { els[i].classList.toggle("box1"); } } var intervalID = window.setInterval(updateTransition, 10000); .jump-start { transition-timing-function: steps(5, jump-start); } .jump-end { tr...
HTML attribute reference - HTML: Hypertext Markup Language
<tfoot>, <td>, <th>, <tr> Background color of the element. Note: This is a legacy attribute. Please use the CSS background-color property instead. border <img>, <object>, <table> The border width. Note: This is a legacy attribute. Please use the CSS border property instead. buffered <audio>, <video> Contains the time
range of already buffered media. capture <input> From the HTML Media CaptureThe definition of 'media capture' in that specification.spec, specifies a new file can be captured. challenge <keygen> A challenge string that is submitted along with the public key. charset <meta>, <script> Declares the character encoding of the page or script. checked <...
...ll other elements, use the CSS height property. Note: In some instances, such as <div>, this is a legacy attribute, in which case the CSS height property should be used instead. hidden Global attribute Prevents rendering of given element, while keeping child elements, e.g. script elements, active. high <meter> Indicates the lower bound of the upper
range. href <a>, <area>, <base>, <link> The URL of a linked resource. hreflang <a>, <area>, <link> Specifies the language of the linked resource. http-equiv <meta> Defines a pragma directive. icon <command> Specifies a picture which represents the command. id Global attribute Often used with CSS to style a specific element. The ...
...ded lazily (loading="lazy") or loaded immediately (loading="eager"). WIP: WHATWG PR #3752 list <input> Identifies a list of pre-defined options to suggest to the user. loop <audio>, <bgsound>, <marquee>, <video> Indicates whether the media should start playing from the start when it's finished. low <meter> Indicates the upper bound of the lower
range. manifest <html> Specifies the URL of the document's cache manifest. Note: This attribute is obsolete, use <link rel="manifest"> instead. max <input>, <meter>, <progress> Indicates the maximum value allowed. maxlength <input>, <textarea> Defines the maximum number of characters allowed in the element. minlength <input>, <textarea> ...
<input type="button"> - HTML: Hypertext Markup Language
amples The below example shows a very simple drawing app created using a <canvas> element and some simple CSS and JavaScript (we'll hide the CSS for brevity). The top two controls allow you to choose the color and size of the drawing pen. The button, when clicked, invokes a function that clears the canvas. ...
...output">30</span> <input type="button" value="Clear canvas"> </div> <canvas class="myCanvas"> <p>Add suitable fallback here.</p> </canvas> body { background: #ccc; margin: 0; overflow: hidden; } .toolbar { background: #ccc; width: 150px; height: 75px; padding: 5px; } input[type="color"], input[type="button"] { width: 90%; margin: 0 auto; display: block; } input[type="
range"] { width: 70%; } span { position: relative; bottom: 5px; } var canvas = document.querySelector('.myCanvas'); var width = canvas.width = window.innerWidth; var height = canvas.height = window.innerHeight-85; var ctx = canvas.getContext('2d'); ctx.fillStyle = 'rgb(0,0,0)'; ctx.fillRect(0,0,width,height); var colorPicker = document.querySelector('input[type="color"]'); var sizePicker = d...
...tion: relative; bottom: 5px; } var canvas = document.querySelector('.myCanvas'); var width = canvas.width = window.innerWidth; var height = canvas.height = window.innerHeight-85; var ctx = canvas.getContext('2d'); ctx.fillStyle = 'rgb(0,0,0)'; ctx.fillRect(0,0,width,height); var colorPicker = document.querySelector('input[type="color"]'); var sizePicker = document.querySelector('input[type="
range"]'); var output = document.querySelector('.output'); var clearBtn = document.querySelector('input[type="button"]'); // covert degrees to radians function degToRad(degrees) { return degrees * Math.PI / 180; }; // update sizepicker output value sizePicker.oninput = function() { output.textContent = sizePicker.value; } // store mouse pointer coordinates, and whether the button is pressed var...
HTML elements reference - HTML: Hypertext Markup Language
<dfn> The HTML Definition element (<dfn>) is used to indicate the term being defined within the context of a definition phrase or sentence. <em> The HTML <em> element marks text that has stress emphasis. The <em> element can be nested, with each level of nesting indicating a greater degree of emphasis. <i> The HTML Idiomatic Text element (<i>) represents a
range of text that is set off from the normal text for some reason, such as idiomatic text, technical terms, taxonomical designations, among others. <kbd> The HTML Keyboard Input element (<kbd>) represents a span of inline text denoting textual user input from a keyboard, voice input, or any other text entry device. <mark> The HTML Mark Text element (<mark>) represents text ...
...ently turned off in the browser. <script> The HTML <script> element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code. Demarcating edits These elements let you provide indications that specific parts of the text have been altered. Element Description <del> The HTML <del> element represents a
range of text that has been deleted from a document. <ins> The HTML <ins> element represents a
range of text that has been added to a document. Table content The elements here are used to create and handle tabular data. Element Description <caption> The HTML <caption> element specifies the caption (or title) of a table. <col> The HTML...
...s of input data and control widgets are available, depending on the device and user agent. <label> The HTML <label> element represents a caption for an item in a user interface. <legend> The HTML <legend> element represents a caption for the content of its parent <fieldset>. <meter> The HTML <meter> element represents either a scalar value within a known
range or a fractional value. <optgroup> The HTML <optgroup> element creates a grouping of options within a <select> element. <option> The HTML <option> element is used to define an item contained in a <select>, an <optgroup>, or a <datalist> element. As such, <option> can represent menu items in popups and other lists of items in an HTML document. <output> The ...
HTTP headers - HTTP
e Makes the request conditional, and expects the entity to be transmitted only if it has been modified after the given date. This is used to transmit data only when the cache is out of date. If-Unmodified-Since Makes the request conditional, and expects the entity to be transmitted only if it has not been modified after the given date. This ensures the coherence of a new fragment of a specific
range with previous ones, or to implement an optimistic concurrency control system when modifying existing documents. Vary Determines how to match request headers to decide whether a cached response can be used rather than requesting a fresh one from the origin server. Connection management Connection Controls whether the network connection stays open after the current transaction finishes. Ke...
...ows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent. See also the Firefox user agent string reference. Response context Allow Lists the set of HTTP request methods supported by a resource. Server Contains information about the software used by the origin server to handle the request.
Range requests Accept-
Ranges Indicates if the server supports
range requests, and if so in which unit the
range can be expressed.
Range Indicates the part of a document that the server should return. If-
Range Creates a conditional
range request that is only fulfilled if the given etag or date matches the remote resource. Used to prevent downloading two
ranges from incompatible version of the re...
... Security Cross-Origin-Embedder-Policy (COEP) Allows a server to declare an embedder policy for a given document. Cross-Origin-Opener-Policy (COOP) Prevents other domains from opening/controlling a window. ...
Numbers and dates - JavaScript
r the 0b are not 0 or 1, the following SyntaxError is thrown: "Missing binary digits after 0b". var FLT_SIGNBIT = 0b10000000000000000000000000000000; // 2147483648 var FLT_EXPONENT = 0b01111111100000000000000000000000; // 2139095040 var FLT_MANTISSA = 0B00000000011111111111111111111111; // 8388607 Octal numbers Octal number syntax uses a leading zero. If the digits after the 0 are outside the
range 0 through 7, the number will be interpreted as a decimal number. var n = 0755; // 493 var m = 0644; // 420 Strict mode in ECMAScript 5 forbids octal syntax. Octal syntax isn't part of ECMAScript 5, but it's supported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%". In ECMAScript 2015, octal numbers are supported if they are prefixed with 0o, e.g.: v...
..., but it's supported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%". In ECMAScript 2015, octal numbers are supported if they are prefixed with 0o, e.g.: var a = 0o10; // ES2015: 8 Hexadecimal numbers Hexadecimal number syntax uses a leading zero followed by a lowercase or uppercase Latin letter "X" (0x or 0X). If the digits after 0x are outside the
range (0123456789ABCDEF), the following SyntaxError is thrown: "Identifier starts immediately after numeric literal". 0xFFFFFFFFFFFFFFFFF // 295147905179352830000 0x123456789ABCDEF // 81985529216486900 0XA // 10 Exponentiation 1E3 // 1000 2e6 // 2000000 0.1e2 // 10 Number object The built-in Number object has properties for numerical constants, such as maximum value, not-a-...
...s a large number of methods for setting, getting, and manipulating dates. It does not have any properties. JavaScript handles dates similarly to Java. The two languages have many of the same date methods, and both languages store dates as the number of milliseconds since January 1, 1970, 00:00:00, with a Unix Timestamp being the number of seconds since January 1, 1970, 00:00:00. The Date object
range is -100,000,000 days to 100,000,000 days relative to 01 January, 1970 UTC. To create a Date object: var dateObjectName = new Date([parameters]); where dateObjectName is the name of the Date object being created; it can be a new object or a property of an existing object. Calling Date without the new keyword returns a string representing the current date and time. The parameters in the prece...
String - JavaScript
imitive string instead, although generally, authors need not worry about the distinction. A String object can always be converted to its primitive counterpart with the valueOf() method. ...
... (where XXX is 1-3 octal digits;
range of 0-377) ISO-8859-1 character / Unicode code point between U+0000 and U+00FF \' single quote \" double quote \\ backslash \n new line \r carriage return \v vertical tab \t tab \b backspace \f form feed \uXXXX (where XXXX is 4 hex digits;
range of 0x0000-0xFFFF) UTF-16 code unit / Unicode code point between U+0000 and U+FFFF \u{X} ... ...
... double quote \\ backslash \n new line \r carriage return \v vertical tab \t tab \b backspace \f form feed \uXXXX (where XXXX is 4 hex digits;
range of 0x0000-0xFFFF) UTF-16 code unit / Unicode code point between U+0000 and U+FFFF \u{X} ... \u{XXXXXX} (where X...XXXXXX is 1-6 hex digits;
range of 0x0-0x10FFFF) UTF-32 code unit / Unicode code point between U+0000 and U+10FFFF \xXX (where XX is 2 hex digits;
range of 0x00-0xFF) ISO-8859-1 character / Unicode code point between U+0000 and U+00FF Long literal strings Sometimes, your code will include strings which are very long. Rather than having lines that go on endlessly, or wrap at the whim of your editor, yo...
try...catch - JavaScript
ption; this value is only available in the scope of the catch-block. ...
... scope of the catch-block. ...
...You can use this identifier to get information about the exception that was thrown. This identifier is only available in the c...
widths - SVG: Scalable Vector Graphics
If too many widths are provided, the extras are ignored. ...
...If too many widths are provided, the extras are ignored. ...
...r more glyph widths. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value None Animatable No <number> This value is a comma-separated list of UCS
range values as defined in ISO 10646, each followed by one or more glyph widths. If this attribute is used, the units-per-em attribute must also be used. If the
range is omitted, a
range of U+0-7FFFFFFF is assumed which covers all characters and their glyphs. If not enough glyph widths are given, the last in the list is replicated to cover that
range. If too many widths are provided, the extras are ignored. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'widths' ...
Using the WebAssembly JavaScript API - WebAssembly
and click on the "wasm://" entry. Starting soon in Firefox, in addition to viewing WebAssembly as text, developers will be able to debug (place breakpoints, inspect the callstack, single-step, etc.) WebAssembly using the text format. See WebAssembly debugging with Firefox DevTools for a video preview. ...
...bAssembly, memory is represented as a contiguous
range of untyped bytes called Linear Memory that are read and written by load and store instructions inside the module. In this memory model, any load or store can access any byte in the entire linear memory, which is necessary to faithfully represent C/C++ concepts like pointers. Unlike a native C/C++ program, however, where the available memory
range spans the entire process, the memory accessible by a particular WebAssembly Instance is confined to one specific -- potentially very small --
range contained by a WebAssembly Memory object. This allows a single web app to use multiple independent libraries -- each of which are using WebAssembly internally -- to have separate memories that are fully isolated from each other. In addition, newer im...
...ar, load it in your browser, then try entering the above two lines in your JavaScript console. Growing memory A memory instance can be grown by calls to Memory.prototype.grow(), where again the argument is specified in units of WebAssembly pages: memory.grow(1); If a maximum value was supplied upon creation of the memory instance, attempts to grow past this maximum will throw a WebAssembly.
RangeError exception. The engine takes advantage of this supplied upper-bounds to reserve memory ahead of time, which can make resizing more efficient. Note: Since an ArrayBuffer's byteLength is immutable, after a successful Memory.prototype.grow() operation the buffer getter will return a new ArrayBuffer object (with the new byteLength) and any previous ArrayBuffer objects become "detached", or disco...
Window: deviceproximity event - Archive of obsolete content
Related Events userproximity ...
...roximity Sensor Other properties Property Type Description value Read only Double (float) The measured proximity of the distant device (distance in centimetres). min Read only Double (float) The minimum value in the
range the sensor detects (if available, 0 otherwise). max Read only Double (float) The maximum value in the
range the sensor detects (if available, 0 otherwise). Related Events userproximity ...
system/xul-app - Archive of obsolete content
iven application. Parameters name : string A host application name. Returns boolean : True if the host application is name and false otherwise. isOneOf(names) Checks whether the host application is one of the given applications. Parameters names : array An array of host application names. Returns boolean : True if the host application is one of the names and false otherwise. versionIn
Range(version, lowInclusive, highExclusive) Compares a given version to a version
range. See the MDN documentation for details on version comparisons. Parameters version : string The version to compare. lowInclusive : string The lower bound of the version
range to compare. The
range includes this bound. highExclusive : string The upper bound of the version
range to compare. The
range does not i...
... Properties ID The GUID of the host application. For example, for Firefox this value is "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}". name The host application name. The possible values here are: "Firefox" "Fennec" "Mozilla" "SeaMonkey" "Sunbird" "Thunderbird" "Firefox"and"Fennec"` are the most commonly used values. version The host application version. ...
console - Archive of obsolete content
ise you see in the console output. Especially when debug logging shows up in a production environment, the noise can make it harder, not easier, to debug issues. This is the problem that logging levels are designed to fix. The console defines a number of logging levels, from "more verbose" to "less verbose", and a number of different logging functions that correspond to these levels, which are ar
ranged in order of "severity" from informational messages, through warnings, to errors. At a given logging level, only calls to the corresponding functions and functions with a higher severity will have any effect. For example, if the logging level is set to "info", then calls to info(), log(), warn(), and error() will all result in output being written. But if the logging level is "warn" then only c...
...e logging level is set to "info", then calls to info(), log(), warn(), and error() will all result in output being written. But if the logging level is "warn" then only calls to warn() and error() have any effect, and calls to info() and log() are simply discarded. This means that the same code can be more verbose in a development environment than in a production environment - you just need to ar
range for the appropriate logging level to be set. The complete set of logging levels is given in the table below, along with the set of functions that will result in output at each level: Level Will log calls to: all Any console method debug debug(), error(), exception(), info(), log(), time(), timeEnd(), trace(), warn() info error(), exception(), info...
Extension Versioning, Update and Compatibility - Archive of obsolete content
ly digits were allowed. The toolkit version format supports the Firefox version format but allows greater flexibility. How Applications Determine Compatibility When installing add-ons applications look at the targetApplication entries in the add-on's install.rdf. An entry must exist with an ID matching the ID of the application. Additionally the minVersion and maxVersion of this entry must be a
range that includes the version of the running application. If the application has a targetApplication entry but it is for an incompatible version then the application will retrieve updated compatibility information from the add-on's updateURL. If the install.rdf contains any targetPlatform entries then the platform of the currently running application must be listed or the installation will be rejec...
...hecks when installing add-ons. Simply create the boolean preference extensions.checkCompatibility and set it to false. Note: Before Firefox 1.5 the preference app.extensions.version could be used to override the version that the application believed itself to be to allow normally incompatible extensions to install. Choosing minVersion and maxVersion minVersion and maxVersion should specify the
range of versions of the application you have tested with. In particular you should never specify a maxVersion that is larger than the currently available version of the application since you do not know what API and UI changes are just around the corner. With compatibility updating it is not necessary to release a whole new version of the extension just to increase its maxVersion. For the maxVersion ...
How to convert an overlay extension to restartless - Archive of obsolete content
e with XUL overlay. It involves using firebug.sdk. ...
...y. It involves using firebug.sdk. The next is example of the code: var overlay = TOOLBARBUTTON(toolbarButtonAttrs, PANEL({'id': 'thepanel', 'type': 'arrow'}, HBOX({'align': 'start'}, VBOX( HBOX({'class': 'pixel-hbox'}, DESCRIPTION({'value': this.stringBundle.GetStringFromName('firexPixel.opacity')}), HTMLINPUT({'id': 'opacity-
range', 'type': '
range', 'min': '0', 'max': '10'}) ), HBOX({'id': 'pixel-coords', 'class': 'pixel-hbox'}, LABEL({'control': 'coord-x', 'value': 'X:'}), TEXTBOX({'id': 'coord-x', 'class': 'coord-box', 'placeholder' : '0'}), LABEL({'control': 'coord-y', 'value': 'Y:'}), TEXTBOX({'id': 'coord-y', 'class': 'coord-box', 'placeholder': '0'}) ... T...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
unrelated application of the work. This is what we might call the reader's use of the work, and it requires no permission from the author. In some situations, such as education or citation, use in the strong, authorial sense is permitted to readers. Any discussion of copyright eventually turns to the fact that some uses are prohibited, so it's useful to understand what uses are unrestricted. ...
...ells, such as Windows, comes with a license that permits only limited duplication in exchange for a fee, so, although customers can install it on their computers, they cannot modify it. And essential freedoms, such as reverse-engineering, are also restricted. This use permit is displayed when you install the software. When the user clicks "I agree," the installation process finishes. ...
The Essentials of an Extension - Archive of obsolete content
The UUID is Firefox's unique ID. Other Mozilla and Mozilla-based applications such as Thunderbird and Seamonkey have their own. You can have an extension that works on multiple applications and versions. For example, if you create a Firefox extension, it would normally take little effort to port it to SeaMonkey, which has very similar features and UI. The min and max version specify the version
range in which the extension can be installed. Here's more about the version format. If the application or version
range don't match, you won't be allowed to install the extension, or the extension will be installed in a disabled state. Users can disable version checks through preferences or installing add-ons like the Add-on Compatibility Reporter. Beginning with Firefox 11, add-ons will default to co...
...Testing your add-ons with every Firefox version is always recommended, though. This is the information Firefox and other Mozilla applications need to install an add-on. Any errors or missing information will cause the installation process to fail, or the extension to be installed in a disabled state. ...
CSS3 - Archive of obsolete content
ndation since June 21st, 2018 Adds: The ability to tweak the box model using the CSS box-sizing property. At risk: due to insufficient browser support, standardization of the padding-box value may be postponed to the next iteration of this module. Allow the styling of forms according their content using the CSS :indeterminate, :default, :valid, :invalid, :in-
range, :out-of-
range, :required, :optional, :read-only, and :read-write pseudo-classes and the ::value, ::choices, ::repeat-item, and ::repeat-index pseudo-elements. At risk: due to insufficient browser support, standardization of the pseudo-elements ::value, ::choices, ::repeat-item, and ::repeat-index may be postponed to the next iteration of this module . Support for icons, defined by th...
...form property with the value full-width. the CSS text-align property with the value start, end, start end, and match-parent for a better support of documents with multiple directionalities of text. the CSS text-align property with a <string> value to align on that character. This is useful to align number on the decimal point. the CSS word-spacing and letter-spacing properties with
range constraints to control flexibility in justification. Adds: Control on how whitespaces are displayed using the CSS text-space-collapse and tab-size properties. Control on line breaks and word boundaries using the CSS line-break, word-break, hyphens, text-wrap, overflow-wrap, and text-align-last properties. Control on how justification is happening, in order to suppor...
Index of archived content - Archive of obsolete content
Mozilla XForms Specials Mozilla XForms User Interface XForms Alert Element XForms Group Element XForms Help Element XForms Hint Element XForms Input Element XForms Label Element XForms Message Element XForms Output Element XForms
Range Element XForms Repeat Element XForms Secret Element XForms Select Element XForms Select1 Element XForms Submit Element XForms Switch Module XForms Textarea Element XForms Trigger Element XForms Upload Element Other Resources ...
... Adobe Flash External resources for plugin creation Logging Multi-Process Plugins Monitoring plugins Multi-process plugin architecture NPAPI plugin developer guide NPAPI plugin reference Browser-side plug-in API NPAPI plug-in side API NPAnyCallbackStruct NPByte
Range NPClass NPEmbedPrint NPEvent NPFullPrint NPIdentifier NPN NewStream NPNVariable NPN_CreateObject NPN_DestroyStream NPN_Enumerate NPN_Evaluate NPN_ForceRedraw NPN_GetAuthenticationInfo NPN_GetIntIdentifier NPN_GetPropert...
Venkman Introduction - Archive of obsolete content
nkman command line option, which launches Venkman initially instead of an application front end. (Note that Venkman displays usage data when it starts up: "Recorded local startup X, global YYY." This data comes from a counter built in to the application. For more information about this counter and the data, see Item 2.2 in the Venkman FAQ.) When you first start Venkman, the basic views are ar
ranged as in the screenshot above--though you can customize the layout and presence of the different views however you want, as we describe in the View Customization section below. The scripts that have been loaded by the JavaScript engine appear in the Loaded Scripts window (for more information about how scripts are loaded and accessed in Venkman, see "Loading Scripts into the Debugger"). The menu...
...d names. Command history remembers the last 20 commands entered. The up and down arrows can be used to revisit these previous commands. Tab completion allows the user to type the first portion of a command, and press tab twice to see possible completions. If only one command matches, it will be auto-completed on the first tab. View Customization Venkman offers nearly complete control over the ar
rangement and display of views within the application. The debugger is built on top of an application framework that allows you to drag and drop, resize, and toggle all the available views, and even to create new views or modules for the debugger if you choose--though this latter is an advanced topic and a subject for a future article. To remove a view from Venkman, simply click the Close button at th...
Creating XPI Installer Modules - Archive of obsolete content
iles. These new files represent a redesign of the way that the Mozilla UI is packaged and installed. Though the chrome directory still includes subdirectories of uncompressed files by default, a new way to aggregate and distribute the files has improved performance, made the UI components more portable and easier to install, and made the installation process a much easier one. However, this new ar
rangement does not make things much easier for the web or user interface developer. The relatively simple process of finding the appropriate resources (i.e. XUL, JavaScript, or CSS files) in the chrome subdirectories and editing them with a text editor has been replaced by something a lot of developers find more confusing and esoteric. This article describes the new packaging scheme of Mozilla and offe...
... What follows is a very brief overview of the design and a description of what Mozilla expects in installable packages. Resources are collected in JAR archives whose contents are specified in contents.rdf files at their own top level. The contents.rdf file explains the structure and contents of the archive to Mozilla's chrome registry; as long as the explanation is accurate, the contents can be ar
ranged in almost any way you want. In the package you create in this tutorial, for example, all of the resources are located under the content/ subdirectory, but they could just as easily have been archived directly at the top--along with skin and locale resources, if you wanted. Where before a single manifest.rdf file described the resources in an entire package directory or archive, now contents.rdf ...
Learn XPI Installer Scripting by Example - Archive of obsolete content
Overview of the Install Script XPI install scripts are written in JavaScript using XPInstall Engine syntax defined in the XPInstall API Reference. Most installation scripts, including the one discussed here, take the following basic form (in pseudo-code and with links to the sec...
...inal step is to actually execute the installation. Note that until this point, the install calls you have been making on the Install object are preliminary only. Recall that an install process takes the following general form: initInstall(); if (verify_space()) { err = add_dirs_and_files; register_files; if (err==SUCCESS) { performInstall() }; else { cancelInstall() }; } In this ar
rangement, the actual execution of the installation is checked against the errors returned from the addition of files to the installation, which may itself have been conditioned on some verification of version and necessary disk space. The actual install code used to execute the installation appears in theinstall.js file as follows: if (err==SUCCESS) { err = performInstall(); logCommen...
Introduction to XUL - Archive of obsolete content
In fact, most of Mozilla's windows (and dialogs) will be described using this mechanism. XUL (pronounced "zool," as if that spelling helped any, and short for "XML User Interface Language") is our name for the language in which these UI descriptions are built. ...
... the widget documentation referenced at the index for details. Other Infrastructure Widgets may have JavaScript event handlers just as in HTML, and are tied together using JavaScript and broadcaster nodes. Broadcaster nodes are declared as <broadcaster> elements in the XUL description, and are involved with the communication of changes of state between widgets. A widget or several widgets can ar
range to have the value of one of their attributes be tied to a broadcaster node. This tie is defined within the XUL: <xul:window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <broadcaster id="canGoBack"/> <titledbutton src="resource:/res/toolbar/TB_Back.gif" align="bottom" value="Back" onclick="BrowserBack()"> <observes element="canGoBack" attribute="disabl...
textbox (Toolkit autocomplete) - Archive of obsolete content
This should be one of the characters that appears in the label attribute for the element. autocompletepopup Type: id The id of a popup element used to hold autocomplete results for t...
...method yourself. onTextEntered() Return type: event result Calls the ontextentered event handler. You should not call this method yourself. onTextReverted() Return type: event result Calls the ontextreverted event handler. You should not call this method yourself. select() Return type: no return value Selects all the text in the textbox. setSelection
Range( start, end ) Return type: no return value Sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position without selecting text. Related Interfaces nsIAccessibleProvi...
Textbox (XPFE autocomplete) - Archive of obsolete content
This should be one of the characters that appears in the label attribute for the element. alwaysopenpopup Obsolete since Gecko 1.9.1 Type: boolean Note: Applies to: Thunderbird and SeaMonkeyIf true, the autocomplete popup will be...
...s the result value at the specified index for a specific session. removeSession( session ) Obsolete since Gecko 26 Return type: void Removes a session object from the autocomplete widget. The argument should be an object which implements the nsIAutoCompleteSession interface. select() Return type: no return value Selects all the text in the textbox. setSelection
Range( start, end ) Return type: no return value Sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position without selecting text. syncSessions( autoCompleteElement ) Ob...
Focus and Selection - Archive of obsolete content
re contents of a field but only what the user has selected. Or, you may wish to change the current selection. XUL textboxes support a way to retrieve and modify the selection. The simplest one is to select all of the text in a textbox. This involves using the select method of the textbox. tbox.select(); However, you may wish to select only part of the text. To do this you can use the setSelection
Range function. It takes two parameters, the first is the starting character and the second is the character after the last one that you want to have selected. Values are zero-based, so the first character is 0, the second is 1 and so on. tbox.setSelection
Range(4,8); This example will select the fifth character displayed, as well as the sixth, seventh and eighth. If there were only six characters ente...
... six characters entered into the field, only the fifth and sixth characters would be selected. No error would occur. If you use the same value for both parameters, the start and end of the selection changes to the same position. This results in changing the cursor position within the textbox. For example, the line below can be used to move the cursor to the beginning of the text. tbox.setSelection
Range(0,0); You can retrieve the current selection by using the selectionStart and selectionEnd properties. These properties are set to the starting and ending positions of the current selection respectively. If both are set to the same value no text is selected, and the cursor is moved to that position. Once you have the start and end positions, you can pull out the substring from the whole text. You...
Input Controls - Archive of obsolete content
for options that can be enabled or disabled. Radio buttons can be used for a similar purpose when there are a set of them and only one can be selected at once. You can use most of the same attributes on checkboxes and radio buttons as with buttons. The example below shows some simple checkboxes and radio buttons. <checkbox id="case-sensitive" checked="true" label="Case sensitive"/> <radio id="o
range" label="O
range"/> <radio id="violet" selected="true" label="Violet"/> <radio id="yellow" label="Yellow"/> The first line creates a simple checkbox. When the user clicks the checkbox, it switches between checked and unchecked. The checked attribute can be used to indicate the default state. You should set this to either true or false. The label attribute can be used to assign a label that will a...
...tton selected by default, or leave it out for other radio buttons. Radiogroup element In order to group radio buttons together, you need to use the radiogroup element. Only one of the radio buttons in a radio group can be selected at once. Clicking one will turn off all of the others in the same group. The following example demonstrates this. Example 3 : Source View <radiogroup> <radio id="o
range" label="O
range"/> <radio id="violet" selected="true" label="Violet"/> <radio id="yellow" label="Yellow"/> </radiogroup> Attributes Like buttons, check boxes and radio buttons are made up of a label and an image, where the image switches between checked and unchecked when it is pressed. Check boxes have many of the same attributes as buttons: label The label on the check box or radio b...
The Implementation of the Application Object Model - Archive of obsolete content
ct that we were off adding a whole slew of new stuff to HTML when we could have been firming up our standards story. By making XUL a separate beast, this is less of an issue. Since an AOM tree cannot be placed inside a DOM tree, XUL applications don't ever occur inside Web pages. By enforcing this distinction, we can successfully defend ourselves from any claims that we were "mucking about with st
range new HTML" when we could have been working on our standards story. Forget XUL and RDF? We don't need any of this complicated nonsense! Just let us go off and make our widgets and build our applications the old-fashioned way! We're still cross-platform, since we'd only have to write widgets like trees and toolbars once! I say, forget this whole thing! Let's just ship a product! That would be the...
...sign an HTML dialog system, which still wouldn't cut it without extending HTML), and Communicator would have to ship with both widget sets. The native widgets would also be an issue for something like a gfx-toolbar, which would need to contain the native widgets and still look consistent on all platforms. The native widgets also wouldn't be fully CSS responsive, which would mean they might look st
range when placed in a dialog or on a toolbar with a rendered background. Of course you could always say that toolbars and dialogs just wouldn't be able to have backgrounds with different colors, but that leads into the next point. A staggering loss of functionality. An incredible array of features would be lost. Yes, you'd probably ship a browser slightly faster than with the XUL-based approach, but ...
datepicker - Archive of obsolete content
element will, however, still respond to mouse events. To enable the element, leave this attribute out entirely. Visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. firstdayofweek Type: integer which day of the week to display as the first day in the grid. The values
range from 0 to 6, where 0 is Sunday and 6 is Saturday. The default value is determined by the locale, so only use this attribute if you want to override it. readonly Type: boolean If set to true, then the user cannot change the value of the element. However, the value may still be modified by a script. tabindex Type: integer The tab order of the element. The tab order is the order in...
...tepickers, this property is always false. readOnly Type: boolean If set to true, then the user cannot modify the value of the element. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string The currently selected date in the form YYYY-MM-DD. Unlike the month property, months in this value
range from 01 to 12. Set this property to change the selected date. year Type: integer The currently selected year from 1 to 9999. Set this property to change the selected year. yearLeadingZero Type: boolean A read only value indicating whether a leading zero should be displayed before the year when it is less than 1000. Methods Inherited Methods a...
textbox - Archive of obsolete content
decimalplaces Type: integer The number of decimal places to display. The default is 0, which doesn't show any decimal places. The value Infi...
... Return type: no return value Increases the value of the scale or number box by the increment. reset() Return type: no return value Resets the preference to its default value. For a textbox it also clears the undo transaction list (Gecko 1.9). select() Return type: no return value Selects all the text in the textbox. setSelection
Range( start, end ) Return type: no return value Sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position without selecting text. Inherited Methods addEventListener(), appen...
Dialogs in XULRunner - Archive of obsolete content
Here is the code needed to open a dialog: function openDialog() { window.openDialog("chrome://basi...
... (accept, cancel, help, extra1, and extra2). buttonlabelaccept Label for the accept button; similar attributes exist for the other button types. buttonaccesskeyaccept Access key for the accept button; similar attributes exist for the other button types. ondialogaccept JavaScript to execute if the accept button is pressed; similar attributes exist for the other button types. XUL has a wide
range of input controls you can use in a dialog. In the future, I will try to go into more detail on some of the existing and planned XUL input controls. Not too sure if I'll use the <dialogheader>, but if I did, the single element would be a big time saver over building the header from scratch. Common dialogs Some of the most frequently used common dialogs are for opening and saving files. For insta...
calICalendarView - Archive of obsolete content
ndarView. calendar/base/public/calICalendarView.idlScriptable Please add a summary to this article. ...
...Bases in order to support selecting multiple items at once. selectedDay The currently selected day in the display. Other areas of the code will often use this as a basis for default values for new calIEvents and calITodos. Methods showDate void showDate(in calIDateTime aDate); Ensures that the passed in aDate is visible in the view. The view is free to show other days as well. setDate
Range void setDate
Range(in calIDateTime aStartDate, in calIDateTime aEndDate); Ensures that the entire
range of dates from aStartDate to aEndDate is visible. The view is free to show other dates as well, although this should be kept to a minimum. (For instance, calendar-month-view will show all dates from the start of the week of aStartDate to the end of the week of aEndDate.) setDateList void...
NPAPI plugin reference - Archive of obsolete content
plug-in. NPAnyCallbackStruct Contains information required during embedded mode printing. NPAPI plug-in side API This chapter describes methods in the plug-in API that are available from the plug-in object; these allow plug-ins to interact with the browser. The names of all of these methods begin with NPP_ to indicate that they are implemented by the plug-in and called by the browser. NPByte
Range Represents a particular
range of bytes from a stream. NPClass NPClass is a structure that holds a set of pointers to functions that make up the behavior of an instance of an NPClass (i.e. an NPObject). NPEmbedPrint Substructure of NPPrint that contains platform-specific information used during embedded mode printing. NPEvent Represents an event passed by NPP_HandleEvent() to a windowless p...
...rence count reaches 0, the NPObject is deallocated by calling its deallocate function if one is provided; if one is not provided, free() is used. NPN_ReleaseVariantValue NPN_ReleaseVariantValue() releases the value in the given variant. NPN_ReloadPlugins Reloads all of the installed plugins. NPN_RemoveProperty Removes a property from the specified NPObject. NPN_RequestRead Requests a
range of bytes from a seekable stream. This initiates a read operation; the actual data is received through subsequent calls to NPP_WriteReady() and NPP_Write(). NPN_RetainObject Increments the reference count of the given NPObject. NPN_SetException A plugin can call this function to indicate that a call to one of the plugin's NPObjects generated an error. NPN_SetProperty Sets the value of a prop...
Building a Theme - Archive of obsolete content
he right pane should show the DOM node, which has useful styling information like the CSS class and node id. The element itself is of id navigator-toolbox, with no idea. To change its style within our theme, we need to write a selector rule to select this class. Open up the file chrome/browser/browser.css in your theme. Search this file for the #navigator-toolbox selector, and add a background: o
range; rule to it. Save the file. Chrome URIs Next, we have to tell Firefox where to find the theme files for your theme. CSS, XUL, and other files are part of "Chrome Packages" - bundles of user interface components which are loaded via chrome:// URIs. Rather than load the browser from disk using a file:// URI (since the location of Firefox on the system can change from platform to platform and s...
...le extension. Now you should be ready to test your theme! Start Firefox. Firefox will detect the text link to your theme directory and install the theme. Your theme will not be active the first time you install, and you will need to click "Enable" and restart before you can see your change. After it restarts this second time, you should see the background color of the toolbars is displayed in o
range now. You can now go back and make additional changes to your css files, close and restart Firefox, and see the updates. Package Now that your theme works, you can package it for deployment and installation. Zip up the contents of your theme's folder (not the theme folder itself), and rename the zip file to have a .xpi extension. In Windows, you can do this easily by selecting all the files ...
Browser Detection and Cross Browser Support - Archive of obsolete content
is to assume that any unknown browser supports the basic standards of HTML and CSS and to a certain extent JavaScript and the W3C DOM. This will guarantee that your content will be supported today and in the future by any browser which supports the standards. Limit the use of vendor/version specific features Authoring content which is standards compliant is the easiest way to support the widest
range of user agents and to decrease your maintenance costs. While it is not always possible to avoid vendor/version specific differences between browsers, the use of such features and the distinction between browsers based on vendor/version should be strictly limited to those areas where it is still required. Limit the use of User Agent String based Detection Server side browser detection requires t...
...ble Older browsers have many limitations which result in their ignoring more advanced features. By judiciously using these limitations in older browsers you can include modern content while at the same time supporting older browsers. HTML provides several methods of detecting support for various features such as support for scripting and FRAMES. Use these natural abilities of HTML to extend the
range of browsers your content supports. Using NOFRAMES to support NON-FRAMES capable browsers <HTML> <HEAD> <TITLE>FRAMES</TITLE> </HEAD> <FRAMESET ROWS="30,*"> <FRAME SRC="foo.html"> <FRAME SRC="bar.html"> <NOFRAMES> <BODY> <P> This page requires frames. See <a href="noframes.html">sitemap</a>. </P> </BODY> </NOFRAMES> </FRAMESET> </...
Browser Feature Detection - Archive of obsolete content
low true true true page true false true pagebreakafter true true true pagebreakbefore true true true pagebreakinside true false true pause true false true pauseafter true false true pausebefore true false true pitch true false false pitch
range true false true playduring false false false position true true true quotes true false true richness true false false right true true true size true false true speak true false true speakheader true false false speaknumeral true fa...
... 'overflow', 'supported': false}, {name: 'page', 'supported': false}, {name: 'pageBreakAfter', 'supported': false}, {name: 'pageBreakBefore', 'supported': false}, {name: 'pageBreakInside', 'supported': false}, {name: 'pause', 'supported': false}, {name: 'pauseAfter', 'supported': false}, {name: 'pauseBefore', 'supported': false}, {name: 'pitch', 'supported': false}, {name: 'pitch
Range', 'supported': false}, {name: 'playDuring', 'supported': false}, {name: 'position', 'supported': false}, {name: 'quotes', 'supported': false}, {name: 'richness', 'supported': false}, {name: 'right', 'supported': false}, {name: 'size', 'supported': false}, {name: 'speak', 'supported': false}, {name: 'speakHeader', 'supported': false}, {name: 'speakNumeral', 'supported': false}, ...
::-ms-fill-upper - Archive of obsolete content
Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-fill-upper in its selector. Other properties are ignored. ...
...opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-fill-upper Specifications Not part of any specification. Browser compatibility Historically supported in Internet Explorer and Edge before version 79. See also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-
range-progress CSS-Tricks: Styling Cross-Browser Compatible
Range Inputs with CSS QuirksMode: Styling and scripting sliders ...
::-ms-thumb - Archive of obsolete content
Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-thumb in its selector. Other properties are ignored. ...
...ackground-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-thumb Specifications Not part of any specification. See also ::-ms-track ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-thumb ::-moz-
range-thumb CSS-Tricks: Styling Cross-Browser Compatible
Range Inputs with CSS QuirksMode: Styling and scripting sliders ...
::-ms-track - Archive of obsolete content
Applying the color property within the ::-ms-track selector affects the tick marks inside the track area. It is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. To do so would create three sets of tick marks, but the best user experience is one set. To remove tick marks altogether, set the color property to transparent. ...
...n-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-track See also ::-ms-thumb ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-runnable-track ::-moz-
range-track CSS-Tricks: Styling Cross-Browser Compatible
Range Inputs with CSS QuirksMode: Styling and scripting sliders ...
Object.prototype.watch() - Archive of obsolete content
0 and 200. ...
...his.watch('name', this._isValidAssignment.bind(this)); this.name = name; this.age = age; } toString() { return this.name + ', ' + this.age; } _isValidAssignment(id, oldval, newval) { if (id === 'name' && (!newval || newval.length > 30)) { throw new
RangeError('invalid name for ' + this); } if (id === 'age' && (newval < 0 || newval > 200)) { throw new
RangeError('invalid age for ' + this); } return newval; } } const will = new Person('Will', 29); console.log(will); // Will, 29 try { will.name = ''; } catch (e) { console.log(e); } try { will.age = -4; } catch (e) { console.log(e); } This script displays the following: Will, 29
RangeError: invalid name for Will, 29
RangeError: invalid age for Will, 29 Specifications Not pa...
Mozilla XForms User Interface - Archive of obsolete content
have the following presentations: text - default representation for data of most types, especially static text. calendar - used for date data types when appearance = 'full'. image - if the instance node contains an image, then an output element can be used in combination with the mediatype element to display the image. upload Provides a means for the user to select a file (see the spec).
range Allows the user to choose a value from within a specific
range of values. It is represented by a slider widget (see the spec). trigger Allows the user to initiate actions (see the spec). It can have the following representations: button - default representation. link/clickable text - used when appearance = 'minimal'. submit Invokes the submission of the selected instance data to its target ...
...e the spec). The help will be displayed if the F1 key is pressed while the containing form control has focus. hint Similar to a tooltip (see the spec). The hint is displayed when the mouse moves and pauses over the containing form control. alert This message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified
range of selectable values (see the spec). message Used in combination with event listeners to display a message to the user when the specified event occurs (see the spec). XForms User Interface These elements are mainly used to organize and manage the form's markup. They can be bound to instance nodes to define context for the xforms controls that they contain, should any of their child nodes happen t...
3D collision detection - Game development
ut the Bounding Volumes with Three.js article to see a practical implementation of this technique. Point vs. AABB Checking if a point is inside an AABB is pretty simple -- we just need to check whether the point's coordinates fall inside the AABB; considering each axis separately. ...
...x >= box.minX && point.x <= box.maxX) && (point.y >= box.minY && point.y <= box.maxY) && (point.z >= box.minZ && point.z <= box.maxZ); } AABB vs. AABB Checking whether an AABB intersects another AABB is similar to the point test. We just need to do one test per axis, using the boxes' boundaries. ...
Explaining basic 3D theory - Game development
ent types of objects are built using vertices. A Vertex is a point in space having its own 3D position in the coordinate system and usually some additional information that defines it. Every vertex is described by these attributes: Position: Identifies it in a 3D space (x, y, z). Color: Holds an RGBA value (R, G and B for the red, green, and blue channels, alpha for transparency -- all values
range from 0.0 to 1.0). Normal: A way to describe the direction the vertex is facing. Texture: A 2D image that the vertex can use to decorate the surface it is part of instead of a simple color. You can build geometry using this information -- here is an example of a cube: A face of the given shape is a plane between vertices. For example, a cube has 8 different vertices (points in space) and 6 ...
...described using vertices, applies processing, calculates the fragments and renders them on the 2D screen as pixels. Terminology used in the diagram above is as follows: A Primitive: An input to the pipeline -- it's built from vertices and can be a triangle, point or line. A Fragment: A 3D projection of a pixel, which has all the same attributes as a pixel. A Pixel: A point on the screen ar
ranged in the 2D grid, which holds an RGBA color. Vertex and fragment processing are programmable -- you can write your own shaders that manipulate the output. Vertex processing Vertex processing is about combining the information about individual vertices into primitives and setting their coordinates in the 3D space for the viewer to see. It's like taking a photo of the given scenery you have prep...
Audio for Web games - Game development
back and atmosphere. Web-based audio is maturing fast, but there are still many browser differences to navigate. We often need to decide which audio parts are essential to our games' experience and which are nice to have but not essential, and devise a strategy accordingly. This article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a
range of platforms as possible. Mobile audio caveats By far the most difficult platforms to provide web audio support for are mobile platforms. Unfortunately these are also the platforms that people often use to play games. There are a couple of differences between desktop and mobile browsers that may have caused browser vendors to make choices that can make web audio difficult for game developers to...
...d that buffering is disabled before playback has been initiated. Buffering is the process of the browser downloading the media in advance, which we often need to do to ensure smooth playback. The HTMLMediaElement interface comes with lots of properties to help determine whether a track is in a state to be playable. Note: In many ways the concept of buffering is an outdated one. As long as byte-
range requests are accepted (which is the default behavior), we should be able to jump to a specific point in the audio without having to download the preceding content. However, preloading is still useful -- without it, there would always need to be some client-server communication required before playing can commence. Concurrent audio playback A requirement of many games is the need to play more t...
Plug-in Development Overview - Gecko Plugin API Reference
This message, which is in HTML format, is displayed by the browser in its "About Plug-ins" page. String 2 can contain the name of the plug-in, thus allowing the name the user sees to be different from the name of the file on disk. Drawing a Plug-in Instance Before drawing itself on the page, the plug-in must provide information about itself, set the window or other target in which it draws, ar
range for redrawing, and handle events. A windowless plug-in can call the following Netscape methods to draw itself: NPN_ForceRedraw: Force a paint message for windowless plug-ins. NPN_InvalidateRect: Invalidate an area in a windowless plug-in before repainting or refreshing. NPN_InvalidateRegion: Invalidate an area in a windowless plug-in before repainting or refreshing. The browser calls thes...
... identifying the format of the data in the stream. Streams produced by the browser can be automatically sent to the plug-in instance or requested by the plug-in. The plug-in can select one of these transmission modes: Normal mode: the browser sends the stream data sequentially to the plug-in as the data becomes available. Random-access mode: the browser allows the plug-in to request specific
ranges of bytes from anywhere in the stream. This mode requires server support. File mode: the browser saves the data to a local file in cache and passes that file path to the plug-in. Streams produced by the plug-in to send to the browser are like normal-mode streams produced by the browser, but in reverse. In the browser's normal-mode streams, the browser calls the plug-in to inform it that the st...
HTML: A good basis for accessibility - Learn web development
sting of the examples shown below. See our Screen readers guide for more details. Good semantics We've already talked about the importance of proper semantics, and why we should use the right HTML element for the job. This cannot be ignored, as it is one of the main places that accessibility is badly broken if not handled properly. Out there on the web, the truth is that people do some very st
range things with HTML markup. Some abuses of HTML are due to legacy practices that have not been completely forgotten, and some are just plain ignorance. Whatever the case, you should replace such bad code. Sometimes you are not in the position to get rid of lousy markup -- your pages might be generated by some kind of server-side framework over which you don't have full control, or you might have th...
...r="mood">Choose your mood:</label> <select id="mood" name="mood"> <option>Happy</option> <option>Sad</option> <option>Angry</option> <option>Worried</option> </select> </div> </form> This means using links, buttons, form elements, and labels appropriately (including the <label> element for form controls). However, it is again the case that people sometimes do st
range things with HTML. For example, you sometimes see buttons marked up using <div>s, for example: <div data-message="This is from the first button">Click me!</div> <div data-message="This is from the second button">Click me too!</div> <div data-message="This is from the third button">And me!</div> But using such code is not advised -- you immediately lose the native keyboard accessibility you would...
HTML: A good basis for accessibility - Learn web development
sting of the examples shown below. See our Screen readers guide for more details. Good semantics We've already talked about the importance of proper semantics, and why we should use the right HTML element for the job. This cannot be ignored, as it is one of the main places that accessibility is badly broken if not handled properly. Out there on the web, the truth is that people do some very st
range things with HTML markup. Some abuses of HTML are due to legacy practices that have not been completely forgotten, and some are just plain ignorance. Whatever the case, you should replace such bad code. Sometimes you are not in the position to get rid of lousy markup -- your pages might be generated by some kind of server-side framework over which you don't have full control, or you might have th...
...r="mood">Choose your mood:</label> <select id="mood" name="mood"> <option>Happy</option> <option>Sad</option> <option>Angry</option> <option>Worried</option> </select> </div> </form> This means using links, buttons, form elements, and labels appropriately (including the <label> element for form controls). However, it is again the case that people sometimes do st
range things with HTML. For example, you sometimes see buttons marked up using <div>s, for example: <div data-message="This is from the first button">Click me!</div> <div data-message="This is from the second button">Click me too!</div> <div data-message="This is from the third button">And me!</div> But using such code is not advised -- you immediately lose the native keyboard accessibility you would...
WAI-ARIA basics - Learn web development
a href="#hidden" class="hidden">Skip to navigation</a> But this is still not very precise, and can only be used when the screenreader is reading from the top of the page. As another example, apps started to feature complex controls like date pickers for choosing dates, sliders for choosing values, etc. HTML5 provides special input types to render such controls: <input type="date"> <input type="
range"> These are not well-supported across browsers, and it is also difficult to style them, making them not very useful for integrating with website designs. As a result, developers quite often rely on JavaScript libraries that generate such controls as a series of nested <div>s or table elements with classnames, which are then styled using CSS and controlled using JavaScript. The problem here is t...
...ead out the contents of the error list when any changes are made to it -- i.e. when errors are added or removed. This is useful because the user will want to know what errors are left, not just what has been added or removed from the list. We could go further with our ARIA usage, and provide some more validation help. How about indicating whether fields are required in the first place, and what
range the age should be? At this point, take a copy of our form-validation.html and validation.js files, and save them in a local directory. Open them both in a text editor and have a look at how the code works. First of all, add a paragraph just above the opening <form> tag, like the one below, and mark both the form <label>s with an asterisk. This is normally how we mark required fields for sigh...
What is accessibility? - Learn web development
auditory impairments or deaf people, this group of people has either low hearing levels or no hearing at all. Hearing-impaired people do use ATs (see Assistive Devices for People with Hearing, Voice, Speech, or Language Disorders), but there are not really special ATs specific for computer/web use. There are, however, specific techniques for providing textual alternatives to audio content which
range from simple text transcripts to text tracks (i.e. captions) that can be displayed along with video. An article, later on, will discuss these. Hearing-impaired people also represent a significant userbase -- "466 million people worldwide have disabling hearing loss", says the World Health Organization's Deafness and hearing loss fact sheet. People with mobility impairments These people have dis...
...yboard accessibility section. In terms of statistics, a significant number of people have mobility impairments. The U.S. Centers for Disease Control and Prevention Disability and Functioning (Noninstitutionalized Adults 18 Years and Over) reports the USA "Percent of adults with any physical functioning difficulty: 16.1%". People with cognitive impairments Cognitive impairment refers to a broad
range of disabilities, from people with intellectual disabilities who have the most-limited capabilities, to all of us as we age and have difficulty thinking and remembering. The
range includes people with mental illnesses, such as depression and schizophrenia. It also includes people with learning disabilities, such as dyslexia and attention deficit hyperactivity disorder. Importantly, though there is...
Debugging CSS - Learn web development
n existing site, you will find yourself having a hard time getting some CSS to apply. No matter what you do, the element just doesn't seem to take the CSS. What is generally happening here is that a more specific selector is overriding your changes, and here DevTools will really help you out. In our example file there are two words that have been wrapped in an <em> element. One is displaying as o
range and the other hotpink. In the CSS we have applied: em { color: hotpink; font-weight: bold; } Above that in the stylesheet however is a rule with a .special selector: .special { color: o
range; } As you will recall from the lesson on cascade and inheritance where we discussed specificity, class selectors are more specific than element selectors, and so this is the value that applies. DevT...
...You can now see that the class is overriding the element selector. Find out more about the Firefox DevTools There is a lot of information about the Firefox DevTools here on MDN. ...
Pseudo-classes and pseudo-elements - Learn web development
e focus should be visible to the user. :focus-within Matches an element with focus plus an element with a descendent that has focus. :future Matches the elements after the current element. :hover Matches when the user hovers over an element. :indeterminate Matches UI elements whose value is in an indeterminate state, usually checkboxes. :in-
range Matches an element with a
range when its value is in-
range. :invalid Matches an element, such as an <input>, in an invalid state. :lang Matches an element based on language (value of the HTML lang attribute). :last-child Matches an element which is last among its siblings. :last-of-type Matches an element of a certain type that is last among its ...
... last element of that type in the sequence, then two elements before that, then two elements before that, etc. All the odd ones, counting from the end.) :only-child Matches an element that has no siblings. :only-of-type Matches an element that is the only one of its type among its siblings. :optional Matches form elements that are not required. :out-of-
range Matches an element with a
range when its value is out of
range. :past Matches the elements before the current element. :placeholder-shown Matches an input element that is showing placeholder text. :playing Matches an element representing an audio, video, or similar resource that is capable of being "played" or "paused", when that element is "playing". ...
Test your skills: Selectors - Learn web development
ert also has a class of go, make the background green. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Selectors Three In this example, try making the following changes without adding to the HTML. Style links, making the link-state o
range, visited links green, and remove the underline on hover. Make the first element inside the container font-size: 150% and the first line of that element red. Stripe every other row in the table by selecting these rows and giving them a background color of #333 and foreground of white. Try updating the live code below to recreate the finished example: For assessment or further work purpos...
...nload the starting point for this task to work in your own editor or in an online editor. Selectors Five In this final task add CSS using attribute selectors to do the following: Target the <a> element with a title attribute and make the border pink (border-color: pink). Target the <a> element with an href attribute that contains the word contact somewhere in its value and make the border o
range (border-color: o
range). Target the <a> element with an href value starting with https and give it a green border (border-color: green). Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these ...
Responsive design - Learn web development
As more diverse screen sizes became available, the concept of responsive web design (RWD) appeared, a set of practices that allows web pages to alter their layout and appearance to suit different screen widths, resolutions, etc. ...
...the example below the flex items will each take an equal amount of space in the flex container, using the shorthand of flex: 1 as described in the layout topic Flexbox: Flexible sizing of flex items. .container { display: flex; } .item { flex: 1; } Note: As an example, we have rebuilt the simple responsive layout above, this time using flexbox. You can see how we no longer need to use st
range percentage values to calculate the size of the columns: example, source code. CSS grid In CSS Grid Layout the fr unit allows the distribution of available space across grid tracks. The next example creates a grid container with three tracks sized at 1fr. This will create three column tracks, each taking one part of the available space in the container. You can find out more about this approach...
Styling links - Learn web development
p" should therefore only appear in external links (like the second and third ones), and we can select this with an attribute selector: a[href*="http"] selects <a> elements, but only if they have an href attribute with a value that contains "http" somewhere inside it. So that's it -- try revisiting the active learning section above and trying this new technique out! Note: The href values look st
range -- we've used dummy links here that don't really go anywhere. The reason for this is that if we used real links, you would be able to load an external site in the <iframe> the live example is embedded in, thereby losing the example. Note: Don't worry if you are not familiar with backgrounds and responsive web design yet; these are explained in other places. Styling links as buttons The tool...
... <li> elements are normally block by default (see types of CSS boxes for a ref...
HTML forms in legacy browsers - Learn web development
ilding efficient HTML Forms is not a question of design or technology. Rather, it's about simplicity, intuitivess, and ease of user interaction. The tutorial, forms usability on UX For The Masses, explains it well. Graceful degradation is web developer's best friend Graceful degradation and progressive enhancement are development patterns that allow you to build great stuff by supporting a wide
range of browsers at the same time. When you build something for a modern browser, and you want to be sure it will work, one way or another, on legacy browsers, you are performing graceful degradation. Let's see some examples related to HTML forms. HTML input types The input types added in HTML5 are all useable, even in ancient browsers, because the way they degrade is highly predictable. If a brows...
...t the color picker widget is the same in all browsers on a device as it opens up the operating system's native color picker. It's generally a good idea to not alter the default appearance of form control because altering one CSS property value may alter some input types but not others. For example, if you declare input { font-size: 2rem; }, it will impact number, date, and text, but not color or
range. If you alter a property, that may impact the appearance of the widget in unexpected ways. For example, [value] { background-color: #ccc; } may have been used to target every <input> with a value attribute, but changing the background-color or border radius on a <meter> will lead to likely unexpected results that differ across browsers. You can declare appearance: none; to remove the browser styl...
Drawing graphics - Learn web development
We have to draw the circle 85 pixels above where we measured it from, because the vertical measurement is taken from the top of the viewport, but we are drawing the circle relative to the top of the canvas, which starts below the 85 pixel-high toolbar. If we drew it with just curY as the y coordinate, it would appear 85 pixels lower than the mouse position. function draw() { if(pressed)...
... below the 85 pixel-high toolbar. If we drew it with just curY as the y coordinate, it would appear 85 pixels lower than the mouse position. function draw() { if(pressed) { ctx.fillStyle = colorPicker.value; ctx.beginPath(); ctx.arc(curX, curY-85, sizePicker.value, degToRad(0), degToRad(360), false); ctx.fill(); } requestAnimationFrame(draw); } draw(); Note: The <input>
range and color types are supported fairly well across browsers, with the exception of Internet Explorer versions less than 10; also Safari doesn't yet support color. If your browser doesn't support these inputs, they will fall back to simple text fields and you'll just have to enter valid color/number values yourself. WebGL It's now time to leave 2D behind, and take a quick look at 3D canvas. 3D ca...
Object building practice - Learn web development
d Window.innerHeight properties). Note that we are chaining multiple assignments together, to get the variables all set quicker -- this is perfectly OK. The last bit of the initial script looks as follows: function random(min, max) { const num = Math.floor(Math.random() * (max - min + 1)) + min; return num; } This function takes two numbers as arguments, and returns a random number in the
range between the two. Modeling a ball in our program Our program will feature lots of balls bouncing around the screen. Since these balls will all behave in the same way, it makes sense to represent them with an object. Let's start by adding the following constructor to the bottom of our code. function Ball(x, y, velX, velY, color, size) { this.x = x; this.y = y; this.velX = velX; this.velY...
...m of our code. function Ball(x, y, velX, velY, color, size) { this.x = x; this.y = y; this.velX = velX; this.velY = velY; this.color = color; this.size = size; } Here we include some parameters that define the properties each ball needs in order to function in our program: x and y coordinates -- the horizontal and vertical coordinates where the ball starts on the screen. This can
range between 0 (top left hand corner) to the width and height of the browser viewport (bottom right hand corner). horizontal and vertical velocity (velX and velY) -- each ball is given a horizontal and vertical velocity; in real terms these values are regularly added to the x/y coordinate values when we animate the balls, to move them by this much on each frame. color -- each ball gets a color. siz...
Handling common HTML and CSS problems - Learn web development
For example: const asideElem = document.createElement('aside'); ... This sounds like a pain to deal with, but fortunately there is a polyfill available that does the necessary fixes for you, and more besides -- see HTML5Shiv for all the details (see manual installation for the simplest usage). Selector support Of course, no CSS features wil...
...an find a detailed account of such practices in The building blocks of responsive design. Resolution is a big issue too -- for example, mobile devices are less likely to need big heavy images than desktop computers, and are more likely to have slower internet connections and possibly even expensive data plans that make wasted bandwidth more of a problem. In addition, different devices can have a
range of different resolutions, meaning that smaller images could appear pixellated. There are a number of techniques that allow you to work around such problems, from simple mobile first media queries, to more complex responsive image techniques. Another difficulty that can present problems is browser support for the features that make the above techniques possible. media queries are not supported in...
Deploying our app - Learn web development
can deploy our sample app. We push the code to GitHub, deploy it using Netlify, and even show you how to add a simple test into the process. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To finish working through our complete toolchain case study, focusing on deploying the app. Post development There's potentially a large
range of problems to be solved in this section of the project's lifecycle. As such, it's important to create a toolchain that handles these problems in a way that requires as little manual intervention as possible. Here's just a few things to consider for this particular project: Generating a production build: Ensuring files are minimised, chunked, have tree-shaking applied, and that versions are "...
... of the project's lifecycle. As such, it's important to create a toolchain that handles these problems in a way that requires as little manual intervention as possible. Here's just a few things to consider for this particular project: Generating a production build: Ensuring files are minimised, chunked, have tree-shaking applied, and that versions are "cache busted". Running tests: These can
range from "is this code formatted properly?" to "does this thing do what I expect?", and ensuring failing tests prevent deployment. Actually deploying the updated code to a live URL: Or potentially a staging URL so it can be reviewed first. Note: Cache busting is a new term that we haven't met before in the module. This is the strategy of breaking a browser's own caching mechanism, which forces th...
Package management basics - Learn web development
you can control this too. You can ask for date-fns@1, which gives you the latest 1.x version (which is 1.30.1). Or you could try date-fns@^2.3.0, which means the latest version after or including 2.3.0 (2.8.1 at the time of writing). Updating dependencies npm update yarn upgrade This will look at the currently installed dependencies and update them, if there is an update available, within the
range that's specified in the package. The
range is specified in the version of the dependency in your package.json, such as date-fns@^2.0.1 -- in this case the caret character ^ means all minor and patch releases after and including 2.0.1, up to but excluding 3.0.0. This is determined using a system called semver, which might look a bit complicated from the documentation but can be simplified by con...
... might look a bit complicated from the documentation but can be simplified by considering only the summary information and that a version is represented by MAJOR.MINOR.PATCH, such as 2.0.1 being major version 2 with patch version 1. An excellent way to try out semver values is to use the semver calculator. It's important to remember that npm update will not upgrade the dependencies to beyond the
range defined in the package.json -- to do this you will need to install that version specifically. Audit for vulnerabilities npm audit yarn audit This will check all of the dependency tree for your project and run the specific versions you're using against a vulnerability database and notify you if there are potential vulnerable packages in your project. A good starting point for learning about vu...
Mozilla's Section 508 Compliance
g an action, prompting a response, or distinguishing a visual element. Complete. Caveat: normally Mozilla uses a color change to indicate when a link has been visited. However, the visited link appearance can be altered via a user style sheet. (j) When a product permits a user to adjust color and contrast settings, a variety of color selections capable of producing a
range of contrast levels shall be provided. Complete. Mozilla's appearance preferences panel contains a large number of color possibilities. (k) Software shall not use flashing or blinking text, objects, or other elements having a flash or blink frequency greater than 2 Hz and lower than 55 Hz. Complete. Mozilla supports of <blink> and text-decoration: blink in web...
...references panel contains a large number of color possibilities. (k) Software shall not use flashing or blinking text, objects, or other elements having a flash or blink frequency greater than 2 Hz and lower than 55 Hz. Complete. Mozilla supports of <blink> and text-decoration: blink in web pages. In these situations Mozilla blinks 1 Hz, which is within the allowable
range and follows the stricter MIL-STD standard. (l) When electronic forms are used, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, including all directions and cues. Partially complete. See functional performance criteria below. Screen reader access is ...
Gecko Profiler FAQ
lar would work here: I think there are three main challenges here. You need deterministic profiles that can be compared meaningfully, you need to gather enough data / samples, and you need a way to compare profiles. To increase determinism, you really want an automated way of gathering the data. And you'll want to make sure the profiles only contain data for the time
range you're interested in. To stop the profiler from gathering more samples after the "startup end" marker that you're interested in, you can call Services.profiler.pause(); or you can insert a marker with a special string and then write a script that filters out all samples that were gathered after your marker. To increase the amount of data, you should run your automated gathering ...
...g. If the issue you are trying to avoid is not profiling on fast machines that Mozilla developers typically use to build Firefox on, a better solution may be using a less high-end machine that actually has lower spec'd hardware instead of artificially slowing down just the CPU. Another approach to get more precision is also raising the sampling frequency to sub-millisecond
ranges (it won't work on Windows.) High frequency sampling may also be an area where native profilers are a useful alternative tool to try. How do we profile "leaks" that show up after running Firefox for > 40 mins? The Gecko Profiler has been designed specifically for the use case of having it run always in the background, and it's pretty good at that! It is quite reasonable...
Midas
ing in the parent document. According to standards, The IFRAME element has the contentDocument property that refers to the document in the inline frame. It also has a property called contentWindow that refers to the window object inside the inline frame. This also avoids problems with bug 198155. In addition to the built-in commands, advanced editing can be done by manipulating the Selection and
range objects. It is beneficial to be familiar with these objects when working with an editable document. Examples This example shows the basic structure described in the Notes section : <html> <head> <title>Simple Edit Box</title> </head> <body> <iframe id="MidasForm" src="about:blank" onload="this.contentDocument.designMode='on';" ></iframe> </body> </html> Methods Document...
....queryCommandEnabled Determines whether the given command can be executed on the document in its current state. Document.queryCommandIndeterm Determines whether the current selection is in an indetermined state. Document.queryCommandState Determines whether the given command has been executed on the current selection. Document.queryCommandValue Determines the current value of the document,
range, or current selection for the given command. Supported Commands Command Value Description backcolor A color code. This command will set the background color of the document. bold If there is no selection, the insertion point will set bold for subsequently typed characters. If there is a selection and all of the characters are already bold, the ...
About NSPR
t of the original code. (The "20" in "NSPR20" does not mean "version 2.0" but rather "second generation".) Many of the concepts have been reformed, expanded, and matured. Today NSPR may still be appropriate as the platform dependent layer under Java, but its primary application is supporting clients written entirely in C or C++. How It Works NSPR's goal is to provide uniform service over a wide
range of operating system environments. It strives to not export the lowest common denominator, but to exploit the best features of each operating system on which it runs, and still provide a uniform service across a wide
range of host offerings. Threads Threads are the major feature of NSPR. The industry's offering of threads is quite sundry. NSPR, while far from perfect, does provide a single API t...
...tilized. Therefore, the minimal usable interval available from the timers is slightly less than six hours. Calendar times are 64-bit signed numbers with units of microseconds. The epoch for calendar times is midnight, January 1, 1970, Greenwich Mean Time. Negative times extend to times before 1970, and positive numbers forward. Use of 64 bits allows a representation of times approximately in the
range of -30000 to the year 30000. There is a structural representation (i.e., exploded view), routines to acquire the current time from the host system, and convert them to and from the 64-bit and structural representation. Additionally there are routines to convert to and from most well-known forms of ASCII into the 64-bit NSPR representation. Memory management NSPR provides API to perform the basi...
NSPR Error Handling
s not connected. PR_LOAD_LIBRARY_ERROR Failure to load a dynamic library. PR_UNLOAD_LIBRARY_ERROR Failure to unload a dynamic library. PR_FIND_SYMBOL_ERROR Symbol could not be found in the specified library. PR_INSUFFICIENT_RESOURCES_ERROR There are insufficient system resources to process the request. PR_DIRECTORY_LOOKUP_ERROR A directory lookup on a network address has failed. PR_TPD_
RANGE_ERROR Attempt to access a thread-private data index that is out of
range of any index that has been allocated to the process. PR_PROC_DESC_TABLE_FULL_ERROR The process' table for holding open file descriptors is full. PR_SYS_DESC_TABLE_FULL_ERROR The system's table for holding open file descriptors has been exceeded. PR_NOT_SOCKET_ERROR An attempt to use a non-network file descriptor on a ...
...he requested operation is not supported by the platform. PR_PROTOCOL_NOT_SUPPORTED_ERROR The host operating system does not support the protocol requested. PR_REMOTE_FILE_ERROR Access to the remote file has been severed. PR_BUFFER_OVERFLOW_ERROR The value retrieved is too large to be stored in the buffer provided. PR_CONNECT_RESET_ERROR The (TCP) connection has been reset by the peer. PR_
RANGE_ERROR Unused. PR_DEADLOCK_ERROR Performing the requested operation would have caused a deadlock. The deadlock was avoided. PR_FILE_IS_LOCKED_ERROR An attempt to acquire a lock on a file has failed because the file is already locked. PR_FILE_TOO_BIG_ERROR Completing the write or seek operation would have resulted in a file larger than the system could handle. PR_NO_DEVICE_SPACE_ERROR The ...
NSS tools : crlutil
Time format (YYYYMMDDhhmmssZ). For example: 20050204153000Z * Add an extension to a CRL or a crl certificate entry: addext extension-name critical/non-critical [arg1[arg2 ...]] Where: extension-name: string value of a name of known extensions. critical/non-critical: is 1 when extension is critical and 0 otherwise. arg1, arg2: specific to extension type extension parameters addext uses the
range that was set earlier by addcert and will install an extension to every cert entries within the
range. * Add certificate entries(s) to CRL: addcert
range date
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. date: revocation date of a cert. Date should be ...
...* Add certificate entries(s) to CRL: addcert
range date
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. date: revocation date of a cert. Date should be represented in GeneralizedTime format (YYYYMMDDhhmmssZ). * Remove certificate entry(s) from CRL rmcert
range Where:
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a delimiter. Only one cert will be added if there is no delimiter. * Change
range of certificate entry(s) in CRL
range new-
range Where: new-
range: two integer values separated by dash:
range of certificates that will be added by this command. dash is used as a del...
JIT Optimization Outcomes
have flags that the optimization strategy cannot handle. For example, if the array has sparse indexes, or has indexes that overflow the array's length, the optimization strategy may fail. ArrayDoubleConversion The type-system indicates that some arrays at this site should be converted to packed arrays of doubles while others should not. The optimization strategy fails for this condition. Array
Range Could not accurately calculate the
range attributes of an inline array creation. ArraySeenNegativeIndex Arrays at this element access location have seen negative indexes. TypedObjectNeutered The typed object being accessed at this location may have been neutered (a neutered typed object is one where the underlying byte buffer has been removed or transferred to a worker). TypedObjectArrayRan...
... AccessNotDense AccessNotSimdObject The observed type of the target of the property access doesn't guarantee that it is an SIMD object. AccessNotTypedObject The observed type of the target of the property access doesn't guarantee that it is a TypedObject. ...
INT_FITS_IN_JSVAL
k in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Determines if a specified C integer is safe to pass to INT_TO_JSVAL. Syntax #define INT_FITS_IN_JSVAL(i) /* ... */ Name Type Description i jsint The C integer value to check. Description Determines if a specified C integer value, i, lies within the
range allowed for integer jsvals. If so, INT_FITS_IN_JSVAL returns TRUE, and i can be cast to jsval by calling INT_TO_JSVAL(i). Otherwise, INT_FITS_IN_JSVAL returns FALSE. In this case, the application can still convert i to a jsval using JS_NewNumberValue. Warning: The type of the argument i must be jsint, but the C/C++ compiler does not enforce type safety here. If i is an unsigned or 64-bit value, ...
...wrong answer. ...
JS::DeflateStringToUTF8Buffer
This article covers features introduced in SpiderMonkey 38 Encode the given string as UTF8 into given buffer. Syntax // New in JSAPI 52 void DeflateStringToUTF8Buffer(JSFlatString* src, mozilla::
RangedPtr<char> dst, size_t* dstlenp = nullptr, size_t* numcharsp = nullptr); // Obsolete in SpiderMonkey 49 void DeflateStringToUTF8Buffer(JSFlatString* src, mozilla::
RangedPtr<char> dst); Name Type Description src JSFlatString * The pointer to the string to deflate. dst mozilla::
RangedPtr<char> The
ranged pointer to the buffer. dstlenp size_t* The pointer to receive the number of bytes written to the buffer. numcharsp size_t* The pointer to receive the number of Unicode characte...
...xD83E, 0xDD8A, 0 }; JS::RootedString str(cx, JS_NewUCStringCopyN(cx, uchars, 2)); if (!str) return false; JS::Rooted<JSFlatString*> flatStr(cx, JS_FlattenString(cx, str)); if (!flatStr) return false; size_t length = JS::GetDeflatedUTF8StringLength(flatStr); char* buffer = static_cast<char*>(JS_malloc(cx, length + 1)); if (!buffer) return false; JS::DeflateStringToUTF8Buffer(flatStr, mozilla::
RangedPtr<char>(buffer, length)); buffer[length] = '\0'; printf("utf8: [%s]\n", buffer); JS_free(cx, buffer); See Also JS::GetDeflatedUTF8StringLength bug 1034627 bug 1271014 -- Added dstlenp and numcharsp ...
History Service Design
The primary objectives of the new History service implementation in Places are: Improve access to browsing history Allow association of useful metadata with urls Flexible query system for both end-users and add-ons developers Clean architecture for ease of code reuse and maintainability The most known and visible feature of history are views. The user can query his visits based on a date
range, meta contents or revisit behavior. This involves storing informations on all of the user's visits, including visit time, type of visit and meta data. Old history system was instead only storing first and last visit date, and a generic visits counter, creating some problem due to the impossibility to represent real history flow in a timeframe. History views must be organized and as concise as po...
...queries, to be executed on a separate thread. Actually pages and visits are expired: On page added (lazily) On idle On shutdown Expiration of pages happens when a page is no more referenced, so there are no more visits, nor bookmarks associated with it. Visits are expired based on user preferences, there is an hard limit on the minimum number of days that should be retained, visits in that
range won't never expire. Visits inside a slushy limit (> than the hard limit) will be removed only if we are over a maximum number of pages we can retain, for performance issues. Finally expiration can be forced by the user himself to clean up the full history or slices of it (last hour, last day, ...). See Places Expiration for more information. ...
IAccessibleAction
RESULT nActions([out,retval] long nActions ); [propget] HRESULT name([in] long actionIndex, [out] BSTR name ); Methods description() Returns a description of the specified action of the object. [propget] HRESULT description( [in] long actionIndex, [out] BSTR description ); Parameters actionIndex 0 based index specifying which action's description to return. If it lies outside the valid
range an empty string is returned. description The returned value is a localized string of the specified action. Return value E_INVALIDARG if bad [in] passed, [out] value is null. S_FALSE if there is nothing to return, [out] value is null. S_OK. doAction() Performs the specified Action on the object. HRESULT doAction( [in] long actionIndex ); Parameters actionIndex 0 based index specifying the act...
... returned value is a localized string of the specified action. Return value E_INVALIDARG if bad [in] passed, [out] value is null. S_FALSE if there is nothing to return, [out] value is null. S_OK. doAction() Performs the specified Action on the object. HRESULT doAction( [in] long actionIndex ); Parameters actionIndex 0 based index specifying the action to perform. If it lies outside the valid
range no action is performed. Return value E_INVALIDARG if bad [in] passed. S_OK. keyBinding() Returns an array of BSTRs describing one or more key bindings, if there are any, associated with the specified action. The returned strings are the localized human readable key sequences to be used to activate each action, e.g. "Ctrl+Shift+D". Since these key sequences are to be used when the object has focu...
inIDOMUtils
Rule); unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule); unsigned long getSelectorCount(in nsIDOMCSSStyleRule aRule); AString getSelectorText(in nsIDOMCSSStyleRule aRule, in unsigned long aSelectorIndex); unsigned long long getSpecificity(in nsIDOMCSSStyleRule aRule, in unsigned long aSelectorIndex); nsIDOMFontFaceList getUsedFontFaces(in nsIDOM
Range a
Range); bool hasPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass); boolean isIgnorableWhitespace(in nsIDOMCharacterData aDataNode); bool isInheritedProperty(in AString aPropertyName); void parseStyleSheet(in nsIDOMCSSStyleSheet aSheet, in DOMString aInput); void removePseudoClassLock(in nsIDOMElement aElement, in DOMString aPseud...
...n( in nsIDOMCSSStyleRule aRule ); Parameters aRule The style rule to retrieve the column number of. Return value The column number of the style rule; the URL of the rule can be obtained from its parent style sheet object. getUsedFontFaces() Returns a list of the fonts specified using @font-face in the specified portion of the document. nsIDOMFontFaceList getUsedFontFaces( in nsIDOM
Range a
Range ); Parameters a
Range The DOM
range to retrieve the font faces of. Return value An nsIDOMFontFaceList object listing all the font faces used by the text in the
range. isIgnorableWhitespace() Determines if the specified text node contains only ignorable whitespace characters. boolean isIgnorableWhitespace( in nsIDOMCharacterData aDataNode ); Parameters aDataNode A DOM Cha...
nsIAccessibleEditableText
t(in long position); void setAttributes(in long startPos, in long endPos, in nsISupports attributes); Unimplemented void setTextContents(in AString text); Attributes Attribute Type Description associatedEditor nsIEditor Returns an editor associated with the accessible. Read only. Native code only! Methods copyText() Copies the text
range into the clipboard. void copyText( in long startPos, in long endPos ); Parameters startPos Start offset of the text to be copied into the clipboard. endPos End offset of the text to be copied into the clipboard. Exceptions thrown NS_ERROR_FAILURE Indicates the text cannot be copied into the clipboard. cutText() Deletes a
range of text and copies it to the clipboard. void cu...
... void deleteText( in long startPos, in long endPos ); Parameters startPos Start offset of the text to be deleted. endPos End offset of the text to be deleted. Exceptions thrown NS_ERROR_FAILURE Indicates the text cannot be deleted. insertText() Inserts text at the specified position. ...
nsIAutoCompleteInput
and displays an autocomplete panel at the appropriate time. Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Method overview ACString getSearchAt(in unsigned long index); void onSearchBegin(); void onSearchComplete(); boolean onTextEntered(); boolean onTextReverted(); void selectText
Range(in long startIndex, in long endIndex); Attributes Attribute Type Description completeDefaultIndex boolean If a search result has its defaultIndex set, this will optionally try to complete the text in the textbox to the entire text of the result at the default index as the user types. This means that auto-fill is enabled. ...
... onSearchComplete(); Parameters None. onTextEntered() Called when the user selects and presses enter on a result item. boolean onTextEntered(); Parameters None. Return value Return true to prevent handling the selection. onTextReverted() Called when the user cancels the autocomplete session. boolean onTextReverted(); Parameters None. Return value Return true to prevent the reversion. selectText
Range() Selects a
range of text in the autocomplete text field. void selectText
Range( in long startIndex, in long endIndex ); Parameters startIndex The index to the first character in the text field to select. endIndex The index to the last character in the text field to select. ...
nsIDOMWindowUtils
d to avoid content bouncing around excessively as more content is loaded. screenPixelsPerCSSPixel float Returns the number of screen pixels per CSS pixel. Read only. audioMuted boolean With this it's possible to mute all the MediaElements in this window. We have audioMuted and audioVolume to preserve the volume across mute/umute. audioVolume float
Range: greater or equal to 0. The real volume level is affected by the volume of all ancestor windows. Constants Constant Value Description MODIFIER_ALT 0x0001 getModifierState("Alt") of the send event will return true if this is specified for aModifiers of send*Event() except sendNative*Event(). MODIFIER_CONTROL 0x0002 getModifierState("Control") o...
...of aAdditionalFlags of sendQueryContentEvent(). QUERY_CONTENT_FLAG_SELECTION_URLSTRIKEOUT 0x0400 One of values of aAdditionalFlags of sendQueryContentEvent(). QUERY_CONTENT_FLAG_OFFSET_RELATIVE_TO_INSERTION_POINT 0x0800 One of values of aAdditionalFlags of sendQueryContentEvent(). QUERY_SELECTED_TEXT 3200 QUERY_SELECTED_TEXT queries the first selection
range's information. QUERY_TEXT_CONTENT 3201 QUERY_TEXT_CONTENT queries the text at the specified
range. QUERY_CARET_RECT 3203 QUERY_CARET_RECT queries the (collapsed) caret rect of the offset. If the actual caret is there at the specified offset, this returns the actual caret rect. Otherwise, this guesses the caret rect from the metrics of the text. QUERY_TEXT...
nsINavHistoryQuery
n annotation is a little different. It also includes things that have never been visited. This allows place queries to be returned (which might include bookmark folders -- use the bookmark service's GetFolderURI) as well as anything else that may have been tagged with an annotation. This will only work for RESULTS_AS_URI since there will be no visits for these items. beginTime PRTime Begin time
range for results (INCLUSIVE). beginTimeReference long One of the constants TIME_RELATIVE_* which indicates how to interpret the corresponding begin time value. domain AUTF8String This is the host or domain name (controlled by domainIsHost). When domainIsHost, domain only does exact matching on host names. Otherwise, it will return anything whose host name ends in domain. This one is a little diffe...
...This one is a little different than most. Setting it to an empty string is a real query and will match any URI that has no host name (local files and such). Set this to NULL (in C++ use SetIsVoid) if you don't want domain matching. domainIsHost boolean This controls the meaning of domain, and whether it is an exact match domainIsHost = true, or hierarchical (= false). endTime PRTime End time
range for results (INCLUSIVE). endTimeReference long One of the constants TIME_RELATIVE_* which indicates how to interpret the corresponding end time value. folderCount long Read only: Count of folders. hasAnnotation boolean Read only: Whether or not, annotation exists. hasBeginTime boolean Read only: Whether or not, the corresponding begin time is considered. hasDomain boolean Read only: Whe...
nsINavHistoryQueryOptions
y the descending annotation order. SORT_BY_FRECENCY_ASCENDING 21 Sort by ascending frecency order. SORT_BY_FRECENCY_DESCENDING 22 Sort by descending frecency order. Result type constants Constant Value Description RESULTS_AS_URI 0 "URI" results, one for each URI visited in the
range. Individual result nodes will be of type "URI". RESULTS_AS_VISIT 1 "Visit" results, with one for each time a page was visited (this will often give you multiple results for one URI). Individual result nodes will have type "Visit". RESULTS_AS_FULL_VISIT 2 This is identical to RESULT_TYPE_VISIT except that individual result nodes will...
...YPE_VISIT except that individual result nodes will have type "FullVisit". This is used for the attributes that are not commonly accessed to save space in the common case (the lists can be very long). Note: Supported only for QUERY_TYPE_HISTORY. RESULTS_AS_DATE_QUERY 3 Returns nsINavHistoryQueryResultNode nodes for each predefined date
range where we had visits. Note: Supported only for QUERY_TYPE_HISTORY. RESULTS_AS_SITE_QUERY 4 Returns nsINavHistoryQueryResultNode nodes for each site where we have visits. Note: Supported only for QUERY_TYPE_HISTORY. RESULTS_AS_DATE_SITE_QUERY 5 Returns nsINavHistoryQueryResu...
nsIPlacesView
lection format into one the controller can understand. Views do this, and other things, by implementing the nsIPlacesView interface. Note: nsIPlacesView does not exist in IDL at the moment. It's currently implemented directly on each of the built-in Places views. Method overview nsINavHistoryResultNode[] getDragableSelection(); nsINavHistoryResultNode[][] getRemovableSelection
Ranges(); nsINavHistoryResult getResult(); nsINavHistoryContainerResultNode getResultNode(); nsINavHistoryResultNode[] getSelectionNodes(); void selectAll(); Attributes Attribute Type Description hasSelection boolean Whether or not there are selected items. Read only. insertionPoint InsertionPoint The InsertionPoin...
...oryResultNode The selected node in the view. If there are multiple selected nodes, this is null. Read only. Methods getDragableSelection() Returns an array of selected nsINavHistoryResultNode objects that can be dragged from the view. nsINavHistoryResultNode[] getDragableSelection(); Parameters None. Return value An array of nsINavHistoryResultNode objects. getRemovableSelection
Ranges() Returns an array whose elements are themselves arrays of nsINavHistoryResultNode objects that can be removed from the view. Each inner array represents a contiguous
range of nodes that can be removed. nsINavHistoryResultNode[][] getRemovableSelection
Ranges(); Parameters None. Return value An array of arrays of nsINavHistoryResultNode objects. getResult() Returns the nsINavHistoryResul...
NS_CStringAppendData
nto this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null-terminated. Return Values The NS_CStringAppendData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_CStringSetData
Range. ...
...CStringSetData
Range. Example nsCStringContainer str; NS_CStringContainerInit(str); NS_CStringSetData(str, "hello"); NS_CStringAppendData(str, " world"); const char* data; NS_CStringGetData(str, &data); printf("%s\n", data); // prints out "hello world" NS_CStringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. ...
NS_CStringCutData
section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. Pass PR_UINT32_MAX to specify the length from aCutStart to the end of the string. Return Values The NS_CStringCutData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_CStringSetData
Range . Example Code nsCStringContainer str; NS_CStringContainerInit(str); NS_CStringSetData(str, "hello world"); // remove " world" portion of string NS_CStringCutData(str, 5, PR_UINT32_MAX); const char* data; NS_CStringGetData(str, &data); printf("%s\n", data); // prints out "hello" NS_CStringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 23912...
...; NS_CStringContainerInit(str); NS_CStringSetData(str, "hello world"); // remove " world" portion of string NS_CStringCutData(str, 5, PR_UINT32_MAX); const char* data; NS_CStringGetData(str, &data); printf("%s\n", data); // prints out "hello" NS_CStringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_CStringSetData
Range , nsACString ...
NS_CStringInsertData
copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_CStringInsertData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_CStringSetData
Range. Example Code nsCStringContainer str; NS_CStringContainerInit(str); NS_CStringSetData(str, "hello"); NS_CStringInsertData(str, 5, " world"); const char* data; NS_CStringGetData(str, &data); printf("%s\n", data); // prints out "hello world" NS_CStringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_CStringSetData...
.... ...
NS_StringAppendData
py into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_StringAppendData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_StringSetData
Range Note: GCC requires the -fshort-wchar option to compile this example since PRUnichar is an unsigned short. This example should compile by default under MSVC. Example Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello"); NS_StringAppendData(str, L" world"); const PRUnichar* data; NS_StringGetData(str, &data); // data now points to the string: ...
.... ...
NS_StringCutData
ection to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. Pass PR_UINT32_MAX to specify the length from aCutStart to the end of the string. Return Values The NS_StringCutData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_StringSetData
Range. Note: GCC requires the -fshort-wchar option to compile this example since PRUnichar is an unsigned short. This example should compile by default under MSVC. Example Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello world"); // remove " world" portion of string NS_StringCutData(str, 5, PR_UINT32_MAX); const PRUnichar* data; NS_StringGetData...
... NS_StringContainerInit(str); NS_StringSetData(str, L"hello world"); // remove " world" portion of string NS_StringCutData(str, 5, PR_UINT32_MAX); const PRUnichar* data; NS_StringGetData(str, &data); // data now ponts to the string: L"hello" NS_StringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_StringSetData
Range, nsAString ...
NS_StringInsertData
py into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_StringInsertData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_StringSetData
Range . Note: GCC requires the -fshort-wchar option to compile this example since PRUnichar is an unsigned short. This example should compile by default under MSVC. Example Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello"); NS_StringInsertData(str, 5, L" world"); const PRUnichar* data; NS_StringGetData(str, &data); // data now points to the str...
...Example Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello"); NS_StringInsertData(str, 5, L" world"); const PRUnichar* data; NS_StringGetData(str, &data); // data now points to the string: L"hello world" NS_StringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_StringSetData
Range , nsACString ...
XPCOM string functions
.NS_CStringGetMutableDataThe NS_CStringGetMutableData function gives the caller write access to the string's internal buffer.NS_CStringInsertDataThe NS_CStringInsertData function appends data to the existing value of a nsACString instance. This is a low-level API.NS_CStringSetDataThe NS_CStringSetData function copies data into the string's internal buffer. This is a low-level API.NS_CStringSetData
RangeThe NS_CStringSetData
Range function copies data into a section of the string's internal buffer. This is a low-level API.NS_CStringToUTF16The NS_CStringToUTF16 function converts the value of a nsACString instance to UTF-16 and stores the result in a nsAString instance. NS_StringAppendDataThe NS_StringAppendData function appends data to the existing value of a nsAString instance. This is a low-l...
...PI.NS_StringGetDataThe NS_StringGetData function gives the caller access to the string's internal buffer. This is a low-level API.NS_StringInsertDataThe NS_StringInsertData function appends data to the existing value of a nsACString instance. This is a low-level API.NS_StringSetDataThe NS_StringSetData function copies data into the string's internal buffer. This is a low-level API.NS_StringSetData
RangeThe NS_StringSetData
Range function copies data into a section of the string's internal buffer. This is a low-level API.NS_UTF16ToCStringThe NS_UTF16ToCString function converts the value of a nsAString instance from UTF-16 to the specified multi-byte encoding and stores the result in a nsACString instance. ...
Plug-in Development Overview - Plugins
This message, which is in HTML format, is displayed by the browser in its "About Plug-ins" page. String 2 can contain the name of the plug-in, thus allowing the name the user sees to be different from the name of the file on disk. Drawing a Plug-in Instance Before drawing itself on the page, the plug-in must provide information about itself, set the window or other target in which it draws, ar
range for redrawing, and handle events. A windowless plug-in can call the following Netscape methods to draw itself: NPN_ForceRedraw: Force a paint message for windowless plug-ins. NPN_InvalidateRect: Invalidate an area in a windowless plug-in before repainting or refreshing. NPN_InvalidateRegion: Invalidate an area in a windowless plug-in before repainting or refreshing. The browser calls thes...
... identifying the format of the data in the stream. Streams produced by the browser can be automatically sent to the plug-in instance or requested by the plug-in. The plug-in can select one of these transmission modes: Normal mode: the browser sends the stream data sequentially to the plug-in as the data becomes available. Random-access mode: the browser allows the plug-in to request specific
ranges of bytes from anywhere in the stream. This mode requires server support. File mode: the browser saves the data to a local file in cache and passes that file path to the plug-in. Streams produced by the plug-in to send to the browser are like normal-mode streams produced by the browser, but in reverse. In the browser's normal-mode streams, the browser calls the plug-in to inform it that the st...
Structures - Plugins
NPEmbedPrint Substructure of NPPrint that contains platform-specific information used during embedded mode printing. ...
... NPEmbedPrint Substructure of NPPrint that contains platform-specific information used during embedded mode printing. ...
Gecko Plugin API Reference - Plugins
r plug-in thread (the thread on which the plug-in was initiated). NPN_PopPopupsEnabledState Pops the popups-enabled state. NPN_PostURL Posts data to a URL. NPN_PostURLNotify Posts data to a URL, and receives notification of the result. NPN_PushPopupsEnabledState Pushes the popups-enabled state. NPN_ReloadPlugins Reloads all plug-ins in the Plugins directory. NPN_RequestRead Requests a
range of bytes for a seekable stream. NPN_SetValue Sets windowless plug-in as transparent or opaque. NPN_SetValueForURL Allows a plug-in to change the stored information associated with a URL, in particular its cookies. NPN_Status Displays a message on the status line of the browser window. NPN_UserAgent Returns the browser's user agent field. NPN_Version Returns version information for the P...
... NPN_UTF8FromIdentifier NPN_IntFromIdentifier NPObject NPN_CreateObject NPN_RetainObject NPN_ReleaseObject NPN_Invoke NPN_InvokeDefault NPN_Evaluate NPN_GetProperty NPN_SetProperty NPN_RemoveProperty NPN_HasProperty NPN_HasMethod NPN_SetException NPClass Structures NPAnyCallbackStruct NPByte
Range NPEmbedPrint NPEvent NPFullPrint NPP NP_Port NPPrint NPPrintCallbackStruct NPRect NPRegion NPSavedData NPSetWindowCallbackStruct NPStream NPWindow Constants Error Codes Result Codes Plug-in Version Constants Version Feature Constants External resources External projects and articles for plugin creation Original document information Copyright Information: Netscape C...
ANGLE_instanced_arrays.drawArraysInstancedANGLE() - Web APIs
Note: When using WebGL2, this method is available as gl.drawArraysInstanced() by default. Syntax void ext.drawArraysInstancedANGLE(mode, first, count, primcount); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. ...
...e last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. first A GLint specifying the starting index in the array of vector points. count A GLsizei specifying the number of indices to be rendered. primcount A GLsizei specifying the number of instances of the
range of elements to execute. Return value None. Exceptions If mode is not one of the accepted values, a gl.INVALID_ENUM error is thrown. If first, count or primcount are negative, a gl.INVALID_VALUE error is thrown. if gl.CURRENT_PROGRAM is null, a gl.INVALID_OPERATION error is thrown. Examples var ext = gl.getExtension('ANGLE_instanced_arrays'); ext.drawArraysInstancedANGLE(gl.POINTS, 0, ...
AnalyserNode.smoothingTimeConstant - Web APIs
de interface is a double value representing the averaging constant with the last analysis frame. It's basically an average between the current buffer and the last buffer the AnalyserNode processed, and results in a much smoother set of value changes over time. Syntax var smoothValue = analyserNode.smoothingTimeConstant; analyserNode.smoothingTimeConstant = newValue; Value A double within the
range 0 to 1 (0 meaning no time averaging). The default value is 0.8. If 0 is set, there is no averaging done, whereas a value of 1 means "overlap the previous and current buffer quite a lot while computing the value", which essentially smoothes the changes across AnalyserNode.getFloatFrequencyData/AnalyserNode.getByteFrequencyData calls. In technical terms, we apply a Blackman window and smooth the ...
...g done, whereas a value of 1 means "overlap the previous and current buffer quite a lot while computing the value", which essentially smoothes the changes across AnalyserNode.getFloatFrequencyData/AnalyserNode.getByteFrequencyData calls. In technical terms, we apply a Blackman window and smooth the values over time. The default value is good enough for most cases. Note: If a value outside the
range 0-1 is set, an INDEX_SIZE_ERR exception is thrown. Example The following example shows basic usage of an AudioContext to create an AnalyserNode, then requestAnimationFrame and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js line...
AnalyserNode - Web APIs
representing the size of the FFT (Fast Fourier Transform) to be used to determine the frequency domain. AnalyserNode.frequencyBinCount Read only Is an unsigned long value half that of the FFT size. This generally equates to the number of data values you will have to play with for the visualization. ...
...BinCount Read only Is an unsigned long value half that of the FFT size. This generally equates to the number of data values you will have to play with for the visualization. AnalyserNode.minDecibels Is a double value representing the minimum power value in the scaling
range for the FFT analysis data, for conversion to unsigned byte values -- basically, this specifies the minimum value for the
range of results when using getByteFrequencyData(). AnalyserNode.maxDecibels Is a double value representing the maximum power value in the scaling
range for the FFT analysis data, for conversion to unsigned byte values -- basically, this specifies the maximum value for the
range of results when using getByteFrequencyData(). AnalyserNode.smoothingTimeConstant Is a double value representing the avera...
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
de object instance. Syntax var audioBufferSourceNode = new AudioBufferSourceNode(context, options) Parameters Inherits parameters from the AudioNodeOptions dictionary. context A reference to an AudioContext. options Optional Options are as follows: buffer: An instance of AudioBuffer to be played. detune: A value in cents to modulate the speed of audio stream rendering. Its nominal
range is (-? to +?). The default is 0. loop: A boolean indicating whether the audio should play in a loop. The default is false. If the loop is dynamically modified during playback, the new value will take effect on the next processing block of audio. loopEnd: An optional value, in seconds, where looping should end if the loop attribute is true. The default is 0. Its value is exclusive to the conte...
...bute is converted to an exact sample frame offset within the buffer, by multiplying by the buffer's sample rate and rounding to the nearest integer value. Thus, its behavior is independent of the value of the playbackRate parameter. playbackRate: The speed at which to render the audio stream. Its default value is 1. This parameter is k-rate. This is a compound parameter with detune. Its nominal
range is (-? to +?). Return value A new AudioBufferSourceNode object instance. Specifications Specification Status Comment Web Audio APIThe definition of 'AudioBufferSourceNode()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribut...
AudioBufferSourceNode.playbackRate - Web APIs
AudioData() function is used to decode an audio track, and put it into an AudioBufferSourceNode. Buttons are provided to play and stop the audio playback, and a slider control is used to change the playbackRate property value on the fly. You can run the example live (or view the source.) Play the song and alter the playback rate for some fun results. ...
... audioCtx.decodeAudioData(audioData, function(buffer) { myBuffer = buffer; source.buffer = myBuffer; source.playbackRate.value = playbackControl.value; source.connect(audioCtx.destination); source.loop = true; }, function(e){"Error with decoding audio data" + e.err}); } request.send(); } // wire up buttons to stop and play audio, and
range slider control play.onclick = function() { getData(); source.start(0); play.setAttribute('disabled', 'disabled'); playbackControl.removeAttribute('disabled'); } stop.onclick = function() { source.stop(0); play.removeAttribute('disabled'); playbackControl.setAttribute('disabled', 'disabled'); } playbackControl.oninput = function() { source.playbackRate.value = playbackControl.va...
AudioParam.maxValue - Web APIs
The default value of maxValue is the maximum positive single-precision floating-point value (+340,282,346,638,528,859,811,704,183,484,516,925,440). ...
... The default value of maxValue is the maximum positive single-precision floating-point value (+340,282,346,638,528,859,811,704,183,484,516,925,440). ...
AudioParam.minValue - Web APIs
The default value of minValue is the minimum negative single-precision floating-point value (-340,282,346,638,528,859,811,704,183,484,516,925,440). ...
... The default value of minValue is the minimum negative single-precision floating-point value (-340,282,346,638,528,859,811,704,183,484,516,925,440). ...
AudioWorkletProcessor.process - Web APIs
isActivelyProcessing = audioWorkletProcessor.process(inputs, outputs, parameters); Parameters inputs An array of inputs connected to the node, each item of which is, in turn, an array of channels. Each channel is a Float32Array containing 128 samples. For example, inputs[n][m][i] will access n-th input, m-th channel of that input, and i-th sample of that channel. Each sample value is in
range of [-1 .. 1]. The number of inputs and thus the length of that array is fixed at the construction of the node (see AudioWorkletNodeOptions). If there is no active node connected to the n-th input of the node, inputs[n] will be an empty array (zero input channels available). The number of channels in each input may vary, depending on channelCount and channelCountMode properties. outputs An...
...e customGain parameter. ...
CanvasRenderingContext2D.arcTo() - Web APIs
s too large for the arc to fit entirely below the starting point. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(180, 90); ctx.arcTo(180,130, 110,130, 130); ctx.lineTo(110, 130); ctx.stroke(); Result Live demo More sophisticated demo of the method. ...
...onst canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(180, 90); ctx.arcTo(180,130, 110,130, 130); ctx.lineTo(110, 130); ctx.stroke(); Result Live demo More sophisticated demo of the method. You can play around with
range input to see how arc changes. ...
ConstrainDouble - Web APIs
The ConstrainDouble type is used to specify a constraint for a property whose value is a double-precision floating-point number. It extends the Double
Range dictionary (which provides the ability to specify a permitted
range of property values) to also support an exact value and/or an ideal value the property should take on. Additionally, you can specify the property's value as a simple floating-point value, in which case the user agent does its best to match the value once all other more stringent constraints are met. Properties If the value of a ConstrainDouble is an object rather than a number, it may have the properties below in addition the properties it inherits from Double
Range. exact A double-precision floating-point number specifying a specific, required, value the property must ...
...y would ideally have, but which can be considered optional if necessary to find a match. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'ConstrainDouble' in that specification. Candidate Recommendation Initial definition Technically, ConstrainDouble is actually based on an intermediary dictionary named ConstrainDouble
Range, which adds exact and ideal to Double
Range, with ConstrainDouble being a type that can be either a long integer or a Double
Range. However, for the sake of documentation clarity, the intermediate type (present only because of quirks in WebIDL syntax) is ignored here. ...
ConstrainULong - Web APIs
The ConstrainULong type is used to specify a constraint for a property whose value is an integral number. It extends the ULong
Range dictionary (which provides the ability to specify a permitted
range of property values) to also support an exact value and/or an ideal value the property should take on. In addition, you can specify the value as a simple long integer value, in which case the user agent does its best to match the value once all other more stringent constraints are met. Properties If the value of a ConstrainULong is an object rather than a number, it may have the properties below in addition to the properties it inherits from ULong
Range. exact An integer specifying precise, required, value the property must have to be considered acceptable. ideal An integer specifying a valu...
...erty would ideally have, but which can be considered optional if necessary to find a match. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'ConstrainULong' in that specification. Candidate Recommendation Initial definition Technically, ConstrainULong is actually based on an intermediary dictionary named ConstrainULong
Range, which adds exact and ideal to ULong
Range, with ConstrainULong being a type that can be either a long integer or a ULong
Range. However, for the sake of documentation clarity, the intermediate type (present only because of quirks in WebIDL syntax) is ignored here. ...
Binary strings - Web APIs
memory and is able to represent 65535 different code points. A subset of these strings is represented by UTF-16 strings containing only ASCII characters (i.e., characters whose code point does not exceed 127). For instance, the string "Hello world!" belongs to the ASCII subset, while the string "AEIOU" does not. A binary string is a concept similar to the ASCII subset, but instead of limiting the
range to 127, it allows code points until 255. Its purpose however is not to represent characters, but binary data. The size of the data so represented is twice as big as it would be in normal binary format, however this will not be visible to the final user, since the length of JavaScript strings is calculated using two bytes as the unit. Binary strings are not part of the JavaScript language design.
... normal binary format, however this will not be visible to the final user, since the length of JavaScript strings is calculated using two bytes as the unit. Binary strings are not part of the JavaScript language design. However at least one native function requires binary strings as its input, btoa(): invoking it on a string that contains codepoints greater than 255 will cause a Character Out Of
Range error. The reason that brought to use UTF-16 code units as placeholders for uint8 numbers is that as web applications become more and more powerful (adding features such as audio and video manipulation, access to raw data using WebSockets, and so forth) it has become clear that there are times when it would be helpful for JavaScript code to be able to quickly and easily manipulate raw binary dat...
DataTransfer - Web APIs
.setDragImage() Set the image to be used for dragging if a custom one is desired. Gecko methods Note: All of the methods in this section are Gecko-specific. DataTransfer.addElement() Sets the drag source to the given element. Deprecated methods DataTransfer.mozClearDataAt() Removes the data associated with the given format for an item at the specified index. The index is in the
range from zero to the number of items minus one. Removed in Firefox 71. DataTransfer.mozGetDataAt() Retrieves the data associated with the given format for an item at the specified index, or null if it does not exist. The index should be in the
range from zero to the number of items minus one. Removed in Firefox 71. DataTransfer.mozSetDataAt() A data transfer may store multiple items, each at ...
...etDataAt() may only be called with an index argument less than mozItemCount in which case an existing item is modified, or equal to mozItemCount in which case a new item is added, and the mozItemCount is incremented by one. Removed in Firefox 71. DataTransfer.mozTypesAt() Holds a list of the format types of the data that is stored for an item at the specified index. If the index is not in the
range from 0 to the number of items minus one, an empty string list is returned. Removed in Firefox 71. Examples Every method and property listed in this document has its own reference page and each reference page either directly includes an example of the interface or has a link to an example. Specifications Specification Status Comment HTML Living StandardThe definition o...
DocumentOrShadowRoot.getSelection() - Web APIs
The getSelection() property of the DocumentOrShadowRoot interface returns a Selection object representing the
range of text selected by the user, or the current position of the caret. Syntax var selection = documentOrShadowRootInstance.getSelection() Parameters None. Returns A Selection object. Example function foo() { var selObj = document.getSelection(); alert(selObj); var sel
Range = selObj.get
RangeAt(0); // do stuff with the
range } Notes String representation of the Selection object In JavaScript, when an object is passed to a function expecting a string (like Window.alert()), the object's toString() method is called and the returned value is passed to the function. This can make the object appear to be a string when used with other functions when it is...
..., call its toString() method directly: var selectedText = selObj.toString(); selObj is a Selection object. selectedText is a string (Selected text). Related objects You can call Window.getSelection(), which works identically to Document.getSelection(). It is worth noting that currently getSelection() doesn't work on the content of <input> elements in Firefox. HTMLInputElement.setSelection
Range()) could be used to work around this. Notice also the difference between selection and focus. Document.activeElement returns the focused element. Specifications Specification Status Comment Shadow DOMThe definition of 'DocumentOrShadowRoot' in that specification. Obsolete Initial definition. Browser Compatibility The compatibility table on this page is ge...
Document Object Model (DOM) - Web APIs
To achieve this, the following interfaces present in the different DOM level 3 or earlier specifications have been removed. It is uncertain whether some may be reintroduced in the future or not, but for the time being the...
...To achieve this, the following interfaces present in the different DOM level 3 or earlier specifications have been removed. It is uncertain whether some may be reintroduced in the future or not, but for the time being they should be considered obsolete and should be a...
DynamicsCompressorNode() - Web APIs
hat can occur when multiple sounds are played and multiplexed together at once. Syntax var dynamicsCompressorNode = new DynamicsCompressorNode(context, options) Parameters context A reference to an AudioContext. options Optional Options are as follows: attack: The amount of time (in seconds) to reduce the gain by 10dB. Its default value is 0.003. This parameter is k-rate. Its nominal
range is [0, 1]. knee: A decibel value representing the
range above the threshold where the curve smoothly transitions to the "ratio" portion. Its default value is 30. This parameter is k-rate. Its nominal
range is [0, 40]. ratio: The amount of dB change in input for a 1 dB change in output. Its default value is 12. This parameter is k-rate. Its nominal
range is [1, 20]. release: The amount of ti...
...ons to the "ratio" portion. Its default value is 30. This parameter is k-rate. Its nominal
range is [0, 40]. ratio: The amount of dB change in input for a 1 dB change in output. Its default value is 12. This parameter is k-rate. Its nominal
range is [1, 20]. release: The amount of time (in seconds) to increase the gain by 10dB. Its default value is 0.250. This parameter is k-rate. Its nominal
range is [0, 1]. threshold: The decibel value above which the compression will start taking effect. Its default value is -24. This parameter is k-rate. Its nominal
range is [-100, 0]. Specifications Specification Status Comment Web Audio APIThe definition of 'DynamicsCompressorNode()' in that specification. Working Draft Initial definition. Browser Compatib...
EffectTiming.delay - Web APIs
nds }; timingProperties.delay = delayInMilliseconds; Value A number specifying the delay, in milliseconds, from the start of the animation's play cycle to the beginning of its active interval (the time index at which actual animation begins). Defaults to 0. ...
... actual animation begins). Defaults to 0. Examples In the Pool of Tears example, each tear is passed a random delay via its timing object: // Randomizer function var getRandomMs
Range = function(min, max) { return Math.random() * (max - min) + min; } // Loop through each tear tears.forEach(function(el) { // Animate each tear el.animate( tearsFalling, { delay: getRandomMs
Range(-1000, 1000), // randomized for each tear duration: getRandomMs
Range(2000, 6000), // randomized for each tear iterations: Infinity, easing: "cubic-bezier(0.6, 0.04, 0.98, 0.335)" }); }); Specifications Specification Status Comment Web AnimationsThe definition of 'delay' in that specification. Working Draft Editor's draft. ...
EffectTiming.duration - Web APIs
nto account the duration of any child effects. Consider using "auto" rather than 0 if that makes sense. Exceptions TypeError The specified value is either a string other than "auto", a number less than zero, NaN, or some other type of object entirely. ...
...or some other type of object entirely. Examples In the Pool of Tears example, each tear is passed a random duration via its timing object: // Randomizer function var getRandomMs
Range = function(min, max) { return Math.random() * (max - min) + min; } // Loop through each tear tears.forEach(function(el) { // Animate each tear el.animate( tearsFalling, { delay: getRandomMs
Range(-1000, 1000), // randomized for each tear duration: getRandomMs
Range(2000, 6000), // randomized for each tear iterations: Infinity, easing: "cubic-bezier(0.6, 0.04, 0.98, 0.335)" }); }); Specifications Specification Status Comment Web AnimationsThe definition of 'duration' in that specification. Working Draft Editor's draft. ...
Element: mouseout event - Web APIs
Event handler property onmouseout Examples The following examples show the use of the mouseout event. mouseout and mouseleave The following example illustrates the difference between mouseout and mouseleave events. The mouseleave event is added to the <ul> to color the list purple whenever the mouse exits the <ul>. mouseout is added to the list to color the targeted element o
range when the mouse exits it. When you try this out, you'll find that mouseout is delivered to the individual list items, while mouseleave goes to the overall list, courtesy of the hierarchy of the items and the fact that list items obscure the underlying <ul>. HTML <ul id="test"> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> JavaScript let test = document.getElementById("test"); ...
...st = document.getElementById("test"); // Briefly make the list purple when the mouse moves off the // <ul> element test.addEventListener("mouseleave", function( event ) { // highlight the mouseleave target event.target.style.color = "purple"; // reset the color after a short delay setTimeout(function() { event.target.style.color = ""; }, 1000); }, false); // Briefly make an <li> o
range when the mouse moves off of it test.addEventListener("mouseout", function( event ) { // highlight the mouseout target event.target.style.color = "o
range"; // reset the color after a short delay setTimeout(function() { event.target.style.color = ""; }, 500); }, false); Result Specifications Specification Status UI EventsThe definition of 'mouseout' in t...
FontFace.FontFace() - Web APIs
at will be used as the font face value for font properties. Takes the same type of values as the font-family descriptor of @font-face . source The font source. This can be either: A URL Binary font data descriptors Optional A set of optional descriptors passed as an object. ...
... as the font face value for font properties. Takes the same type of values as the font-family descriptor of @font-face . source The font source. This can be either: A URL Binary font data descriptors Optional A set of optional descriptors passed as an object. ...
HTMLInputElement.stepDown() - Web APIs
te or up to n multiples of the step attribute if a number is passed as the parameter. The method, when invoked, decrements the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified. Valid on all numeric, date, and time input types that support the step attribute, includingdate, month, week, time, datetime-local, number, and
range. Given <input id="myTime" type="time" max="17:00" step="900" value="17:00">, invoking myTime.step(3) will change the value to 16:15, decrementing the time by 3 * 900, or 45 minutes. myTime.step(), with no parameter, would have resulted in 16:45, as n defaults to 1. <!-- decrements by intervals of 900 seconds (15 minute) --> <input type="time" max="17:00" step="900"> <!-- decrements by interva...
...{ border: red solid 3px; } Result Note if you don't pass a parameter to the stepDown() method, it defaults to 1. Any other value is a multiplier of the step attribute value, which in this case is 5. If we pass 4 as the stepDecrement, the input will stepDown by 4 * 5, or 20. If the parameter is 0, the number will not be decremented. The stepDown() method will not allow the input to go out of
range, in this case stopping when it reaches 0 and rounding down and floats that are passed as a parameter. Try setting the step decrementer to 1.2. What happens when you invoke the method? Try setting the value to 44, which is not valid. What happens when you invoke the method? Specifications Specification Status Comment HTML Living StandardThe definition of 'stepDown()...
HTMLMediaElement.seekable - Web APIs
The seekable read-only property of the HTMLMediaElement returns a Time
Ranges object that contains the time
ranges that the user is able to seek to, if any. Syntax var seekable = audioOrVideo.seekable; Value A Time
Ranges object. Examples var video = document.querySelector("video"); var time
RangesObject = video.seekable; var time
Ranges = []; //Go through the object and output an array for (let count = 0; count < time
RangesObject.length; count ++) { time
Ranges.push([time
RangesObject.start(count), time
RangesObject.end(count)]); } Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement' in that specifi...
...HTMLMediaElement' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement' in that specification. Recommendation Initial definition. Media Source ExtensionsThe definition of 'HTMLMediaElement extensions, like for seekable' in that specification. Recommendation Specifies a new algorithm for returning the seekable time
range of a media element whose source is a MediaSource object. ...
IDBCursorSync - Web APIs
BCursorSync interface of the IndexedDB API represents a cursor for iterating over multiple records in a database. You can have only one instance of IDBCursorSync representing a cursor, but you can have an unlimited number of cursors at the same time. Operations are performed on the underlying index or object store. It enables an application to synchronously process all the records in the cursor's
range. Method overview bool continue (in optional any key); void remove () raises (IDBDatabaseException); Attributes Attribute Type Description count readonly unsigned long long The total number of objects that share the current key. direction readonly unsigned short The direction of traversal of the cursor. See Constants for ...
...EV_NO_DUPLICATE 3 This cursor does not include duplicates, and its direction is monotonically decreasing in the order of keys. Methods continue() Advances the cursor to the next position along its direction, to the item whose key matches the optional key parameter. If no key is specified, advance to the immediate next position. Returns false if the cursor has reached the end of its
range; otherwise returns true. bool continue ( in optional any key ); Parameters key The key to which to move the cursor's position. remove() Deletes the record at the cursor's position, without changing the cursor's position void delete ( ) raises (DatabaseException); Exceptions This method can raise an IDBDatabaseException with the following code: NOT_ALLOWED_ERR If the underlying...
IDBIndex.get() - Web APIs
The get() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is set to an IDBKey
Range. If a value is found, then a structured clone of it is created and set as the result of the request object: this returns the record the key is associated with. Note: This feature is available in Web Workers. Syntax var request = myIndex.get(key); Parameters key Optional A key or IDBKey
Range that identifies the record to be retrieved. If this value is null or missing, the browser will use an unbound key
range. Return value An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method ...
... InvalidStateError The IDBIndex has been deleted or removed. Example In the following example we open a transaction and an object store, then get the index lName from a simple contacts database. ...
IDBIndex.getKey() - Web APIs
The getKey() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, finds either the primary key that corresponds to the given key in this index or the first corresponding primary key, if key is set to an IDBKey
Range. If a primary key is found, it is set as the result of the request object. Note that this doesn't return the whole record as IDBIndex.get does. Note: This feature is available in Web Workers. Syntax var request = myIndex.getKey(key); Parameters key Optional A key or IDBKey
Range that identifies a record to be retrieved. If this value is null or missing, the browser will use an unbound key
range. Return value An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMEx...
... InvalidStateError The IDBIndex has been deleted or removed. Example In the following example we open a transaction and an object store, then get the index lName from a simple contacts database. ...
IDBObjectStore.delete() - Web APIs
The delete() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, deletes the specified record or records. Either a key or an IDBKey
Range can be passed, allowing one or multiple records to be deleted from a store. To delete all records in a store, use IDBObjectStore.clear. Bear in mind that if you are using a IDBCursor, you can use the IDBCursor.delete() method to more efficiently delete the current record -- without having to explicitly look up the record's key. Note: This feature is available in Web Workers. Syntax var request = objectStore.delete(Key); var request = objectStore.delete(Key
Range); Parameters Key The key of the record to be deleted, or an IDBKey
Range to delete all records with keys in
range. Return value An IDBReques...
... Exceptions This method may raise a DOMException of the following types: Exception Description TransactionInactiveError This object store's transaction is inactive. ReadOnlyError The object store's transaction mode is read-only. InvalidStateError The object store has been deleted. DataError The key is not a valid key or a key
range. Example In the following code snippet, we open a read/write transaction on our database and delete one specific record out of our object store using delete() -- a sample record with the key "Walk dog". For a full working example, see our To-do Notifications app (view example live.) // Let us open our database var DBOpenRequest = window.indexedDB.open("toDoList", 4); DBOpenRequest.o...
IDBObjectStore.get() - Web APIs
same result for: a) a record that doesn't exist in the database and b) a record that has an undefined value. To tell these situations apart, call the openCursor() method with the same key. That method provides a cursor if the record exists, and no cursor if it does not. Note: This feature is available in Web Workers. ...
... InvalidStateError The IDBObjectStore has been deleted or removed. Example In the following code snippet, we open a read/write transaction on our database and get one specific record from object store using get() -- a sample record with the key "Walk dog". ...
IDBObjectStore.getAll() - Web APIs
openCursor() method with the same key. That method provides a cursor if the record exists, and no cursor if it does not. the count() method with the same key, which will return 1 if the row exists and 0 if it doesn't. Syntax var request = objectStore.getAll(); var request = objectStore.getAll(query); var request = objectStore.getAll(query, count); Parameters query Optional A key or IDBKey
Range to be queried. If nothing is passed, this will default to a key
range that selects all the records in this object store. count Optional Specifies the number of values to return if more than one is found. If it is lower than 0 or greater than 232-1 a TypeError exception will be thrown. Return value An IDBRequest object on which subsequent events related to this operation are fired. Exception...
...ter than 232-1 a TypeError exception will be thrown. Return value An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description TransactionInactiveError This IDBObjectStore's transaction is inactive. DataError The key or key
range provided contains an invalid key or is null. InvalidStateError The IDBObjectStore has been deleted or removed. A TypeError exception is thrown if the count parameter is not between 0 and 232-1 included. Specifications Specification Status Comment Indexed Database API DraftThe definition of 'getAll()' in that specification. Recommendation ...
IDBObjectStore.getAllKeys() - Web APIs
value To tell these situations apart, you need to call the openCursor() method with the same key. That method provides a cursor if the record exists, and no cursor if it does not. Syntax var request = objectStore.getAllKeys(); var request = objectStore.getAllKeys(query); var request = objectStore.getAllKeys(query, count); Parameters query Optional A value that is or resolves to an IDBKey
Range. count Optional Specifies the number of values to return if more than one is found. If it is lower than 0 or greater than 232-1 a TypeError exception will be thrown. Return value An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description T...
...ter than 232-1 a TypeError exception will be thrown. Return value An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description TransactionInactiveError This IDBObjectStore's transaction is inactive. DataError The key or key
range provided contains an invalid key or is null. InvalidStateError The IDBObjectStore has been deleted or removed. Specifications Specification Status Comment Indexed Database API DraftThe definition of 'getAllKeys()' in that specification. Recommendation Initial definition ...
IDBObjectStore.openCursor() - Web APIs
iterating through an object store with a cursor. To determine if the add operation has completed successfully, listen for the results's success event. Note: This feature is available in Web Workers. Syntax var request = ObjectStore.openCursor(); var request = ObjectStore.openCursor(query); var request = ObjectStore.openCursor(query, direction); Parameters query Optional A key or IDBKey
Range to be queried. If a single valid key is passed, this will default to a
range containing only that key. If nothing is passed, this will default to a key
range that selects all the records in this object store. direction Optional An IDBCursorDirection telling the cursor what direction to travel. Valid values are "next", "nextunique", "prev", and "prevunique". The default is "next". Return value...
...ject on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description InvalidStateError This IDBObjectStore or IDBIndex has been deleted. TransactionInactiveError This IDBObjectStore's transaction is inactive. DataError The specified key or key
range is invalid. Example In this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store: var transaction = db.transaction("name", "readonly"); var objectStore = transaction.objectStore("name"); var request = objectStore.openCursor(); request.onsuccess = function(event) { var cursor = event.target.resu...
IDBObjectStore.openKeyCursor() - Web APIs
through matching results. Used for iterating through the keys of an object store with a cursor. To determine if the add operation has completed successfully, listen for the results's success event. Syntax var request = objectStore.openKeyCursor(); var request = objectStore.openKeyCursor(query); var request = objectStore.openKeyCursor(query, direction); Parameters query Optional The key
range to be queried. If a single valid key is passed, this will default to a
range containing only that key. If nothing is passed, this will default to a key
range that selects all the records in this object store. direction Optional An IDBCursorDirection telling the cursor what direction to travel. Valid values are "next", "nextunique", "prev", and "prevunique". The default is "next". Return value...
...ject on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description InvalidStateError This IDBObjectStore or IDBIndex has been deleted. TransactionInactiveError This IDBObjectStore's transaction is inactive. DataError The specified key or key
range is invalid. Example In this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store: var transaction = db.transaction("name", "readonly"); var objectStore = transaction.objectStore("name"); var request = objectStore.openKeyCursor(); request.onsuccess = function(event) { var cursor = event.target.r...
ImageCapture.getPhotoCapabilities() - Web APIs
The getPhotoCapabilities() method of the ImageCapture interface returns a Promise that resolves with a PhotoCapabilities object containing the
ranges of available configuration options. Syntax const capabilitiesPromise = imageCaptureObj.getPhotoCapabilities() Return value A Promise that resolves with a PhotoCapabilities object. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities() to modify the size of an input
range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
...solves with a PhotoCapabilities object. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities() to modify the size of an input
range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
ImageCapture.getPhotoSettings() - Web APIs
age width as an integer. The user agent selects the closest width value to this setting if it only supports discrete widths. redEyeReduction: A boolean indicating whether the red-eye reduction should be used if it is available. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoSettings() to modify the size of an input
range. ...
...eduction should be used if it is available. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoSettings() to modify the size of an input
range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
IntersectionObserver.IntersectionObserver() - Web APIs
if the threshold list is empty, it's set to the array [0.0]. ...
...re used. The default is a threshold of 0.0. Return value A new IntersectionObserver which can be used to watch for the visibility of a target element within the specified root crossing through any of the specified visibility thresholds. Call its observe() method to begin watching for the visibility changes on a given target. Exceptions SyntaxError The specified rootMargin is invalid.
RangeError One or more of the values in threshold is outside the
range 0.0 to 1.0. Example This example creates a new intersection observer which calls the function myObserverCallback every time the visible area of the element being observed changes by at least 10%. let observer = new IntersectionObserver(myObserverCallback, {threshold: 0.1}); Specifications Specifica...
Media Capabilities API - Web APIs
ed and how performant a media file will be both in terms of smoothness and power efficiency. The Media Capabilities API provide more powerful features than say MediaRecorder.isTypeSupported() or HTMLMediaElement.canPlayType(), which only address general browser support, not performance. The API also provides abilities to access display property information such as supported color gamut, dynamic
range abilities, and real-time feedback about the playback. To test support, smoothness and power efficiency of a video or audio file, you define the media configuration you want to test, and then pass the audio or video configuration as the parameter of the MediaCapabilities interface's encodingInfo() and decodingInfo() methods. Media capabilities information enables websites to enable adaptative st...
...be used to serve optimal media streams to the user and determine if playback should be smooth and power efficient . MediaCapabilitiesInfo The interface of the promise returned by the mediaCapabilities's encodingInfo() and decodingInfo() methods; returning whether the media configuration tested is supported, smooth, and powerEfficient. ScreenColorGamut Will describe the color gamut, or the
range of color, the screen can display (not currently supported anywhere). ScreenLuminance Will describe the known luminance characteristics of the screen (not currently supported anywhere). Media Capabilities dictionaries MediaConfiguration Describes how video and audio configuration dictionaries must be configured, or defined, to be passed as a parameter of the MediaCapabilities.encodingInfo(...
PannerNode.coneOuterGain - Web APIs
ace is a double value, describing the amount of volume reduction outside the cone, defined by the coneOuterAngle attribute. The coneOuterGain property's default value is 0, meaning that no sound can be heard outside the cone. Syntax var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.coneOuterGain = 0; Value A double. The default is 0, and its value can be in the
range 0-1. Exceptions InvalidStateError The property has been given a value outside the accepted
range (0-1). Example In this example, we'll demonstrate how changing the orientation parameters of a PannerNode in combination with coneInnerAngle and coneOuterAngle affects volume. To help us visualise how the orientation vector affects, we can use the Right-hand rule: First, let's start by writ...
...his utility converts amount of rotation around the Y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yRotationToVector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (Math.PI / 180); // using cosine and sine here ensures the output values are always normalised // i.e. ...
RTCInboundRtpStreamStats.qpSum - Web APIs
for every frame sent or received so far on the track described by the RTCInboundRtpStreamStats object. Since the value of QP is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. Note: This value is only available for video media. Usage notes Quantization is the process of applying lossy compression to a
range of values, resulting in a single quantum value. This value takes the place of the
range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. The quantization process and the amount of compression can be controlled using one or more parameters. It's important to keep in mind that the value of QP can change periodically-...
...of frames handled so far, and compute an average from there. See Calculating average quantization below for a function that does this. Also, the exact meaning of the QP value depends on the codec being used. For example, for the VP8 codec, the QP value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in RFC 6386: 19.2. H.264 uses a QP which
ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process. Additionally, QP is not likely to be the only parameter the codec uses to adjust the compression. See the individual codec specifications for details. Example Calculating average quantization The calculateAverageQP() function shown below computes the average QP for the given RTCStat...
RTCOutboundRtpStreamStats.qpSum - Web APIs
(QP) value for every frame sent so far on the track described by the RTCOutboundRtpStreamStats object. Since the value of QP is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. Note: This value is only available for video media. Usage notes Quantization is the process of applying lossy compression to a
range of values, resulting in a single quantum value. This value takes the place of the
range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. The quantization process and the amount of compression can be controlled using one or more parameters. It's important to keep in mind that the value of QP can change periodically-...
...have been encoded so far, and compute an average from there. See Calculating average quantization below for a function that does this. Also, the exact meaning of the QP value depends on the codec being used. For example, for the VP8 codec, the QP value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in RFC 6386: 19.2. H.264 uses a QP which
ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process. Additionally, QP is not likely to be the only parameter the codec uses to adjust the compression. See the individual codec specifications for details. Example Calculating average quantization The calculateAverageQP() function shown below computes the average QP for the given RTCStat...
ValidityState.stepMismatch - Web APIs
The read-only stepMismatch property of a ValidityState object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's step attribute. If the field is numeric in nature, including the date, month, week, time, datetime-local, number and
range types and the step value is not any, if the value don't doesn't conform to the constraints set by the step and min values, then stepMismatch will be true. If the remainder of the form control's value less the min value, divided by the step value (which defaults to 1 if ommitted) is not zero, there is a mismatch. Given the following: <input type="number" min="20" max="40" step="2"/> if (value - min) / 2 != 0, stepMismatch will be true. If true, the element matches the :...
...the step and min values, then stepMismatch will be true. If the remainder of the form control's value less the min value, divided by the step value (which defaults to 1 if ommitted) is not zero, there is a mismatch. Given the following: <input type="number" min="20" max="40" step="2"/> if (value - min) / 2 != 0, stepMismatch will be true. If true, the element matches the :invalid and :out-of-
range CSS pseudo-classes. Specifications Specification Status Comment HTML Living StandardThe definition of 'ValidityState.stepMismatch' in that specification. Living Standard HTML 5.1The definition of 'ValidityState.stepMismatch' in that specification. Recommendation HTML5The definition of 'ValidityState.stepMismatch' in that specification. ...
WebGL2RenderingContext.drawArraysInstanced() - Web APIs
Note: When using WebGL 1, the ANGLE_instanced_arrays extension can provide this method, too. Syntax void gl.drawArraysInstanced(mode, first, count, instanceCount); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. ...
...st vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. first A GLint specifying the starting index in the array of vector points. count A GLsizei specifying the number of indices to be rendered. instanceCount A GLsizei specifying the number of instances of the
range of elements to execute. Return value None. Examples gl.drawArraysInstanced(gl.POINTS, 0, 8, 4); Specifications Specification Status Comment WebGL 2.0The definition of 'drawArraysInstanced' in that specification. Editor's Draft Initial definition for WebGL. OpenGL ES 3.0The definition of 'glDrawArraysInstanced' in that specification. Standard Ma...
WebGL2RenderingContext - Web APIs
vertex attributes array. Drawing buffers WebGL2RenderingContext.vertexAttribDivisor() Modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with gl.drawArraysInstanced() and gl.drawElementsInstanced(). WebGL2RenderingContext.drawArraysInstanced() Renders primitives from array data. In addition, it can execute multiple instances of the
range of elements. WebGL2RenderingContext.drawElementsInstanced() Renders primitives from array data. In addition, it can execute multiple instances of a set of elements. WebGL2RenderingContext.draw
RangeElements() Renders primitives from array data in a given
range. WebGL2RenderingContext.drawBuffers() Specifies a list of color buffers to be drawn into. WebGL2RenderingContext.clearBuffer[fiuv]()...
...s from WebGLTransformFeedback buffers. WebGL2RenderingContext.pauseTransformFeedback() Pauses a transform feedback operation. WebGL2RenderingContext.resumeTransformFeedback() Resumes a transform feedback operation. Uniform buffer objects WebGL2RenderingContext.bindBufferBase() Binds a given WebGLBuffer to a given binding point (target) at a given index. WebGL2RenderingContext.bindBuffer
Range() Binds a
range of a given WebGLBuffer to a given binding point (target) at a given index. WebGL2RenderingContext.getUniformIndices() Retrieves the indices of a number of uniforms within a WebGLProgram. WebGL2RenderingContext.getActiveUniforms() Retrieves information about active uniforms within a WebGLProgram. WebGL2RenderingContext.getUniformBlockIndex() Retrieves the index of a unif...
WebGLRenderingContext.getShaderPrecisionFormat() - Web APIs
Syntax WebGLShaderPrecisionFormat gl.getShaderPrecisionFormat(shaderType, precisionType); Parameters shaderType Either a gl.FRAGMENT_SHADER or a gl.VERTEX_SHADER. precisionType A precision type value. Either gl.LOW_FLOAT, gl.MEDIUM_FLOAT, gl.HIGH_FLOAT, gl.LOW_INT, gl.MEDIUM_INT, or gl.HIGH_INT. Return value A WebGLShaderPrecisionFormat object or null, if an error occurs. ...
...r precision types aren't recognized. gl.INVALID_OPERATION if the shader compiler isn't supported. Examples The following code gets the precision format of a gl.VERTEX_SHADER with a gl.MEDIUM_FLOAT precision type. var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT); // WebGLShaderPrecisionFormat {
rangeMin: 127,
rangeMax: 127, precision: 23 } Specifications Specification Status Comment WebGL 1.0The definition of 'getShaderPrecisionFormat' in that specification. Recommendation Initial definition. OpenGL ES 2.0The definition of 'glGetShaderPrecisionFormat' in that specification. Standard Man page of the (similar) OpenGL API. ...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
For types gl.BYTE and gl.SHORT, normalizes the values to [-1, 1] if true. For types gl.UNSIGNED_BYTE and gl.UNSIGNED_SHORT, normalizes the values to [0, 1] if true. For types gl.FLOAT and gl.HALF_FLOAT, this parameter has no effect. stride A GLsizei specifying the offset in bytes between the beginning of consecutive vertex attributes. Cannot be larger tha...
...; in total this uses 12 bytes. normal vector: We need to store the X, Y and Z components of the normal vector, but since precision is not that important, we use 8-bit signed integers. For better performance, we align the data to 32 bits by also storing a fourth zero-valued component, bringing the total size to 4 bytes. Also, we tell WebGL to normalize the values because our normals are always in
range [-1, 1]. texture coordinate: We need to store the U and V coordinates; for this 16-bit unsigned integers offer enough precision, the total size is 4 bytes. We also tell WebGL to normalize the values to [0, 1]. For example, the following vertex: { "position": [1.0, 2.0, 1.5], "normal": [1.0, 0.0, 0.0], "texCoord": [0.5, 0.25] } Will be stored in the array buffer as follows: 0...
Color masking - Web APIs
Masking random colors This example modifies the random color animation by applying color masking with colorMask(). You can think of the color masking operation as if looking at the colored canvas through some tinted glass or color filter. So, by masking off the blue and green channels, you are only allowing the red component of pixels to be updated, and therefore it is as if you were looking through a red tinted glass. Color masking allows us to demonstrate some basics of color theory. ...
...d therefore it is as if you were looking through a red tinted glass. Color masking allows us to demonstrate some basics of color theory. By masking off some channel(s), we are in fact biasing the displayed colors towards the complementary color. So, clearly masking both blue and red, would give us shades of green. Masking only the blue channel would give us shades of yellow (including shades of o
range, brown, olive and yellow-green), the complementary of blue. Similarly, masking only green would give us shades of magenta (also purples, crimsons, and so on), and masking only red would give shades of cyan (also sea greens, blues, and so on). Note that the calls to colorMask() only occur when the user clicks on one of the toggle buttons. But rendering is done every second, using the timer. The c...
WebGL constants - Web APIs
eter to return a the current blend color. ARRAY_BUFFER_BINDING 0x8894 Passed to getParameter to get the array buffer binding. ELEMENT_ARRAY_BUFFER_BINDING 0x8895 Passed to getParameter to get the current element array buffer. LINE_WIDTH 0x0B21 Passed to getParameter to get the current lineWidth (set by the lineWidth method). ALIASED_POINT_SIZE_
RANGE 0x846D Passed to getParameter to get the current size of a point drawn with gl.POINTS ALIASED_LINE_WIDTH_
RANGE 0x846E Passed to getParameter to get the
range of available widths for a line. Returns a length-2 array with the lo value at 0, and hight at 1. CULL_FACE_MODE 0x0B45 Passed to getParameter to get the current value of cullFace. Should return FRONT, BACK...
...r to get the
range of available widths for a line. Returns a length-2 array with the lo value at 0, and hight at 1. CULL_FACE_MODE 0x0B45 Passed to getParameter to get the current value of cullFace. Should return FRONT, BACK, or FRONT_AND_BACK FRONT_FACE 0x0B46 Passed to getParameter to determine the current value of frontFace. Should return CW or CCW. DEPTH_
RANGE 0x0B70 Passed to getParameter to return a length-2 array of floats giving the current depth
range. DEPTH_WRITEMASK 0x0B72 Passed to getParameter to determine if the depth write mask is enabled. DEPTH_CLEAR_VALUE 0x0B73 Passed to getParameter to determine the current depth clear value. DEPTH_FUNC 0x0B74 Passed to getParameter to get the current de...
Matrix math for the web - Web APIs
ologies including WebGL, the WebXR (VR and AR) API, and GLSL shaders. This article is also available as an MDN content kit. The live examples use a collection of utility functions available under a global object named MDN. Transformation matrices There are many types of matrices, but the ones we are interested in are the 3D transformation matrices. These matrices consist of a set of 16 values ar
ranged in a 4x4 grid. In JavaScript, it is easy to represent a matrix as an array. Let's begin by considering the identity matrix. This is a special transformation matrix which functions much like the number 1 does in scalar multiplication; just like n * 1 = n, multiplying any matrix by the identity matrix gives a resulting matrix whose values match the original matrix. The identity matrix looks like...
...They can easily be shared around in programs. Different coordinate spaces can be described with matrices, and some matrix multiplication will move one set of data from one coordinate space to another coordinate space. Matrices effectively remember every part of the previous transforms that were used to generate them. For uses in WebGL, the graphics card is particular...
Basic concepts behind Web Audio API - Web APIs
ination for the audio, such as the user's computer speakers. Establish connections from the audio sources through zero or more effects, eventually ending at the chosen destination. Channel notation The number of audio channels available on a signal is frequently presented in a numeric format, such as 2.0 or 5.1. This is called channel notation. The first number is the number of full frequency
range audio channels that the signal includes. The number after the period indicates the number of those channels which are reserved for low-frequency effect (LFE) outputs; these are often referred to as subwoofers. Each input or output is composed of one or more audio channels, which together represent a specific audio layout. Any discrete channel structure is supported, including mono, stereo, qu...
...mber of frames by the sample rate. To get a number of frames from a number of samples, simply divide by the channel count. Here's a couple of simple examples: var context = new AudioContext(); var buffer = context.createBuffer(2, 22050, 44100); Note: In digital audio, 44,100 Hz (alternately represented as 44.1 kHz) is a common sampling frequency. Why 44.1kHz? Firstly, because the hearing
range of human ears is roughly 20 Hz to 20,000 Hz. Via the Nyquist-Shannon sampling theorem, the sampling frequency must be greater than twice the maximum frequency one wishes to reproduce. Therefore, the sampling rate has to be greater than 40 kHz. Secondly, signals must be low-pass filtered before sampling, otherwise aliasing occurs. While an ideal low-pass filter would perfectly pass frequencies ...
Controlling multiple parameters with ConstantSourceNode - Web APIs
opertry are all set to N as well. Example Let's take a look at this technique in action. In this simple example, we create three OscillatorNodes. Two of them have adjustable gain, controlled using a shared input control. The other oscillator has a fixed volume. ...
...tor has a fixed volume. HTML The HTML content for this example is primarily a button to toggle the oscillator tones on and off and an <input> element of type
range to control the volume of two of the three oscillators. ...
Background audio processing using AudioWorklet - Web APIs
< -1.0) { sample = -1.0; } output[channelNum][i] = sample; } } }; return true; } This is similar code to the previous sample in many ways, but only the first output--outputList[0]--is altered. Each sample is added to the corresponding sample in the output buffer, with a simple code fragment in place to prevent the samples from exceeding the legal
range of -1.0 to 1.0 by capping the values; there are other ways to avoid clipping that are perhaps less prone to distortion, but this is a simple example that's better than nothing. Lifetime of an audio worklet processor The only means by which you can influence the lifespan of your audio worklet processor is through the value returned by process(), which should be a Boolean value indicating whether...
...meterDescriptors to your class. This function should return an array of AudioParam objects, one for each parameter supported by the processor. In the following implementation of parameterDescriptors(), the returned array has two AudioParam objects. The first defines gain as a value between 0 and 1, with a default value of 0.5. The second parameter is named frequency and defaults to 440.0, with a
range from 275 to 4186.009, inclusively. static get parameterDescriptors() { return [ { name: "gain", defaultValue: 0.5, minValue: 0, maxValue: 1 }, { name: "frequency", defaultValue: 440.0; minValue: 27.5, maxValue: 4186.009 } ]; } Accessing your processor node's parameters is as simple as looking them up in the parameters object pas...
Visualizations with Web Audio API - Web APIs
e input is connected to the source, either directly or via another node. The analyser node will then capture audio data using a Fast Fourier Transform (fft) in a certain frequency domain, depending on what you specify as the AnalyserNode.fftSize property value (if no value is specified, the default is 2048.) Note: You can also specify a minimum and maximum power value for the fft data scaling
range, using AnalyserNode.minDecibels and AnalyserNode.maxDecibels, and different data averaging constants using AnalyserNode.smoothingTimeConstant. Read those pages to get more information on how to use them. To capture data, you need to use the methods AnalyserNode.getFloatFrequencyData() and AnalyserNode.getByteFrequencyData() to capture frequency data, and AnalyserNode.getByteTimeDomainData() and...
... canvasCtx.fillStyle = 'rgb(0, 0, 0)'; canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); Now we set our barWidth to be equal to the canvas width divided by the number of bars (the buffer length). However, we are also multiplying that width by 2.5, because most of the frequencies will come back as having no audio in them, as most of the sounds we hear every day are in a certain lower frequency
range. We don't want to display loads of empty bars, therefore we simply shift the ones that will display regularly at a noticeable height across so they fill the canvas display. We also set a barHeight variable, and an x variable to record how far across the screen to draw the current bar. var barWidth = (WIDTH / bufferLength) * 2.5; var barHeight; var x = 0; As before, we now start a for loop and ...
ARIA annotations - Accessibility
rize the purpose of the widget in a clear description because the UI does not make it clear: <section aria-description="Choose your favourite fruit -- the fruit with the highest number of votes will be added to the lunch options next week."> <p>Pick your favourite fruit:</p> <form> <ul> <li><label>Apple: <input type="radio" name="fruit" value="apple"></label></li> <li><label>O
range: <input type="radio" name="fruit" value="o
range"></label></li> <li><label>Banana: <input type="radio" name="fruit" value="banana"></label></li> </ul> </form> </section> If the descriptive text does appear in the UI, you can link the description to the widget using aria-describedby, like so: <p id="fruit-desc">Choose your favourite fruit -- the fruit with the highest number of votes ...
...appear in the UI, you can link the description to the widget using aria-describedby, like so: <p id="fruit-desc">Choose your favourite fruit -- the fruit with the highest number of votes will be added to the lunch options next week.</p> <section aria-describedby="fruit-desc"> <form> <ul> <li><label>Apple: <input type="radio" name="fruit" value="apple"></label></li> <li><label>O
range: <input type="radio" name="fruit" value="o
range"></label></li> <li><label>Banana: <input type="radio" name="fruit" value="banana"></label></li> </ul> </form> </section> Insertions and deletions A common wish in online document systems like Google Docs is to be able to track changes, to see what reviewers or editors have suggested as changes to the text, before the managing editor or...
ARIA: tab role - Accessibility
To accomplish the first, we listen for the keydown event on the tablist. If the event's keyCode is 39 for right arrow or 37 for the left arrow, we r...
... To accomplish the first, we listen for the keydown event on the tablist. If the event's keyCode is 39 for right arrow or 37 for the left arrow, we react to the event. We start b...
ARIA: table role - Accessibility
The table value of the ARIA role attribute identifies the element containing the role as having a non-interactive table structure containing data ar
ranged in rows and columns, similar to the native <table> HTML element. <div role="table" aria-label="Semantic Elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">Semantic Elements to use instead of ARIA's roles</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="none">ARIA Role</span> <span role="columnheader" aria-sort="none">Semantic Element</span> </div> </div> <div role="rowgroup"> <div role="row" aria-rowindex="11"> <span role="cell">header</span> <span role="cell">h1</span> </div> <div role="row"...
...</div> Description An element with role="table" is a static tabular structure with rows containing cells. The cells are not focusable or selectable, though widgets within individual cells of the table can be interactive. Using a native HTML table element whenever possible is strongly encouraged. If a table maintains a selection state, has two-dimensional navigation, or allows the user to rear
range cell order use grid or treegrid instead. To create an ARIA table, add role="table" to the container element. Within that container, each row has role="row" set and contains child cells. Each cell has a role of either columnheader, rowheader, or simply cell. Rows can be children of the table or within a rowgroup. The table caption can be defined via aria-labelledby or aria-label. All other sem...
WAI-ARIA Roles - Accessibility
ARIA: timer roleThe timer role indicates to assistive technologies that an element is a numerical counter the amount of elapsed time from a starting point or the remaining time...
... removed from the below list. ...
Cognitive accessibility - Accessibility
Cognitive accessibility covers accessibility considerations for people with cognition and learning disabilities. This document introduces cognitive accessibility and improving accessibility of the web for people with cognitive and learning differences. Cognitive impairment refers to a broad
range of disabilities, from people with intellectual disabilities who may have the most-limited capabilities, to age-related issues with thinking and remembering. The
range includes people with mental illnesses, such as depression and schizophrenia. It also includes people with learning disabilities, such as dyslexia and attention deficit hyperactivity disorder (ADHD). Though there is a lot of diversity within clinical definitions of cognitive impairments, people with them experience a common set o...
...a, and dyscalculia. An example of a temporary cognitive impairment could be people affected by substances such as alcohol or drugs. Another form it can take is depression, such as when mourning the loss of a loved one, or being momentarily saddened by a tweet or video they just saw online. A third example could be sleep deprivation. It may seem like an overwhelming challenge to address the wide
range of cognitive differences, especially when solutions for two different people may be conflicting. One way to handle this is to focus on cognitive skills. Cognitive skills include: attention memory processing speed time management letters and language numbers symbols and math understanding and making choices A solid approach to providing accessible solutions for people with cognitive imp...
:focus-visible - CSS: Cascading Style Sheets
This matches the native focus behavior for controls like <button>. <custom-button tabindex="0" role="button">Click Me</custom-button> custom-button { display: inline-block; margin: 10px; } custom-button:focu...
... Accessibility concerns Low vision Make sure the visual focus indicator can be seen by people with low vision. This will also benefit anyone use a screen in a brightly lit space (like outside in the sun). WCAG 2.1 SC 1.4.11 Non-Text Contrast requires that the visual focus indicator be at least 3 t...
system - CSS: Cascading Style Sheets
class="list"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> <li>Six</li> <li>Seven</li> <li>Eight</li> <li>Nine</li> <li>Ten</li> </ul> @counter-style numbers { system: numeric; symbols: 0 1 2 3 4 5 6 7 8 9; suffix: ": "; } ul { list-style: numbers; } Result Additive counter This example renders a list using Roman numerals. Notice that a
range is specified. This is because the representation will produce correct Roman numerals only until the counter value of 3999. Once outside of the
range, the rest of the counter representations will be based on the decimal style, which is the fall back. If you need to represent counter values as Roman numerals, you could use either one of the predefined counter styles, upper-roman or lower-roman, ra...
...the decimal style, which is the fall back. If you need to represent counter values as Roman numerals, you could use either one of the predefined counter styles, upper-roman or lower-roman, rather than recreating the rule yourself. ...
font-stretch - CSS: Cascading Style Sheets
extra-condensed 62.5% condensed 75% semi-condensed 87.5% normal 100% semi-expanded 112.5% expanded 125% extra-expanded 150% ultra-expanded 200% Variable fonts Most fonts have a particular width which corresponds to one of the keyterm values. However some fonts, called variable fonts, can support a
range of stretching with more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For this, percentage
ranges are useful. For TrueType or OpenType variable fonts, the "wdth" variation is used to implement varying glyph widths. Accessibility concerns People with dyslexia and other cognitive conditions may have difficulty reading fonts that ...
... @font-face { font-family: "Open Sans"; src: local("Open Sans") format("woff2"), url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); font-stretch: 87.5% 112.5%; } Specifications Specification Status Comment ...
font-weight - CSS: Cascading Style Sheets
meric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values, although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts. CSS Fonts Level 4 extends the syntax to accept any number between 1 and 1000, inclusive, and introduces Variable fonts, which can make use of this much finer-grained
range of font weights. Common weight name mapping The numerical values 100 to 900 roughly correspond to the following common weight names: Value Common weight name 100 Thin (Hairline) 200 Extra Light (Ultra Light) 300 Light 400 Normal 500 Medium 600 Semi Bold (Demi Bold) 700 Bold 800 Extra...
...t (Ultra Light) 300 Light 400 Normal 500 Medium 600 Semi Bold (Demi Bold) 700 Bold 800 Extra Bold (Ultra Bold) 900 Black (Heavy) Variable fonts Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping. However some fonts, called variable fonts, can support a
range of weights with more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying weights. Accessibility concerns People experiencing low vision conditions may have difficulty reading text set with a font-weight value of 100 (Thin/Hairline) or 200 (Extr...
@import - CSS: Cascading Style Sheets
'='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>where <mf-name> = <ident><mf-value> = <number> | ...
...'='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? ...
aspect-ratio - CSS: Cascading Style Sheets
Examples The example below is contained in an <iframe>, which creates its own viewport. Resize the <iframe> to see aspect-ratio in action. ...
...} /* Maximum aspect ratio */ @media (max-aspect-ratio: 3/2) { div { background: #9ff; /* cyan */ } } /* Exact aspect ratio, put it at the bottom to avoid override*/ @media (aspect-ratio: 1/1) { div { background: #f9a; /* red */ } } _Example used iframe and DataURL to enable this iframe could resize HTML <label id="wf" for="w">width:165</label> <input id="w" name="w" type="
range" min="100" max="250" step="5" value="165"> <label id="hf" for="w">height:165</label> <input id="h" name="h" type="
range" min="100" max="250" step="5" value="165"> <iframe id="outer" src="data:text/html,<style> @media (min-aspect-ratio: 8/5) { div { background: %239af; } } @media (max-aspect-ratio: 3/2) { div { background: %239ff; } } @media (aspect-ratio: 1/1) { div { background: %23f9a; } }</st...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
erties as defined in Flexbox Level One. The Cross Axis The align-items and align-self properties control alignment of our flex items on the cross axis, down the columns if flex-direction is row and along the row if flex-direction is column. We are making use of cross-axis alignment in the most simple flex example. If we add display: flex to a container, the child items all become flex items ar
ranged in a row. They will all stretch to be as tall as the tallest item, as that item is defining the height of the items on the cross axis. If your flex container has a height set, then the items will stretch to that height, regardless of how much content is in the item. The reason the items become the same height is that the initial value of align-items, the property that controls alignment on ...
...tion. Instead we can target item 4 and separate it from the first three items by giving it a margin-left value of auto. Auto margins will take up all of the space that they can in their axis -- it is how centering a block with margin auto left and right works. Each side tries to take as much space as it can, and so the block is pushed into the middle. In this live example, I have flex items ar
ranged simply into a row with the basic flex values, and the class push has margin-left: auto. You can try removing this, or adding the class to another item to see how it works. Future alignment features for Flexbox At the beginning of this article I explained that the alignment properties currently contained in the Level 1 flexbox specification are also included in Box Alignment Level 3, which m...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
umns and 4 parts to the center. In this layout I am displaying the nav in the left column, alongside the content. In the right column we have the sidebar and underneath it the advertisements (ad). The footer now spans right across the bottom of the layout. I then use a flexbox to display the navigation as a column. This is a simple example but demonstrates how we can use a grid layout to rear
range our layout for different breakpoints. In particular I am changing the location of that ad block, as appropriate in my different column setups. I find this named areas method very helpful at a prototyping stage, it is easy to play around with the location of elements. You could always begin to use grid in this way for prototyping, even if you can't rely on it fully in production due to the browser...
...build it using grid. Don't forget to find examples that are impossible to build with current methods. That might mean taking inspiration from magazines or other non-web sources. Grid Layout opens up possibilities that we have not had before, we don't need to be tied to the same old layouts to use it. For inspiration see the Layout Labs from Jen Simmons, she has been creating layouts based on a
range of sources. For additional common layout patterns see Grid by Example, where there are many smaller examples of grid layout and also some larger UI patterns and full page layouts. ...
Using z-index - CSS: Cascading Style Sheets
If you want to create a custom stacking order, you can use the z-index property on a positioned element. The z-index property can be specified with an integer value (positive, zero, or negative), which represents the position of the element along the z-axis. If you are not familiar with the z-axis, imagine the page as a stack of layers, each one having a number. Layers are rendered in numerical order, with larger numbers above smaller numbers. bottom layer (farthest from the observer) ... ...
...3 ... top layer (closest to the observer) Notes: When no z-index property is specified, elements are rendered on the default rendering layer 0 (zero). If several elements share the same z-index value (i.e., they are placed on the same layer), stacking rules explained in the section Stacking without the z-index property apply. In the following example, the layers' stacking order is rear
ranged using z-index. The z-index of element #5 has no effect since it is not a positioned element. Source code for the example HTML <div id="abs1"> <b>DIV #1</b> <br />position: absolute; <br />z-index: 5; </div> <div id="rel1"> <b>DIV #2</b> <br />position: relative; <br />z-index: 3; </div> <div id="rel2"> <b>DIV #3</b> <br />position: relative; <br />z-index: 2; </div> <di...
border-image-slice - CSS: Cascading Style Sheets
er-width: Changes the width of the border. The sampled image size is scaled to fit inside the border, which means that if the width is bigger than the slice, the image can start to look somewhat pixellated (unless of course you use an SVG image). ...
...at pixellated (unless of course you use an SVG image). ...
clamp() - CSS: Cascading Style Sheets
It takes three parameters: a minimum value, a preferred value, and a maximum allowed value. The clamp() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. clamp(MIN, VAL, MAX) is resolved as max(MIN, min(VAL, MAX)) The source for this interactive example is stored in a GitHub repository. ...
...a minimum font-size or above a maximum font-size. It has the same effect as the code in Fluid Typography but in one line, and without the use of media queries. Syntax The clamp() function takes three comma separated expressions as its parameter, in the order of minimum value, preferred value, maximum value. The minimum value is the smallest (most negative) value. This is the lower bound in the
range of allowed values. If the preferred value is less than this value, the minimum value will be used. The preferred value is the expression whose value will be used as long as the result is between the minimum and maximum values. The maximum value is the largest (most positive) expression value to which the value of the property will be assigned if the preferred value is greater than this upper bo...
color - CSS: Cascading Style Sheets
for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. For an overview of using color in HTML, see Applying color to HTML elements using CSS. ...
...ast digit(s) represents the alpha value. Adds hwb(), device-cmyk(), and color() functions. CSS Color Module Level 3The definition of 'color' in that specification. Recommendation Deprecates system-colors. Adds SVG colors. Adds the rgba(), hsl(), and hsla() functions. CSS Level 2 (Revision 1)The definition of 'color' in that specification. Recommendation Adds the o
range color and the system colors. CSS Level 1The definition of 'color' in that specification. Recommendation Initial definition. ...
conic-gradient() - CSS: Cascading Style Sheets
n multiple colors. A color-stop's position can be explicitly defined by using an <angle>. If you don't specify the location of a color stop, it is placed halfway between the one that precedes it and the one that follows it. If you don't specify an angle for the first or last color stop, their values are 0deg and 360deg respectively. The following two gradients are equivalent conic-gradient(red, o
range, yellow, green, blue); conic-gradient(red 0deg, o
range 90deg, yellow 180deg, green 270deg, blue 360deg); By default, colors transition smoothly from the color at one color stop to the color at the subsequent color stop, with the midpoint between the colors being the half way point between the color transition. You can move this color transition midpoint to any point between two color stops by ad...
... width: 100px; height: 100px; } <div></div> div { background: conic-gradient(from 0deg at 0% 25%, blue, green, yellow 180deg); } Gradient pie-chart This example uses multi-position color stops, with adjacent colors having the same color stop value, creating a striped effect. div { width: 100px; height: 100px; } <div></div> div { background: conic-gradient( red 36deg, o
range 36deg 170deg, yellow 170deg); border-radius: 50% } Checkerboard div { width: 100px; height: 100px; } <div></div> div { background: conic-gradient(#fff 0.25turn, #000 0.25turn 0.5turn, #fff 0.5turn 0.75turn, #000 0.75turn) top left / 25% 25% repeat; border: 1px solid; } More conic-gradient examples Please see Using CSS gradients for more examples. Specifications ...
font-variation-settings - CSS: Cascading Style Sheets
s. <string> <number> When rendering text, the list of variable font axis names is passed to the text layout engine to enable or disable font features. Each setting is always one or more pairs consisting of a <string> of 4 ASCII characters followed by a <number> indicating the axis value to set. If the <string> has more or fewer characters or contains characters outside the U+20 - U+7E codepoint
range, the whole property is invalid. The <number> can be fractional or negative, depending on the value
range available in your font, as defined by the font designer. Description This property is a low-level mechanism designed to set variable font features where no other way to enable or access those features exist. You should only use it when no basic properties exist to set those features (e.g. f...
...hould only use it when no basic properties exist to set those features (e.g. font-weight, font-style). Font characteristics set using font-variation-settings will always override those set using the corresponding basic font properties, e.g. font-weight, no matter where they appear in the cascade. In some browsers, this is currently only true when the @font-face declaration includes a font-weight
range. Registered and custom axes Variable font axes come in two types: registered and custom. Registered axes are the most commonly encountered -- common enough that the authors of the specification felt they were worth standardizing. Note that this doesn't mean that the author has to include all of these in their font. Here are the registered axes along with their corresponding CSS properties: ...
grid-auto-columns - CSS: Cascading Style Sheets
red in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If a grid item is positioned into a column that is not explicitly sized by grid-template-columns, implicit grid tracks are created to hold it. This can happen either by explicitly positioning into a column that is out of
range, or by the auto-placement algorithm creating additional columns. Syntax /* Keyword values */ grid-auto-columns: min-content; grid-auto-columns: max-content; grid-auto-columns: auto; /* <length> values */ grid-auto-columns: 100px; grid-auto-columns: 20cm; grid-auto-columns: 50vmax; /* <percentage> values */ grid-auto-columns: 10%; grid-auto-columns: 33.3%; /* <flex> values */ grid-auto-column...
...e a minmax() notation, it implies an automatic minimum (i.e. minmax(auto, <flex>)). max-content Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track. min-content Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) Is a functional notation that defines a size
range greater than or equal to min and less than or equal to max. If max is smaller than min, then max is ignored and the function is treated as min. As a maximum, a <flex> value sets the track's flex factor. As a minimum, it is treated as zero (or minimal content, if the grid container is sized under a minimal content constraint). fit-content(argument) Represents the formula min(max-content, max(aut...
grid-auto-rows - CSS: Cascading Style Sheets
le is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If a grid item is positioned into a row that is not explicitly sized by grid-template-rows, implicit grid tracks are created to hold it. This can happen either by explicitly positioning into a row that is out of
range, or by the auto-placement algorithm creating additional rows. Syntax /* Keyword values */ grid-auto-rows: min-content; grid-auto-rows: max-content; grid-auto-rows: auto; /* <length> values */ grid-auto-rows: 100px; grid-auto-rows: 20cm; grid-auto-rows: 50vmax; /* <percentage> values */ grid-auto-rows: 10%; grid-auto-rows: 33.3%; /* <flex> values */ grid-auto-rows: 0.5fr; grid-auto-rows: 3fr;...
...e a minmax() notation, it implies an automatic minimum (i.e. minmax(auto, <flex>)). max-content Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track. min-content Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) Is a functional notation that defines a size
range greater than or equal to min and less than or equal to max. If max is smaller than min, then max is ignored and the function is treated as min. As a maximum, a <flex> value sets the track's flex factor. As a minimum, it is treated as zero (or minimal content, if the grid container is sized under a minimal content constraint). auto Is a keyword that is identical to maximal content if it's a maxi...
<integer> - CSS: Cascading Style Sheets
t represents a whole number, whether positive or negative. Integers can be used in numerous CSS properties, such as column-count, counter-increment, grid-column, grid-row, and z-index. Syntax The <integer> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. There is no unit associated with integers. ...
...er> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. There is no unit associated with integers. Note: There is no official
range of valid <integer> values. Opera 12.1 supports values up to 215-1, IE up to 220-1, and other browsers even higher. During the CSS3 Values cycle there was a lot of discussion about setting a minimum
range to support: the latest decision, in April 2012 during the LC phase, was [-227-1; 227-1], but other values like 224-1 and 230-1 were also proposed. However, the latest spec doesn't specify a
range anymore. Interpolation When animated, values of the <integer> data type are interpolated using discrete, whole steps. The calculation is done as if they were real, floating-point numbers; the discrete ...
opacity - CSS: Cascading Style Sheets
of an element. Opacity is the degree to which content behind an element is hidden, and is the opposite of transparency. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Values <alpha-value> A <number> in the
range 0.0 to 1.0, inclusive, or a <percentage> in the
range 0% to 100%, inclusive, representing the opacity of the channel (that is, the value of its alpha channel). Any value outside the interval, though valid, is clamped to the nearest limit in the
range. Value Meaning 0 The element is fully transparent (that is, invisible). Any <number> strictly between 0...
...ext content and 3:1 for larger text such as headings. Large text is defined as 18.66px and bold or larger, or 24px or larger. ...
shape-image-threshold - CSS: Cascading Style Sheets
els that are more than 50% opaque. /* <number> value */ shape-image-threshold: 0.7; /* Global values */ shape-image-threshold: inherit; shape-image-threshold: initial; shape-image-threshold: unset; Syntax Values <alpha-value> Sets the threshold used for extracting a shape from an image. The shape is defined by the pixels whose alpha value is greater than the threshold. ...
...eshold: 0.7; /* Global values */ shape-image-threshold: inherit; shape-image-threshold: initial; shape-image-threshold: unset; Syntax Values <alpha-value> Sets the threshold used for extracting a shape from an image. The shape is defined by the pixels whose alpha value is greater than the threshold. Values outside the
range 0.0 (fully transparent) to 1.0 (fully opaque) are clamped to this
range. Formal definition Initial value0.0Applies tofloatsInheritednoComputed valueThe same as the specified value after clipping the <number> to the
range [0.0, 1.0].Animation typea number Formal syntax <alpha-value>where <alpha-value> = <number> | <percentage> Examples Aligning text to a gradient This example creates a <div> block with a gradient background image. The gradient is established a...
Cross-browser audio basics - Developer guides
ime; }); Buffering Ok, we're getting there, but there is another piece of useful information we can display: the amount of audio has been buffered or downloaded in advance. There are a couple of properties we haven't looked at yet, buffered and seekable. buffered This property lets us know which parts of the audio has been buffered (downloaded in advance). It returns something called a Time
Ranges object. myBufferedTime
Ranges = myAudio.buffered; seekable The seekable property informs you of whether you can jump directly to that part of the media without further buffering. mySeekableTime
Ranges = myAudio.seekable; Buffering events There are also a couple of events related to buffering: seeking The seeking event is fired when media is being sought. seeked seeked occurs when the s...
... Browser support The following tables list basic audio support across desktop and mobile browsers, and what audio codecs are supported. ...
Web Audio playbackRate explained - Developer guides
pplied to the original rate.) A complete example Let's create a <video> element first, and set up video and playback rate controls in HTML: <video id="myVideo" controls> <source src="https://udn.realityripple.com/samples/6f/08625b424a.m4v" type='video/mp4' /> <source src="https://udn.realityripple.com/samples/5b/8cd6da9c65.webm" type='video/webm' /> </video> <form> <input id="pbr" type="
range" value="1" min="0.5" max="4" step="0.1" > <p>Playback Rate <span id="currentPbr">1</span></p> </form> And apply some JavaScript to it: window.onload = function () { var v = document.getElementById("myVideo"); var p = document.getElementById("pbr"); var c = document.getElementById("currentPbr"); p.addEventListener('input',function(){ c.innerHTML = p.value; v.playbackRate = p.
... time the playbackRate changes. Browser support Chrome 20+ ? Firefox 20+ ? IE 9+ ? Safari 6+ ? Opera 15+ ? Mobile Chrome (Android) ? Mobile Firefox 24+ ? IE Mobile ? Mobile Safari 6+ (iOS) ? Opera Mobile ? Notes Most browsers stop playing audio outside playbackRate bounds of 0.5 and 4, leaving the video playing silently. For most applications, it's recommended that you limit the
range to between 0.5 and 4. The pitch of the audio track does not change when playBackRate is altered. Negative values will not cause the media to play in reverse. IE9+ switches to the default playback rate when an ended event is fired. Firefox generates a ratechange event when the media source is substituted. On iOS 7 you can only affect the playbackRate when the media is paused (not while it's...
Creating a cross-browser video player - Developer guides
0 or higher than 1. Progress When the <progress> element was defined above in the HTML, only two attributes were set, value and min, both being given a value of 0. The function of these attributes is self-explanatory, with min indicating the minimum allowed value of the progress element and value indicating its current value. It also needs to have a maximum value set so that it can display its
range correctly, and this can be done via the max attribute, which needs to be set to the maximum playing time of the video. This is obtained from the video's duration attribute, which again is part of the Media API. Ideally, the correct value of the video's duration attribute is available when the loadedmetadata event is raised, which occurs when the video's metadata has been loaded: video.addEventL...
... Skip Ahead Another feature of most browser default video control sets is the ability to click on the video's progress bar to "skip ahead" to a different point in the video. This can also be achieved by adding a simple click event listener to the progress element: progress.addEventListener('click', function(e) { var pos = (e.pageX - this.offsetLeft) / this.offsetWidth; video.currentTi...
Audio and video manipulation - Developer guides
video should be on the same domain as your code. Common audio filters These are some of the common types of audio filter you can apply: Low Pass: Allows frequencies below the cutoff frequency to pass through and attenuates frequencies above the cutoff. High Pass: Allows frequencies above the cutoff frequency to pass through and attenuates frequencies below the cutoff. ...
...mon types of audio filter you can apply: Low Pass: Allows frequencies below the cutoff frequency to pass through and attenuates frequencies above the cutoff. High Pass: Allows frequencies above the cutoff frequency to pass through and attenuates frequencies below the cutoff. Band Pass: Allows a
range of frequencies to pass through and attenuates the frequencies below and above this frequency
range. Low Shelf: Allows all frequencies through, but adds a boost (or attenuation) to the lower frequencies. High Shelf: Allows all frequencies through, but adds a boost (or attenuation) to the higher frequencies. Peaking: Allows all frequencies through, but adds a boost (or attenuation) to a
range of frequencies. Notch: Allows all frequencies through, except for a set of frequencies. Allpass: Al...
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
ssion of each of the color value types, see the reference for the CSS <color> unit. Keywords A set of standard color names have been defined, letting you use these keywords instead of numeric representations of colors if you choose to do so and there's a keyword representing the exact color you want to use. Color keywords include the standard primary and secondary colors (such as red, blue, or o
range), shades of gray (from black to white, including colors like darkgray and lightgrey), and a variety of other blended colors including lightseagreen, cornflowerblue, and rebeccapurple. See Color keywords in <color> for a list of all available color keywords. RGB values There are three ways to represent an RGB color in CSS. Hexadecimal string notation Hexadecimal string notation represents a c...
...s from movies. And we decide to use a photo taken by one of the Mars landers humanity has parked on the surface over the last few decades, since the game takes place on the planet's surface. We use a color picker tool to select a sample of the color we choose. Using an eyedropper tool, we identify a color we like and determine that the color in question is #D79C7A, which is an appropriate rusty o
range-red color that's so stereotypical of the Martian surface. Having selected our base color, we need to build out our palette. We decide to use Paletton to come up with the other colors we need. Upon opening Paletton, we see: Next, we enter our color's hex code (D79C7A) into the "Base RGB" box at the bottom-left corner of the tool: We now see a monochromatic palette based on the color we pick...
HTML attribute: required - HTML: Hypertext Markup Language
ext, search, url, tel, email, password, date, month, week, time, datetime-local, number, checkbox, radio, file, <input> types along with the <select> and <textarea> form control elements. If present on any of these input types and elements, the :required pseudo class will match. If the attribute is not included, the :optional pseudo class will match. ...
...ents, the :required pseudo class will match. If the attribute is not included, the :optional pseudo class will match. The attribute is not supported or relevant to
range and color, as both have default values. It is also not supported on hidden as it can not be expected that a user to fill out a form that is hidden. Nor is it supported on any of the button types, including image. Note color and
range don't support required, but type color defaults to #00000, and
range defaults to the midpoint between min and max -- with min and max defaulting to 0 and 100 respectively in most browsers if not declared -- so always has a value. When an input has the required attribute, the :required pseudo-class also applies to it. Conversely, inputs that support the required attribute but don't have the attri...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
Historically, these have been presented using italicized type, which is the original source of the <i> naming of this element. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. ...
...tory. Permitted parents Any element that accepts phrasing content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Use the <i> element for text that is set off from the normal prose for readability reasons. This would be a
range of text with different semantic meaning than the surrounding text. Among the use cases for the <i> element are spans of text representing a different quality or mode of text, such as: Alternative voice or mood Taxonomic designations (such as the genus and species "Homo sapiens") Idiomatic terms from another language (such as "et cetera"); these should include the lang attribute to id...
<input type="month"> - HTML: Hypertext Markup Language
section Handling browser support). Basic uses of month The simplest use of <input type="month"> involves a basic <input> and <label> element combination, as seen below: <form> <label for="bday-month">What month were you born in?</label> <input id="bday-month" type="month" name="bday-month"> </form> Setting maximum and minimum dates You can use the min and max attributes to restrict the
range of dates that the user can choose. In the following example we specify a minimum month of 1900-01 and a maximum month of 1999-12: <form> <label for="bday-month">What month were you born in?</label> <input id="bday-month" type="month" name="bday-month" min="1900-01" max="1999-12"> </form> The result here is that: Only months between in January 1900 and December 1999 can be sele...
...n choose. In the following example we specify a minimum month of 1900-01 and a maximum month of 1999-12: <form> <label for="bday-month">What month were you born in?</label> <input id="bday-month" type="month" name="bday-month" min="1900-01" max="1999-12"> </form> The result here is that: Only months between in January 1900 and December 1999 can be selected; months outside that
range can't be scrolled to in the control. Depending on what browser you are using, you might find that months outside the specified
range might not be selectable in the month picker (e.g. Edge), or invalid (see Validation) but still available (e.g. Chrome). Controlling input size <input type="month"> doesn't support form sizing attributes such as size. You'll have to resort to CSS for sizing needs...
<input type="password"> - HTML: Hypertext Markup Language
re login forms; see Insecure passwords. Value A DOMString representing a password, or empty Events change and input Supported Common Attributes autocomplete, inputmode, maxlength, minlength, pattern, placeholder, readonly, required, and size IDL attributes selectionStart, selectionEnd, selectionDirection, and value Methods select(), set
RangeText(), and setSelection
Range() Value The value attribute contains a DOMString whose value is the current contents of the text editing control being used to enter the password. If the user hasn't entered anything yet, this value is an empty string (""). If the required property is specified, then the password edit box must contain a value other than an empty string to be valid. If the pat...
... select all the text in the password field. HTML <label for="userPassword">Password: </label> <input id="userPassword" type="password" size="12"> <button id="selectAll">Select All</button> JavaScript document.getElementById("selectAll").onclick = function() { document.getElementById("userPassword").select(); } Result You can also use selectionStart and selectionEnd to get (or set) what
range of characters in the control are currently selected, and selectionDirection to know which direction selection occurred in (or will be extended in, depending on your platform; see its documentation for an explanation). However, given that the text is obscured, the usefulness of these is somewhat limited. Validation If your application has character set restrictions or any other requirement for t...
<output>: The Output element - HTML: Hypertext Markup Language
ent, if any.) This attribute lets you associate <output> elements to <form>s anywhere in the document, not just inside a <form>. It can also override an ancestor <form> element. name The element's name. Used in the form.elements API. The <output> value, name, and contents are NOT submitted during form submission. ...
...ission. Examples In the following example, the form provides a slider whose value can
range between 0 and 100, and an <input> element into which you can enter a second number. The two numbers are added together, and the result is displayed in the <output> element each time the value of any of the controls changes. <form oninput="result.value=parseInt(a.value)+parseInt(b.value)"> <input type="
range" id="b" name="b" value="50" /> + <input type="number" id="a" name="a" value="10" /> = <output name="result" for="a b">60</output> </form> Accessibility Concerns Many browsers implement this element as an aria-live region. Assistive technology will thereby announce the results of UI interactions posted inside it without requiring that focus is switched away from the controls that produce ...
<video>: The Video Embed element - HTML: Hypertext Markup Language
together. In some browsers (e.g. Chrome 70.0) autoplay doesn't work if no muted attribute is present. autoPictureInPicture A Boolean attribute which if true indicates that the element should automatically toggle picture-in-picture mode when the user switches back and forth between this document and another document or application. buffered An attribute you can read to determine the time
ranges of the buffered media. This attribute contains a Time
Ranges object. controls If this attribute is present, the browser will offer controls to allow the user to control video playback, including volume, seeking, and pause/resume playback. controlslist The controlslist attribute, when specified, helps the browser select what controls to show on the media element whenever the browser shows it...
...played in its place. If the browser doesn't support video playback, the fallback text is displayed. Multiple sources example This example builds on the last one, offering three different sources for the media; this allows the video to be watched regardless of which video codecs are supported by the browser. ...
itemprop - HTML: Hypertext Markup Language
The itemprop global attribute is used to add properties to an item. Every HTML element can have an itemprop attribute specified, and an itemprop consists of a name-value pair. Each name-value pair is called a property, and a group of one or more properties forms an item. Property values are either a string or a URL and can be associated with a very wide
range of elements including <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source> , <track>, and <video>. Examples The example below shows the source for a set of elements marked up with itemprop attributes, followed by a table showing the resulting structured data. HTML <div itemscope itemtype="http://schema.org/Movie"> <h1 itemprop="name">Avatar</h1> <span>Director: <span itemprop="director">James Cameron</span> (born ...
...t</li> </ul> </div> This results in an item with two properties, both with the name "flavor" and having the values "Lemon sorbet" and "Apricot sorbet". An element introducing a property can also introduce multiple properties at once, to avoid duplication when some of the properties have the same value. An item with two properties, "favorite-color" and "favorite-fruit", both set to the value "o
range" <div itemscope> <span itemprop="favorite-color favorite-fruit">o
range</span> </div> Note: There is no relationship between the microdata and the content of the document where the microdata is marked up. Same structured data marked up in two different ways There is no semantic difference between the following two examples <figure> <img src="castle.jpeg"> <figcaption><span items...
Configuring servers for Ogg media - HTTP
ation: AddType audio/ogg .oga AddType video/ogg .ogv AddType application/ogg .ogg You can find specific information about possible media file types and the codecs used within them in our comprehensive guide to media types and formats on the web. In particular, the article on media container formats will be especially helpful when configuring serers to host media properly. Handle HTTP 1.1 byte
range requests correctly In order to support seeking and playing back regions of the media that aren't yet downloaded, Gecko uses HTTP 1.1 byte-
range requests to retrieve the media from the seek target position. In addition, Gecko uses byte-
range requests to seek to the end of the media (assuming you serve the Content-Length header) in order to determine the duration of the media. Your server should ...
...y In order to support seeking and playing back regions of the media that aren't yet downloaded, Gecko uses HTTP 1.1 byte-
range requests to retrieve the media from the seek target position. In addition, Gecko uses byte-
range requests to seek to the end of the media (assuming you serve the Content-Length header) in order to determine the duration of the media. Your server should accept the Accept-
Ranges: bytes HTTP header if it can accept byte-
range requests. It must return 206: Partial content to all byte
range requests; otherwise, browsers can't be sure you actually support byte
range requests. Your server must also return 206: Partial Content for the request
Range: bytes=0- as well. Include regular key frames When the browser seeks through Ogg media to a specified time, it has to seek to ...
HTTP response status codes - HTTP
pt for that specific case, the "200 OK" response is preferred to this status. 204 No Content There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones. 205 Reset Content Tells the user-agent to reset the document which sent this request. 206 Partial Content This response code is used when the
Range header is sent from the client to request only part of a resource. 207 Multi-Status (WebDAV) Conveys information about multiple resources, for situations where multiple status codes might be appropriate. 208 Already Reported (WebDAV) Used inside a <dav:propstat> response element to avoid repeatedly enumerating the internal members of multiple bindings to the same collection. 226 IM Used (HTT...
... Payload Too Large Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field. 414 URI Too Long The URI requested by the client is longer than the server is willing to interpret. 415 Unsupported Media Type The media format of the requested data is not supported by the server, so the server is rejecting the request. 416
Range Not Satisfiable The
range specified by the
Range header field in the request can't be fulfilled; it's possible that the
range is outside the size of the target URI's data. 417 Expectation Failed This response code means the expectation indicated by the Expect request header field can't be met by the server. 418 I'm a teapot The server refuses the attempt to brew coffee with a teapot. 421 Mi...
A re-introduction to JavaScript (JS tutorial) - JavaScript
d: var obj = {}; These are semantically equivalent; the second is called object literal syntax and is more convenient. This syntax is also the core of JSON format and should be preferred at all times. Object literal syntax can be used to initialize an object in its entirety: var obj = { name: 'Carrot', for: 'Max', // 'for' is a reserved word, use '_for' instead. details: { color: 'o
range', size: 12 } }; Attribute access can be chained together: obj.details.color; // o
range obj['details']['size']; // 12 The following example creates an object prototype(Person) and an instance of that prototype(you). function Person(name, age) { this.name = name; this.age = age; } // Define an object var you = new Person('You', 24); // We are creating a new person named "You" aged ...
...eturn o; } This isn't an exact replica of new as it doesn't set up the prototype chain (it would be difficult to illustrate). This is not something you use very often, but it's useful to know about. In this snippet, ...args (including the ellipsis) is called the "rest arguments" -- as the name implies, this contains the rest of the arguments. Calling var bill = trivialNew(Person, 'William', 'O
range'); is therefore almost equivalent to var bill = new Person('William', 'O
range'); apply() has a sister function named call, which again lets you set this but takes an expanded argument list as opposed to an array. function lastNameCaps() { return this.last.toUpperCase(); } var s = new Person('Simon', 'Willison'); lastNameCaps.call(s); // Is the same as: s.lastNameCaps = lastNameCaps; s.lastN...
JavaScript data types and data structures - JavaScript
presenting floating-point numbers, the number type has three symbolic values: +Infinity, -Infinity, and NaN ("Not a Number"). To check for the largest available value or smallest available value within +-Infinity, you can use the constants Number.MAX_VALUE or Number.MIN_VALUE. Starting with ECMAScript 2015, you are also able to check if a number is in the double-precision floating-point number
range using Number.isSafeInteger() as well as Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER. Beyond this
range, integers in JavaScript are not safe anymore and will be a double-precision floating point approximation of the value. The number type has only one integer with two representations: 0 is represented as both -0 and +0. (0 is an alias for +0.) In the praxis, this has almost no impact.
...ate arrays. For example, indexOf (searching a value in the array) or push (adding an element to the array), and so on. This makes Arrays a perfect candidate to represent lists or sets. Typed Arrays are new to JavaScript with ECMAScript 2015, and present an array-like view of an underlying binary data buffer. ...
Control flow and error handling - JavaScript
so on). Example In the following example, if fruittype evaluates to 'Bananas', the program matches the value with case 'Bananas' and executes the associated statement. When break is encountered, the program exits the switch and continues execution from the statement following switch. If break were omitted, the statement for case 'Cherries' would also be executed. ...
...ollowing example, if fruittype evaluates to 'Bananas', the program matches the value with case 'Bananas' and executes the associated statement. When break is encountered, the program exits the switch and continues execution from the statement following switch. If break were omitted, the statement for case 'Cherries' would also be executed. ...
Array.from() - JavaScript
3 ] Using arrow functions and Array.from() // Using an arrow function as the map function to // manipulate the elements Array.from([1, 2, 3], x => x + x); // [2, 4, 6] // Generate a sequence of numbers // Since the array is initialized with `undefined` on each position, // the value of `v` below will be `undefined` Array.from({length: 5}, (v, i) => i); // [0, 1, 2, 3, 4] Sequence generator (
range) // Sequence generator function (commonly referred to as "
range", e.g. Clojure, PHP etc) const
range = (start, stop, step) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step)); // Generate numbers
range 0..4
range(0, 4, 1); // [0, 1, 2, 3, 4] // Generate numbers
range 1..10 with step of 2
range(1, 10, 2); // [1, 3, 5, 7, 9] // Generate the alphabet using Array.fro...
...erred to as "
range", e.g. Clojure, PHP etc) const
range = (start, stop, step) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step)); // Generate numbers
range 0..4
range(0, 4, 1); // [0, 1, 2, 3, 4] // Generate numbers
range 1..10 with step of 2
range(1, 10, 2); // [1, 3, 5, 7, 9] // Generate the alphabet using Array.from making use of it being ordered as a sequence
range('A'.charCodeAt(0), 'Z'.charCodeAt(0), 1).map(x => String.fromCharCode(x)); // ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] Specifications Specification Initial publication ECMAScript (ECMA-262)The definition of 'Array.from' in that specification. ECMAScript 2015 ...
Array.prototype.slice() - JavaScript
m/mdn/interactive-examples and send us a pull request. Syntax arr.slice([start[, end]]) Parameters start Optional Zero-based index at which to start extraction. A negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. If start is undefined, slice starts from the index 0. If start is greater than the index
range of the sequence, an empty array is returned. end Optional Zero-based index before which to end extraction. slice extracts up to but not including end. For example, slice(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3). A negative index can be used, indicating an offset from the end of the sequence. slice(2,-1) extracts the third element through the se...
...e to both the new and original arrays. For strings, numbers and booleans (not String, Number and Boolean objects), slice copies the values into the new array. Changes to the string, number, or boolean in one array do not affect the other array. If a new element is added to either array, the other array is not affected. Examples Return a portion of an existing array let fruits = ['Banana', 'O
range', 'Lemon', 'Apple', 'Mango'] let citrus = fruits.slice(1, 3) // fruits contains ['Banana', 'O
range', 'Lemon', 'Apple', 'Mango'] // citrus contains ['O
range','Lemon'] Using slice> In the following example, slice creates a new array, newCar, from myCar. Both include a reference to the object myHonda. When the color of myHonda is changed to purple, both arrays reflect the change. // Using slice...
Error - JavaScript
onstructor, there are seven other core error constructors in JavaScript. For client-side exceptions, see Exception handling statements. EvalError Creates an instance representing an error that occurs regarding the global function eval(). InternalError Creates an instance representing an error that occurs when an internal error in the JavaScript engine is thrown. E.g. "too much recursion".
RangeError Creates an instance representing an error that occurs when a numeric variable or parameter is outside of its valid
range. ReferenceError Creates an instance representing an error that occurs when de-referencing an invalid reference. SyntaxError Creates an instance representing a syntax error. TypeError Creates an instance representing an error that occurs when a variable or parameter ...
...etc } Custom Error Types You might want to define your own error types deriving from Error to be able to throw new MyError() and use instanceof MyError to check the kind of error in the exception handler. This results in cleaner and more consistent error handling code. See "What's a good way to extend Error in JavaScript?" on...
Intl​.List​Format​.prototype​.formatToParts() - JavaScript
two properties: type and value. The type property may be either "element", which refers to a value from the list, or "literal" which refers to a linguistic construct. The value property gives the content, as a string, of the token. The locale and style options used for formatting are given when constructing the Intl.ListFormat instance. ...
...when constructing the Intl.ListFormat instance. Examples Using formatToParts const fruits = ['Apple', 'O
range', 'Pineapple']; const myListFormat = new Intl.ListFormat('en-GB', { style: 'long', type: 'conjunction' }); console.table(myListFormat.formatToParts(fruits)); // [ // { "type": "element", "value": "Apple" }, // { "type": "literal", "value": ", " }, // { "type": "element", "value": "O
range" }, // { "type": "literal", "value": ", and " }, // { "type": "element", "value": "Pineapple" } // ] Specifications Specification Intl.ListFormatThe definition of 'formatToParts()' in that specification. ...
Math.random() - JavaScript
The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user. Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the window.crypto.getRandomValues() method. Syntax Math.random() Return value A floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive). ...
...dom numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the window.crypto.getRandomValues() method. Syntax Math.random() Return value A floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive). Examples Note that as numbers in JavaScript are IEEE 754 floating point numbers with round-to-nearest-even behavior, the
ranges claimed for the functions below (excluding the one for Math.random() itself) aren't exact. If extremely large bounds are chosen (253 or higher), it's possible in extremely rare cases to calculate the usually-excluded upper bound. Getting a random number between 0 (inclusive) and 1 (exclusive) function getRandom() { return Math.random(); } Getting a random number between two values This ex...
Math.random() - JavaScript
The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user. Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the window.crypto.getRandomValues() method. Syntax Math.random() Return value A floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive). ...
...dom numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the window.crypto.getRandomValues() method. Syntax Math.random() Return value A floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive). Examples Note that as numbers in JavaScript are IEEE 754 floating point numbers with round-to-nearest-even behavior, the
ranges claimed for the functions below (excluding the one for Math.random() itself) aren't exact. If extremely large bounds are chosen (253 or higher), it's possible in extremely rare cases to calculate the usually-excluded upper bound. Getting a random number between 0 (inclusive) and 1 (exclusive) function getRandom() { return Math.random(); } Getting a random number between two values This ex...
Number - JavaScript
(More details on this are described in the ECMAScript standard, chapter 6.1.6 The Number Type.) const biggestInt = Number.MAX_SAFE_INTEGER // (253 - 1) => 9007199254740991 const smallestInt = Number.MIN_SAFE_INTEGER // -(253 - 1) => -9007199254740991 When parsing data th...
...r values that can be represented as Number object. (More details on this are described in the ECMAScript standard, chapter 6.1.6 The Number Type.) const biggestInt = Number.MAX_SAFE_INTEGER // (253 - 1) => 9007199254740991 const smallestInt = Number.MIN_SAFE_INTEGER // -(253 - 1) => -9007199254740991 When parsing data that has been serialized to JSON, integer values falling outside of this
range can be expected to become corrupted when JSON parser coerces them to Number type. A possible workaround is to use String instead. Larger numbers can be represented using the BigInt type. Using Number to convert a Date object The following example converts the Date object to a numerical value using Number as a function: let d = new Date('December 17, 1995 03:24:00') console.log(Number(d)) T...
String.prototype.charCodeAt() - JavaScript
art of a surrogate pair for the code point. If you want the entire code point value, use codePointAt(). Syntax str.charCodeAt(index) Parameters index An integer greater than or equal to 0 and less than the length of the string. If index is not a number, it defaults to 0. Return value A number representing the UTF-16 code unit value of the character at the given index. If index is out of
range, charCodeAt() returns NaN. Description Unicode code points
range from 0 to 1114111 (0x10FFFF). The first 128 Unicode code points are a direct match of the ASCII character encoding. (For information on Unicode, see the JavaScript Guide.) Note: charCodeAt() will always return a value that is less than 65536. This is because the higher code points are represented by a pair of (lower valued) "sur...
...or to use codePointAt(i) instead. See examples 2 and 3 (below). charCodeAt() returns NaN if the given index is less than 0, or if it is equal to or greater than the length of the string. Backward compatibility: In historic versions (like JavaScript 1.2) the charCodeAt() method returns a number indicating the ISO-Latin-1 codeset value of the character at the given index. The ISO-Latin-1 codeset
ranges from 0 to 255. The first 0 to 127 are a direct match of the ASCII character set. Examples Using charCodeAt() The following example returns 65, the Unicode value for A. 'ABC'.charCodeAt(0) // returns 65 Fixing charCodeAt() to handle non-Basic-Multilingual-Plane characters if their presence earlier in the string is unknown This version might be used in for loops and the like when it is unk...
String.fromCharCode() - JavaScript
ified sequence of UTF-16 code units. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax String.fromCharCode(num1[, ...[, numN]]) Parameters num1, ..., numN A sequence of numbers that are UTF-16 code units. The
range is between 0 and 65535 (0xFFFF). Numbers greater than 0xFFFF are truncated. No validity checks are performed. Return value A string of length N consisting of the N specified UTF-16 code units. Description This method returns a string and not a String object. Because fromCharCode() is a static method of String, you always use it as String.fromCharCode(), rather than as a method of a String o...
...se it as String.fromCharCode(), rather than as a method of a String object you created. Returning supplementary characters In UTF-16, the most common characters can be represented by a single 16-bit value (i.e. a code unit). However, this set of characters, known as the Base Multilingual Plane (BMP), is only 1/17th of the total addressable Unicode code points. The remaining code points, in the
range of 65536 (0x010000) to 1114111 (0x10FFFF) are known as supplementary characters. In UTF-16, supplementary characters are represented by two 16-bit code units, known as surrogates, that were reserved for this purpose. A valid combination of two surrogates used to represent a supplementary character is known as a surrogate pair. Because fromCharCode() only works with 16-bit values (same as the \u ...
TypedArray - JavaScript
TypedArray (e.g. Int8Array), an array buffer is created internally in memory or, if an ArrayBuffer object is given as constructor argument, then this is used instead. The buffer address is saved as an internal property of the instance and all the methods of %TypedArray%.prototype, i.e. set value and get value etc., operate on that array buffer address. ...
... be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Static properties TypedArray.BYTES_PER_ELEMENT Returns a number value of the element size for the different TypedArray objects. TypedArray.name Returns the string value of the constructor name (e.g, "Int8Array"). get TypedArray[@@speci...
Uint8ClampedArray() constructor - JavaScript
The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). ...
... be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create a Uint8ClampedArray // From a length var uintc8 = new Uint8ClampedArray(2); uintc8[0] = 42; uintc8[1] = 1337; console.log(uintc8[0]); // 42 console.log(uintc8[1]); // 255 (clamped) console.log(uintc8.length...
switch - JavaScript
atement. Examples Using switch In the following example, if expr evaluates to Bananas, the program matches the value with case case 'Bananas' and executes the associated statement. When break is encountered, the program breaks out of switch and executes the statement following switch. If break were omitted, the statement for the case 'Cherries' would also be executed. ...
...witch In the following example, if expr evaluates to Bananas, the program matches the value with case case 'Bananas' and executes the associated statement. When break is encountered, the program breaks out of switch and executes the statement following switch. If break were omitted, the statement for the case 'Cherries' would also be executed. ...
Responsive Navigation Patterns - Progressive web apps (PWAs)
not the optimal way to present information on small screens because of the reduced screen real estate. Therefore, it is necessary to consider the presentation of content and ease of navigation for all screen sizes. Note: HTML/CSS for the corresponding patterns will be available soon. Pattern 1: Top toggle menu In this pattern, as the screen width is reduced, the top navigation items rear
range until there is not enough space. At that point, some items move from the top navigation to a drop-down menu. In the smallest screen, all navigation items live in a toggle menu, and the user has to tap to expand the toggle menu. You could rank the item priorities to ensure the most important items always appear in the top navigation. Pros: one button in header maximizes space for content on ...
...At that point, some items move from the top navigation to a drop-down menu. You could rank the item priorities to ensure the most important items always appear in the top navigation. In the smallest screen, several items stay on the bottom of the screen, and the rest of the items are hidden. The user can flip the menu open and select from the r...
textLength - SVG: Scalable Vector Graphics
ult value None Animatable Yes <length-percentage> This value specifies the width of the space the text will be adjusted to occupy as absolute length or percentage. <number> A numeric value outlines a length referring to the units of the current coordinate system. Example Let's create a simple example that presents text you can resize using an <input> element of type "
range". CSS .controls { font: 16px "Open Sans", "Arial", sans-serif; } SVG Let's start with the SVG. It's pretty basic, with a 1000-by-300 pixel space mapped into a 10 centimeter by 3 centimeter box. <svg width="10cm" height="3cm" viewBox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg"> <rect x="1" y="1" width="998" height="298" fill="none" stroke="green" stroke-width="2"/> <...
..." font-family="sans-serif" font-size="60" fill="green"> Hello world! </text> </svg> First, a <rect> element is used to create and stroke a rectangle to contain the text. Then <text> is used to create the text element itself, with an id of "hello". HTML The HTML is also simple, with only two displayed elements contained inside a grouping <div>: <div class="controls"> <input type="
range" id="widthSlider" min="80" max="978"> <span id="widthDisplay"></span> </div> The <input> element, of type "
range", is used to create the slider control the user will manipulate to change the width of the text. A <span> element of ID "widthDisplay" is provided to display the current width value. JavaScript Finally, let's have a look at the JavaScript code. It starts by stashing references to ...
u1 - SVG: Scalable Vector Graphics
The u1 attribute specifies list of Unicode characters (refer to the description of the unicode attribute of the <glyph> element for a description of how to express individual Unicode characters) and/or
ranges of Unicode characters, which identify a set of possible first glyphs in a kerning pair. If a given Unicode character within the set has multiple corresponding <glyph> elements (i.e., there are multiple <glyph> elements with the same unicode attribute value but different glyph-name values), then all such glyphs are included in the set. Comma is the separator character; thus, to kern a comma, specify the comma as part of a
range of Unicode characters or as a glyph name using the g1 attribute. The total set of possible first glyphs in the kerning pair is the union of glyphs specified by th...
...he set. Comma is the separator character; thus, to kern a comma, specify the comma as part of a
range of Unicode characters or as a glyph name using the g1 attribute. The total set of possible first glyphs in the kerning pair is the union of glyphs specified by the u1 and g1 attributes. Two elements are using this attribute: <hkern> and <vkern> Context notes Value [ <character> | <u
range> ]# Default value None Animatable No [ <character> | <u
range> ]# This value indicates a comma-separated sequence of Unicode characters and/or
ranges of Unicode characters, which identify a set of possible first glyphs in a kerning pair. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Editio...
u2 - SVG: Scalable Vector Graphics
The u2 attribute specifies list of Unicode characters (refer to the description of the unicode attribute of the <glyph> element for a description of how to express individual Unicode characters) and/or
ranges of Unicode characters, which identify a set of possible second glyphs in a kerning pair. If a given Unicode character within the set has multiple corresponding <glyph> elements (i.e., there are multiple <glyph> elements with the same unicode attribute value but different glyph-name values), then all such glyphs are included in the set. Comma is the separator character; thus, to kern a comma, specify the comma as part of a
range of Unicode characters or as a glyph name using the g2 attribute. The total set of possible second glyphs in the kerning pair is the union of glyphs specified by ...
...e set. Comma is the separator character; thus, to kern a comma, specify the comma as part of a
range of Unicode characters or as a glyph name using the g2 attribute. The total set of possible second glyphs in the kerning pair is the union of glyphs specified by the u2 and g2 attributes. Two elements are using this attribute: <hkern> and <vkern> Context notes Value [ <character> | <u
range> ]# Default value None Animatable No [ <character> | <u
range> ]# This value indicates a comma-separated sequence of Unicode characters and/or
ranges of Unicode characters, which identify a set of possible second glyphs in a kerning pair. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Editi...
XUL Migration Guide - Archive of obsolete content
way to add items to the browser's main menus using the SDK's supported APIs. Many add-ons will need to make some changes to their user interfaces if they are to use only the SDK's supported APIs, and add-ons which make drastic changes to the browser chrome will very probably need more than the SDK's supported APIs can offer. Similarly, the supported APIs expose only a small fraction of the full
range of XPCOM functionality. Using Third Party Packages The SDK is extensible by design: developers can create new modules filling gaps in the SDK, and package them for distribution and reuse. Add-on developers can install these packages and use the new modules. If you can find a third party package that does what you want, this is a great way to use features not supported in the SDK without having...
page-mod - Archive of obsolete content
onAttach: function(worker) { console.log(worker.tab.url); } }); Name: onAttach Type: function Assign a listener function to this option to listen to the page-mod's attach event. See the documentation for attach and Communicating With Content Scripts. Name: exclude Type: string, RegExp, array of (String or RegExp) This option is new in Firefox 32 Specifies a
range of URLs to exclude. This takes the same syntax as the include option: a match-pattern string or regular expression, or an array of match pattern strings or regular expressions. These match-patterns define the documents to which the page-mod will not be applied, even if their URLs match the include option: var pageMod = require("sdk/page-mod"); var modScript = 'console.log("matches");'; pageMod...
simple-storage - Archive of obsolete content
rowsing. To read about how to opt into private browsing mode and how to use the SDK to avoid storing user data associated with private windows, refer to the documentation for the private-browsing module. Globals Properties storage A persistent object private to your add-on. Properties with array, boolean, number, object, null, and string values will be persisted. quotaUsage A number in the
range [0, Infinity) that indicates the percentage of quota occupied by storage. A value in the
range [0, 1] indicates that the storage is within quota. A value greater than 1 indicates that the storage exceeds quota. Events OverQuota The module emits this event when your add-on's storage goes over its quota. ...
core/promise - Archive of obsolete content
: const { resolve } = require('sdk/core/promise'); var a = resolve(5).then(function(value) { return value + 2; }); a.then(console.log); // => 7 Also resolve not only takes values, but also promises. If you pass it a promise it will return a new identical one: const { resolve } = require('sdk/core/promise'); resolve(resolve(resolve(3))).then(console.log); // => 3 This construct may look st
range at first, but it becomes quite handy when writing functions that deal with both promises and values. In such cases it's usually easier to wrap value into promise than branch on value type: function or(a, b) { var second = resolve(b).then(function(bValue) { return !!bValue }); return resolve(a).then(function(aValue) { return !!aValue || second; }, function() { return second; }) } ...
ui/button/action - Archive of obsolete content
in one of three ways: as a resource:// URL pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile) as a relative path: a string in the form "./iconfile", where "iconfile" is a relative path to the icon file beginning in your add-on's "data" directory as an object, or dictionary of key-value pairs. Here you can specify a
range of sizes for your button's icon. Each key-value pair specifies an icon: each value specifies an image file as a resource:// URL or relative path. each key must be a numeric string such as "16", or "32", which represents the size in pixels of the corresponding image. var { ActionButton } = require('sdk/ui/button/action'); var self = require("sdk/self"); ...
ui/button/toggle - Archive of obsolete content
in one of three ways: as a resource:// URL pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile) as a relative path: a string in the form "./iconfile", where "iconfile" is a relative path to the icon file beginning in your add-on's "data" directory as an object, or dictionary of key-value pairs. Here you can specify a
range of sizes for your button's icon. Each key-value pair specifies an icon: each value specifies an image file as a resource:// URL or relative path. each key must be a numeric string such as "16", or "32", which represents the size in pixels of the corresponding image. var { ToggleButton } = require('sdk/ui/button/toggle'); var self = require("sdk/self"); ...
Localization - Archive of obsolete content
t 12-14) and other numbers: ???? ??????? // one tomato ??? ???????? // two tomatoes ???? ????????? // five tomatoes The SDK uses the Unicode CLDR data to describe the different plural forms used by different languages. Unicode CLDR plural forms The Unicode CLDR project defines a scheme for describing a particular language's plural rules. In this scheme a language maps each distinct
range of numbers on to one of up to six forms, identified by the following categories: zero, one, two, few, many, and other. English has two forms, which can be described by mapping "1" to "one" and "everything else" to "other": one -> n is 1; other -> everything else Russian uses four forms, that can be described as follows: one -> n mod 10 is 1 and n mod 100 is not 11; few -> n mod 10 in 2...
JavaScript Daemons Management - Archive of obsolete content
e reversals property equal to Infinity. myDaemon.unmakeLoop() Sets the reversals property equal to 0. myDaemon.setRate(milliseconds) Sets the time lapse between calls (in milliseconds). If the daemon is running it will be immediately updated with the new property. myDaemon.forcePosition(index) Sets the internal INDEX property equal to the index argument without any kind of control about the
range. myDaemon.getDuration() Returns the duration of the daemon in milliseconds. myDaemon.getPosition() Returns the internal INDEX property. myDaemon.makeSteps(howMany[, backwards[, force]]) Calls synchronously the callback function howMany times. Forwards or backwards. If the force argument is set to true, the possible return false of the callback function will be ignored. myDaemon.skipTo(inde...
Tree - Archive of obsolete content
e = document.getElementById("my-tree"); var tbo = tree.treeBoxObject; // get the row, col and child element at the point var row = { }, col = { }, child = { }; tbo.getCellAt(event.clientX, event.clientY, row, col, child); var cellText = tree.view.getCellText(row.value, col.value); alert(cellText); } Getting the selected indices of a multiselect tree var start = {}, end = {}, num
Ranges = tree.view.selection.get
RangeCount(), selectedIndices = []; for (var t = 0; t < num
Ranges; t++){ tree.view.selection.get
RangeAt(t, start, end); for (var v = start.value; v <= end.value; v++) selectedIndices.push(v); } Other resources XUL: Tree documentation XUL tutorial: Tree selection ...
Offering a context menu for form controls - Archive of obsolete content
ntrolcontextmenu/content/overlay.js"/> </overlay> Change the right-click behavior The overlaid code is responsible for adjusting the behavior of right-clicking on form controls. window.addEventListener("load", function() { let setTargetOriginal = nsContextMenu.prototype.setTarget; Components.utils.reportError(setTargetOriginal); nsContextMenu.prototype.setTarget = function(aNode, a
RangeParent, a
RangeOffset) { setTargetOriginal.apply(this, arguments); if (this.isTargetAFormControl(aNode)) this.shouldDisplay = true; }; }, false); This code, which is run when the window is opened up, works by replacing the setTarget() routine for the prototype of nsContextMenu with one that forces the context menu to display if the target of the menu is a form control. ...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
isting 4). FIXME: Listing 4: Event handler Clock handler Create the window that displays the clock (Listing 5) and its controller (Listing 6). We've already covered the dialog element in Chapter 3. In this case, we only want to display an OK button, so we set the buttons attribute to accept. Within the window are a label element and textbox element, wrapped in a hbox element so that they are ar
ranged horizontally. Listing 5: Content for clock.xul <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/"?> <dialog id="clockDialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="Clock" buttons="accept" onload="initClock();"> <script type="application/javascript" src="chrome://helloworld/content/clock.js"/> <hbox align="center"> <labe...
XUL user interfaces - Archive of obsolete content
status.setAttribute("warning", "true") status.setAttribute("label", "Date is not valid") } else { status.removeAttribute("warning") status.setAttribute("label", aDate.toLocaleDateString()) } } To see the result exactly as intended, use the default theme in your browser. If you use a different theme, it changes some user-interface styles and the demonstration might look st
range. Open the document in your Mozilla browser and use the interface. This wiki does not support XUL and JavaScript in pages, so it is not possible to show the demonstration here. It looks something like this: XUL demonstration Day of week calculator Date: 6/27/2005 Day: Sunday Monday Tuesday Wednesday Thurds...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
table cell with other images should be vertically aligned with the bottom of the line box. Any image in a table cell with other images and text should have its vertical alignment changed as necessary, if at all. With a judicious mixture of approaches and a reduction of single-pixel image tricks-- which, in a CSS-capable browser, are unnecessary anyway-- it is quite possible to sidestep this st
range effect of standards support. The best solution may be to ensure that images are always in a cell by themselves, thus allowing authors to make them block-level, but as always this will depend on the author's design. Related Links Gecko's Almost Standards Mode Mozilla's Quirks Mode Original Document Information Author(s): Eric A. Meyer Last Updated Date: March 21st, 2003 Copyright (C) ...
Notes on HTML Reflow - Archive of obsolete content
The details on this page are obsolete. Overview Reflow is the process by which the geometry of the layout engine's formatting objects are computed. The HTML formatting objects are called frames : a frame corresponds to the geometric information for (roughly) a single element in the content model; the frames are ar
ranged into a hierarchy that parallels the containment hierarchy in the content model. A frame is rectangular, with width, height, and an offset from the parent frame that contains it. More than one frame may be needed to represent a single element from the content model; for example, text that wraps is broken into several frames, one per wrapped line. In this case, the primary frame is the frame containing the first line of text, with continu...
Enabling the behavior - updating the status bar panel - Archive of obsolete content
cess"); else icon.setAttribute("status", ""); } updateTinderboxStatus() retrieves a reference to the statusbarpanel element then searches through the retrieved HTML document (stored in the responseText property of the XMLHttpRequest instance) for one of several color references. The color red (represented by the RGB code EE0000) means a tinderbox client failed to build Mozilla. The color o
range ("FFAAOO") means a client successfully built Mozilla, but the build failed tests. The color green ("11DD11") means the client successfully built and tested Mozilla. When it finds a color, it sets the panel's status attribute to the corresponding status, which causes the previously defined CSS rules to switch to the icon appropriate for that status. Because our conditional looks for worse states (...
Tinderbox - Archive of obsolete content
orms), most people only care about the overall situation, i.e. whether or not any clients have failed. By checking for build failures first and test failures second, we make sure to show users the worst possible situation, i.e. if any clients have failed to build, we will display a red icon that signifies a build failure; if all clients built successfully but some failed tests we will display an o
range icon that signifies a test failure. Only if all clients reported both successful builds and successful tests will we display a green icon that signifies all is well with the code. << PreviousNext >> ...
Settings - Archive of obsolete content
With the above manifest the following stored properties are available in the jetpack's code: * jetpack.storage.settings.twitter.username * jetpack.storage.settings...
Settings - Archive of obsolete content
With the above manifest the following stored properties are available in the jetpack's code: jetpack.storage.settings.twitter.username jetpack.storage.settings.tw...
Simple Storage - Archive of obsolete content
le.sync(). The object can also be forced to reload its data from disk by calling jetpack.storage.simple.open(), although the data comes loaded automatically. Don't abuse these methods, since they cause Firefox -- all of Firefox -- to drop what it's doing to make a trip to the disk. If you call them too often, Firefox may become unresponsive for some of your users. Unless you are doing something st
range, let Jetpack flush your data for you. The namespace currently lives in the future and must be imported before it is used: jetpack.future.import("storage.simple"); Methods sync()As described above, the jetpack.storage.simple object is automatically written to disk, but a feature may force flush by calling jetpack.storage.simple.sync(). Don't abuse this method. open()As described above, the jetpac...
slideBar - Archive of obsolete content
About Status: In Development Instantiation: jetpack.future.import('slideBar') Last Update: v0.6 Summary: slideBar is a reinvention of the old sidebar feature of browsers. They allow quick access to a wide
range of both temporary and permanent information at the side of your browser window. When a slideBar feature is selected, its contents will be revealed from behind the current web page. Creating a SlideBar and adding options To implement a new slideBar within your jetpack code, use the method jetpack.slideBar.append(options) ...
slideBar - Archive of obsolete content
Note: This page documents the Jetpack Prototype, which is no longer under active development. Read the experiment report for what we learned from it and the blog post announcing the first SDK release for what we're up to next! slideBar is a reinvention of the old sidebar features of browsers. They allow quick access to a wide
range of both temporary and permanent information at the side of your browser window. When a slideBar feature is selected its contents will be revealed from behind the current webpage. It currently under development and lives in the future. jetpack.future.import("slideBar"); Methods append(iconurihtmlhtml/xmlurluriwidthintpersistboolautoReloadboolonClickfunctiononSelectfunctiononReadyfunction)This is a list of options to specify modifications to your slideBar inst...
Simple Storage - Archive of obsolete content
le.sync(). The object can also be forced to reload its data from disk by calling jetpack.storage.simple.open(), although the data comes loaded automatically. Don't abuse these methods, since they cause Firefox -- all of Firefox -- to drop what it's doing to make a trip to the disk. If you call them too often, Firefox may become unresponsive for some of your users. Unless you are doing something st
range, let Jetpack flush your data for you. The namespace currently lives in the future and must be imported before it is used: jetpack.future.import("storage.simple"); Methods sync()As described above, the jetpack.storage.simple object is automatically written to disk, but a feature may force flush by calling jetpack.storage.simple.sync(). Don't abuse this method. open()As described above, the jetpac...
Mozilla Application Framework in Detail - Archive of obsolete content
rther enhance the user interface by allowing 3rd parties to develop "themes" for your application. Themes are simply collections of images and CSS which can augment or replace your current UI elements. XUL provides an excellent answer for organizations with heterogeneous computing environments. Customized XUL applications with significant business logic can be written once, and used on the
range of platforms that exist within the organization. In addition, if the organization maintains sophisticated, interactive websites, it will already possess a wealth of technical expertise that will be relevant for creating XUL applications. In addition to the technologies already mentioned, we go even further by allowing you to even create your own custom interface widgets. Don't feel limited by the...
Nanojit - Archive of obsolete content
ditional branches, with the difference that when they are called, instead of going to a particular address, they leave the JIT code entirely, and stop the trace. Need Guards are required in a cross platform dynamic language like JavaScript. Certain assumptions are made when a particular JIT code is generated. For example, in an instruction INR x, a guard would check that x doesn't overflow the
range for a 32 bit integer. The JIT code would have a guard checking this condition(an xt guard), and would return to the interpreter if the condition turns out to be true. The interpreter is then equipped to handle the overflow. Hence, guards are needed to prevent certain erroneous behaviour that might result from the assumptions that are generally made while JIT is generated. TODO: Explain guards, ...
New Skin Notes - Archive of obsolete content
T) will revisit sidebar width later. --dria I see that it was activated as default for non-logged in people already, it appears that there is no intention whatsoever to fix this at current time, since it's been placed in this section. Just so that (perhaps) this might revive the topic, a side bar shouldn't exceed 16% to allow proper viewing at 800 pixels width ideally in my opinion, I find st
range that I'm the only person not too fond of large side bars (or side bars at all, for that matter :) considering that in most articles we scroll down to read the text, and that the side bar scrolls as well, the links aren't there anymore, but the width remains wasted anyway. In the case of a story book, small text columns do seem reasonable, but I don't think this is nice for technical documentation...
Running Tamarin performance tests - Archive of obsolete content
y be specified by selecting ./runtests.py -c [misc,scimark,jsbench]. Also for better accuracy tests may be run multiple times. Specifying ./runtests.py -i 10 will run each tests 10 time and use the fastest result. If more than 2 repetitions are specified the 95% percentile confidence rating is calculated. The confidence rating measures the percentage of the mean 95% of the results were within the
range. Performance Test Options There are a variety of options available with runtests.py - here is the help text followed by explanations for some options: $ ./runtests.py -h usage: runtests.py [options] [tests] -v --verbose enable additional output -E --avm avmplus command to use -a --asc compiler to use -g --globalabc DEPRECATED but still works - use builtin.abc (used t...
XBL - Archive of obsolete content
e are a few subtle (and not-so-subtle) differences. For example, names of the elements are different. Also sXBL lacks some features of XBL, such as bindings inheritance and defining methods/properties on bound elements. XBL 2.0 (W3C Candidate Recommendation) was developed to address problems found in XBL 1.0 and to allow for implementations in a broader
range of Web browsers. In 2009 Mozilla announced plans to implement XBL2 in future versions of Gecko. Some differences between sXBL and XBL2 are listed in an article by Anne van Ke ( seesteren (November, 2005). An overview of differences between Mozilla XBL and XBL2 is in a newsgroup posting by Jonas ...
A XUL Bestiary - Archive of obsolete content
bdirectory as needed. Skin The skin is the CSS and graphics that makes up the look or presentation of XUL. XUL itself contains very little provision for how widgets are to be presented in the interface. Even prior to the skinning that takes place with the global skin, which is loaded in almost every XUL file you see in Mozilla (and whose absence from your own XUL files can make your work look st
range, senseless, or invisible altogether), a xul.css file is loaded which provides some very basic presentational information for the widgets in the toolkit. So CSS is a lot of what makes XUL XUL, especially with the advent of CSS2 and its new positioning capabilities. Skinning is most often brought up in the context of dynamic changes to the overall look of an application. Though this is not yet in ...
firstdayofweek - Archive of obsolete content
<< XUL Reference home firstdayofweek Type: integer which day of the week to display as the first day in the grid. The values
range from 0 to 6, where 0 is Sunday and 6 is Saturday. The default value is determined by the locale, so only use this attribute if you want to override it. ...
panel.flip - Archive of obsolete content
flip Type: string Normally, when a popup opens near the edge of the screen, it flips over to open on the opposite side of the anchor, so that it doesn't extend off the screen. For example, if the menu doesn't have room to open downward, it flips to open upward instead; this is a vertical flip. Horizontal flipping doesn't normally happen, since this would cause menus to open in st
range places. For arrow popups, however, being able to flip horizontally makes sense. This attribute, set to both, permits that behavior. You will not normally have to use this attribute, since it's automatically applied to arrow panels. An arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. A sliding pan...
moveByOffset - Archive of obsolete content
<< XUL Reference home moveByOffset( offset , isSelecting, isSelecting
Range) Return type: no return value If offset is positive, adjusts the focused item forward by that many items. If offset is negative, adjusts the focused item backward by that many items. If isSelecting is true, then the selection is also adjusted. If isSelecting
Range is also true, then the new item is selected in addition to any currently selected items. If isSelecting
Range is false, any existing selection is cleared. Items that are hidden are skipped. ...
Methods - Archive of obsolete content
lItems removeAllNotifications removeAllTabsBut removeCurrentNotification removeCurrentTab removeItemAt removeItemFromSelection removeNotification removeProgressListener removeSession removeTab removeTabsProgressListener removeTransientNotifications replaceGroup reset rewind scrollByIndex scrollByPixels scrollToIndex select selectAll selectItem selectItem
Range selectTabAtIndex setSelection
Range showPane showPopup sizeTo startEditing stop stopEditing swapDocShells syncSessions timedSelect toggleItemSelection Related DOM element methods DOM:element.addEventListener DOM:element.appendChild DOM:element.compareDocumentPosition DOM:element.dispatchEvent DOM:element.getAttribute DOM:element.getAttributeNode DOM:element.
Attribute Substitution - Archive of obsolete content
s rules to create matches as the data loads. However, variables determined from a binding are evaluated using a much simpler process. The bug is that this code path for bindings doesn't handle the textnode element properly. Thus, if you use a variable set in a binding, you must ensure the datasource is loaded before the template is built, or just rebuild the template. Another possibilty is to rear
range the RDF such that the values, in this example, the descriptions, are specified before the containers. This issue is fixed in Firefox 3 (Mozilla 1.9) and later. << PreviousNext >> ...
Multiple Queries - Archive of obsolete content
sn't put all the matches for the first query before the matches for the second query. In fact, the order is the same as the examples that only use one query. Compare the multiple query example with an earlier example that used only a single query. The photos have appeared in the same order in both cases. This is because the builder notices that the photos are in an RDF Seq in the datasource and ar
ranges them in the order they appear in the Seq. This and other automated sorting done by the template builder is a fairly complicated process that will be discussed in more detail later. Multiple Queries Using the RDF Simple Syntax You can also use multiple queries with RDF datasources using the simple query syntax. Here is the previous example rewritten using the simple syntax: <hbox id="photosLi...
The Joy of XUL - Archive of obsolete content
tional W3C standard technologies featuring HTML 4.0; Cascading Style Sheets (CSS) 1 and 2; Document Object Model (DOM) Levels 1 and 2; JavaScript 1.5, including ECMA-262 Edition 3 (ECMAscript); XML 1.0. Platform portability Like HTML, XUL is designed to be platform-neutral, making applications easily portable to all of the operating systems on which Mozilla runs. Considering the broad
range of platforms that currently support Mozilla, this may be one of the most compelling features of XUL as a technology for building applications. Since XUL provides an abstraction of user interface components, it delivers on the promise of write-once, run-anywhere. The user interface for all of Mozilla's core applications (Browser, Messenger, Address Book, etc.) is written in XUL with one single...
Adding Properties to XBL-defined Elements - Archive of obsolete content
('Changed to:'+val);"/> This property will always return 77 when retrieved. When set, an alert will be displayed which displays the value to assign to the property. The special variable val holds the value that the property should be assigned to. Use this to validate it or store it. The following decribes what happens in a typical case: There are two elements, one called 'banana' and the other 'o
range'. They each have a custom property called 'size'. When the following line of script is executed: banana.size = o
range.size; The onget script is called for the size property of the o
range. The script calculates the value and returns it. The onset handler of the size property of the banana is called. This script uses the value passed in the val variable and assigns it to the size property of th...
Box Objects - Archive of obsolete content
inal 3 or higher but after one with ordinal 1. The default value if the ordinal is not specified is 1. This means that if you want to change the displayed order of elements, you will often need to adjust the ordinals of several elements. Adjusting the ordinal of an element is not commonly done as you would usually just place the elements in a different order in the source. It might be used to rear
range items later without adjusting the DOM. The following example demonstrates this. Example 4 : Source View <hbox> <button label="One" oncommand="this.ordinal++;"/> <button label="Two" oncommand="this.ordinal++;"/> <button label="Three" oncommand="this.ordinal++;"/> </hbox> If you press the first button, its ordinal will increase by one, from 1 to 2. It will appear at the end of the row since ...
Creating Dialogs - Archive of obsolete content
ondialogaccept="return doSave();" buttonlabelcancel="Cancel" buttonaccesskeycancel="n" ondialogcancel="return doCancel();"> <script> function doSave(){ //doSomething() return true; } function doCancel(){ return true; } </script> <dialogheader title="My dialog" description="Example dialog"/> <groupbox flex="1"> <caption label="Select favourite fruit"/> <radio id="o
range" label="O
ranges because they are fruity"/> <radio id="violet" selected="true" label="Strawberries because of their colour"/> <radio id="yellow" label="Bananas because they are pre-packaged"/> </groupbox> </dialog> The buttons elements can be accessed with the following javascript // the accept button var acceptButt = document.documentElement.getButton("accept") More examples More examp...
Creating a Window - Archive of obsolete content
an be referred to by scripts. You will usually put an id attribute on all elements. The name can be anything you want although it should be something relevant. title="Find Files" The title attribute describes the text that would appear on the title bar of the window when it is displayed. In this case the text 'Find Files' will appear. orient="horizontal" The orient attribute specifies the ar
rangement of the items in the window. The value horizontal indicates that items should be placed horizontally across the window. You may also use the value vertical, which means that the items are placed in a column. This is the default value, so you may leave the attribute off entirely if you wish to have vertical orientation. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> T...
Manipulating Lists - Archive of obsolete content
eturn the content associated with the tab. Changing the selection All of the selection related properties described above may also be assigned a new value to change the selection. In the next example, the selectedIndex property of a radiogroup element is changed based on the value entered in a textbox. This code isn't foolproof though; for example it doesn't check if the value entered is out of
range. You will want to make sure that you add this kind of error checking. Example 3 : Source View <script> function doSelect(){ var val = document.getElementById('number').value; val = Number(val); if (val != null) document.getElementById('level').selectedIndex = val - 1; } </script> <hbox align="center"> <label value="Enter a number from 1 to 3:"/> <textbox id="number"/> <button l...
More Button Features - Archive of obsolete content
uttons with Extra Content Buttons may have arbitrary markup contained inside them, and it will be rendered inside the button. You probably wouldn't use this very often, but you might use it when creating custom elements. For example, the following will create a button where two of the words are red: Example 4 : Source View <button> <description value="This is a"/> <description value="rather st
range" style="color: red;"/> <description value="button"/> </button> Any XUL element may be placed inside the button. HTML elements will be ignored, so you need to wrap them inside a description element. If you specify the label attribute on the button, it will override any content placed inside the button. Button with menupopup You can place a menupopup inside the button to cause a menu to drop dow...
More Tree Features - Archive of obsolete content
e this, as you may have a container that has no children but should still be treated like a container. For example, a directory with no files in it should still be treated like a container whereas a file should not. More about Tree Columns One additional attribute you can add to the tree is enableColumnDrag. (Note the mixed case.) If set to true, the user may drag the column headers around to rear
range the order of the columns. A user will also likely want to change the column widths. You can do this by placing a splitter element in between each treecol element. A small notch will appear in between each column header which the user may drag to change the width of a column. You can use the style class tree-splitter to hide the notch, although the column may still be resized. You can set a minimu...
Scrolling Menus - Archive of obsolete content
when you don't want it to be a drop-down. Example - scrolling list of buttons The following example shows how to create a scrolling list of buttons (you will need to resize the window to see the arrow buttons): Example 1 : Source View <arrowscrollbox orient="vertical" flex="1"> <button label="Red"/> <button label="Blue"/> <button label="Green"/> <button label="Yellow"/> <button label="O
range"/> <button label="Silver"/> <button label="Lavender"/> <button label="Gold"/> <button label="Turquoise"/> <button label="Peach"/> <button label="Maroon"/> <button label="Black"/> </arrowscrollbox> If you try this example, it will first open at full size. However, if you shrink the height of the window, the scroll arrows will appear. Making the window larger again will cause the arr...
Stacks and Decks - Archive of obsolete content
A disadvantage is that the area taken up by the shadow makes the size of the stack larger. Shadowing is very useful for creating the disabled appearance of buttons: Example 2 : Source View <stack style="background-color: #C0C0C0"> <description value="Disabled" style="color: white; padding-left: 1px; padding-top: 1px;"/> <description value="Disabled" style="color: grey;"/> </stack> This ar
rangement of text and shadow colors creates the disabled look under some platforms. Note that events such as mouse clicks and keypresses are passed to the element on the top of the stack, that is, the last element in the stack. That means that buttons will only work properly as the last element of the stack. Decks A deck element also lays out its children on top of each other much like the stack ele...
Tree Box Objects - Archive of obsolete content
l's label changes. In this case, there are other drawing functions that can be used. The simplest is to call invalidateRow() which will redraw a specific row in the tree. The tree will call the view to get the updated data and update the contents of the tree on screen. Other redrawing functions are invalidateCell() to redraw only a single cell invalidateColumn() to redraw a column invalidate
Range() to redraw a
range of rows invalidate() to redraw the entire tree. Note that redrawing does not occur until the calling script ends since Mozilla does not redraw in the background. Note: it is not necessary to run tree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject) as shown in the code examples on this page because: let boxobject = tree.treeBoxObject; Note: is equivalent...
XBL Example - Archive of obsolete content
ly, its parent which is the outer box. The 'page' property is incremented or decremented. This will call the onget script to get the value, increment or decrement the value by one, and then call the onset handler to set the value. setPage method Now let's define the 'setPage' method. It will take one parameter, the page number to set the page to. It will need to make sure the page is not out of
range and then modify the deck's selectedIndex attribute and the text widget's label attribute. <method name="setPage"> <parameter name="newidx"/> <body> <![CDATA[ var thedeck=document.getAnonymousNodes(this)[0].childNodes[0]; var totalpages=this.childNodes.length; if (newidx<0) return 0; if (newidx>=totalpages) return totalpages; thedeck.setAttribute("selectedIn...
XUL Changes for Firefox 1.5 - Archive of obsolete content
> The removeItemAt method was sometime non zero-based due to a bug (bug 236068). This has been fixed in Firefox 1.5 and all code depending on this non zero-based behaviour should be changed. <stringbundle> The <stringbundle> element has a strings property which may be used to retrieve an enumeration of all of the strings in the bundle. Draggable tabs The tabbrowser now allows the user to rear
range tabs by dragging them. <tabbox> The <tabbox> element now supports a selectedIndex attribute to specify the tab to be selected by default. Loading overlays dynamically XUL now supports loading overlays dynamically with the document.loadOverlay function. Original Document Information Author(s): Neil Deakin ...
XUL Questions and Answers - Archive of obsolete content
syntax highlighting? Daniel Glazman has been working on this for his projects. He said the code will be open-source, but it is not released yet (as of Oct 2006). Some teasers are on his blog. Overlaying elements without IDs The original developers only tend to put IDs where they need them. As an extension author, you have at least two options: use DOM methods to dynamically create or rear
range elements file an enhancement request in Bugzilla to have extra IDs added. Displaying graphics and animation in XUL? There are several options for displaying graphics and animation in XUL: <html:canvas> SVG <xul:image> (static images or animated GIF; support for APNG is planned) Plugins Templates with non-RDF datasources? Support for non-RDF datasources for XUL template is planned...
XML - Archive of obsolete content
ts own how these widgets should be rendered, Gecko depends for all but the most basic behavioral and presentational aspects of the widgets upon Cascading Stylesheets. The combination of structure, as defined in the XUL, style as defined by the stylesheets, and the other standards are rendered by Gecko into the interface. The heavy lifting is done by the ingredients rather than the chef. This ar
rangement creates new possibilities for truly cross-platform web applications, application serving, web appliances and embedded systems, and all sort of other things. Like all really good technologies, XUL and its XP cousins are already being used in ways not imagined by their creators and growing propitiously out of control. Author: Ian T. Oeschger Other Documents: XML in Mozilla Original Document...
XUL controls - Archive of obsolete content
<scale min="1" max="10"/> Scale Reference <splitter> Allows the user to adjust the division of space between elements. <splitter collapse="before"> <grippy/> </splitter> Splitter Reference Related Elements: grippy <tab> Description goes here. <tab label="firefox"/> Tab Refe...
grid - Archive of obsolete content
The grid is expected to contain both a columns element as a child which defines the structure of the columns and a rows element as child to define the rows. ...
panel - Archive of obsolete content
flip Type: string Normally, when a popup opens near the edge of the screen, it flips over to open on the opposite side of the anchor, so that it doesn't extend off the screen. For example, if the menu doesn't have room to open downward, it flips to open upward instead; this is a vertical flip. Horizontal flipping doesn't normally happen, since this would cause menus to open in st
range places. For arrow popups, however, being able to flip horizontally makes sense. This attribute, set to both, permits that behavior. You will not normally have to use this attribute, since it's automatically applied to arrow panels. An arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. A sliding pan...
prefwindow - Archive of obsolete content
window. Therefore, an example call to openSubDialog() would look like this: document.documentElement.openSubDialog("chrome://myextension/content/options-sub.xul", "", null) Issues when using prefpanes in prefwindow When you wish to put non-<prefpane> elements to prefwindow, you should place them after all of <prefpane>s. If you put other elements before the first <prefpane>, you possibly see st
range behaviors about switching panes. This is due to bug 296418. Should not: <prefwindow> <script src="config.js"/> <prefpane label="pane1" src="pane1.xul"/> <prefpane label="pane2" src="pane2.xul"/> </prefwindow> Should: <prefwindow> <prefpane label="pane1" src="pane1.xul"/> <prefpane label="pane2" src="pane2.xul"/> <script src="config.js"/> </prefwindow> Related prefpane Prefe...
radio - Archive of obsolete content
label, specified with the label attribute may be added beside the radio button. More information is available in the XUL tutorial. Attributes accesskey, command, crop, disabled, focused, group, image, label, selected, tabindex, value Properties accessKey, accessibleType, control, crop, disabled, image, label, radioGroup, selected, tabIndex, value Examples <radiogroup> <radio id="o
range" label="Red" accesskey="R"/> <radio id="violet" label="Green" accesskey="G" selected="true"/> <radio id="yellow" label="Blue" accesskey="B" disabled="true"/> </radiogroup> Attributes accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label attribute for the element. c...
radiogroup - Archive of obsolete content
ts to vertical orientation. More information is available in the XUL tutorial. Attributes disabled, focused, preference, tabindex, value Properties accessibleType, disabled, focusedItem, itemCount, selectedIndex, selectedItem, tabIndex, value Methods appendItem, checkAdjacentElement, getIndexOfItem, getItemAtIndex, insertItemAt, removeItemAt Examples <radiogroup> <radio id="o
range" label="Red"/> <radio id="violet" label="Green" selected="true"/> <radio id="yellow" label="Blue"/> </radiogroup> Attributes disabled Type: boolean Indicates whether the element is disabled or not. If this attribute is set, the element is disabled. Disabled elements are usually drawn with grayed-out text. If the element is disabled, it does not respond to user actions, it cannot be...
scale - Archive of obsolete content
A bar displayed either horizontally or vertically allows the user to select a value by dragging a thumb on the bar. Use the orient attribute to specify the orientation of the scale. The default value is horizontal which displays a horizontal scale. Lower values are to the left and higher values are to the right. Set the orient attribute to vertical to use a vertical scale. ...
scrollbar - Archive of obsolete content
the user. The user can adjust the position of the scroll bar by clicking arrows on either end of the scroll bar or by dragging the scroll bar thumb around. More information is available in the XUL tutorial. Attributes curpos, increment, maxpos, pageincrement Examples <scrollbar curpos="5" maxpos="50"/> Attributes curpos Type: integer The current position of the scrollbar, which
ranges from 0 to the value of the maxpos attribute. The default value is 0. increment Type: integer The amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). The default value is 1. maxpos Type: integer The maximum position of the scrollbar. The default value is 100. ...
tree - Archive of obsolete content
ee-row(odd) { background-color: #EEEEEE; } treechildren::-moz-tree-row(odd, selected) { background-color: #FFFFAA; } treechildren::-moz-tree-cell-text(selected) { color: #000000; } treechildren::-moz-tree-cell-text(odd, selected) { color: #000000; } If using a content tree view, use the following to get the value of the id attribute for each of the selected rows of a tree: var idList = []; var
rangeCount = tree.view.selection.get
RangeCount(); for (var i = 0; i <
rangeCount; i++) { var start = {}; var end = {}; tree.view.selection.get
RangeAt(i, start, end); for (var c = start.value; c <= end.value; c++) { idList.push(tree.view.getItemAtIndex(c).firstChild.id); } } The following returns a array of the indicies of the rows where the value is checked in a checkbox type column: f...
Deploying XULRunner - Archive of obsolete content
want to have a look at the Branding section of XULRunner tips. Windows On Windows, XULRunner does not yet have a complete built-in installation solution; app developers should use pre-existing solutions for a native Windows installer. An example of one such solution may be found in the article: Creating a Windows Inno Setup installer for XULRunner applications. The installed files should be ar
ranged in the following directory structure: installdir/ application.ini components/ ... components which are part of the application chrome/ ... chrome which is part of the application ... additional application files such as icons, etc myapplicationname.exe (This is the "stub executable"... you should copy and rename this file from xulrunner...
Getting started with XULRunner - Archive of obsolete content
the XULRunner entry point for your application. It specifies how your application intends to use the XULRunner platform as well as configure some information that XULRunner uses to run your application. Here is mine: [App] Vendor=XULTest Name=myapp Version=1.0 BuildID=20100901 ID=xulapp@xultest.org [Gecko] MinVersion=1.8 MaxVersion=200.* Note: The MinVersion and MaxVersion fields indicate the
range of Gecko versions your application is compatible with; make sure that you set them so that the version of XULRunner you're using is in that
range, or your application won't work. Note: Make sure your application name is lowercase and longer than 3 characters Step 5: Set up the chrome manifest The chrome manifest file is used by XULRunner to define specific URIs which in turn are used to locate...
Mozilla release FAQ - Archive of obsolete content
Mozilla? Mozilla is continually available via CVS, and also is occasionally released as versioned numbers. If built from CVS, the date of the CVS checkout is the best way to refer to the version, otherwise use the release number. Older versions used milestone numbers (e.g. the Milestone 7 release was known as M7). What is the relation between Mozilla versions and Netscape versions? The current ar
rangement between Netscape (AOL) and the Mozilla project is that Mozilla develops its own releases, and when Netscape (AOL) is preparing to make a release, it takes the current version of Mozilla, makes modifications, and does its own QA. In return for this, Netscape (AOL) contributes developers to work on the project. The Netscape versions may have a different look/feel than Mozilla versions, and also...
2006-10-06 - Archive of obsolete content
entation about extracting them. Brian King also mentions that documentation on handling message headers on the UI side would be helpful. Cedric Corazza recommends that the proposed documention should be made available on the l10n cvs once it reaches a decent stage so that localizers can get a head-start on the localization before the final version is made available. Updated : Need UI to Rear
range Tags Peter Lairo suggested some UI should be available for rearranging tags. Related: bug 342065 Meetings None for this week. ...
External resources for plugin creation - Archive of obsolete content
Project: Nixysa Project Home Page Description (from the home page): Nixysa is a framework written in Python to automatically generate glue code for NPAPI plugins (plugins for browsers such as Google Chrome or Firefox), letting you easily expose C++ classes to Javascript from a simple IDL representation. Nixysa was originally conceived for the needs of O3D, but is flexible enough to support a wide
range of use cases. Project: JUCE Project Home Page Description (from the home page): JUCE (Jules' Utility Class Extensions) is an all-encompassing C++ class library for developing cross-platform applications. It contains pretty much everything you're likely to need to create most applications, and is particularly good for creating highly-specialised UIs and for handling graphics and sound. Supported...
NPP_NewStream - Archive of obsolete content
); Parameters The function has the following parameters: instance Pointer to current plug-in instance. type Pointer to MIME type of the stream. stream Pointer to new stream. seekable Boolean indicating whether the stream is seekable: true: Seekable. Stream supports random access through calls to NPN_RequestRead (for example, local files or HTTP servers that support byte-
range requests). false: Not seekable. The browser must copy data in the stream to the local cache to satisfy random access requests made through NPN_RequestRead. stype Out parameter. The plugin should set this value to request a mode for the stream. For more information about each of these values, see Directions in this section. NP_NORMAL (Default): Delivers stream data to the instance i...
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
essary to tell applications using newer versions of Gecko to unpack the plugin because DLLs can't be loaded from XPI files. Providing updates When plugins are packaged in this way they can make use of the built in add-on update system. This allows a remote update file to be read periodically and an updated version of the plugin offered to the user or to mark the plugin as compatible with a wider
range of applications. This is performed by including an updateURL in the install manifest. This should point to an update.rdf file on the internet which will include the updated versions and version information for the plugin. ...
.htaccess ( hypertext access ) - Archive of obsolete content
Redirects can be made on a temporary basis or permanently by supplying the status codes. Redirect 301 / http://example.com/ # redirect the traffic to the directory to example.com , Permanent Redirect Redirect 302 / http://example.com/ # redirect the traffic to the directory to example.com , Temporary Redirect Blocking : htaccess also facilitates blocking traffic based on IP and IP
range, Also, use to block bad bots, rippers, and referrers; often used to restrict access by Search Engine spiders. deny from 146.0.74.205 # Blocks all access from 146.0.74.205 to the directory SSI or Server Side Include : Include external files to each file requested by the user without the need to write include statements in the file; you can have them automatically attached to a...
::-ms-fill - Archive of obsolete content
lor cursor display (values block, inline-block, none) font height margin -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color, outline-style, and outline-width padding transform and transform-origin visibility Syntax ::-ms-fill Example HTML <progress value="10" max="50"></progress> CSS progress::-ms-fill { background-color: o
range; } Result A progress bar using this style might look something like this: ...
::-ms-ticks-after - Archive of obsolete content
These ticks are not shown by default. To show them, set the control's display property to block. It is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. To do so would create three sets of tick marks, but the best user experience is one set. ...
::-ms-ticks-before - Archive of obsolete content
These ticks are not shown by default. To show them, set the control's display property to block. It is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. To do so would create three sets of tick marks, but the best user experience is one set. ...
::-ms-tooltip - Archive of obsolete content
The ::-ms-tooltip CSS pseudo-element is a Microsoft extension that represents the tooltip of a slider control. A slider control is one possible representation of <input type="
range">. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-tooltip in its selector. Other properties are ignored. display visibility Syntax ::-ms-tooltip ...
azimuth - Archive of obsolete content
aker setups allow for a fully three-dimensional stage. Initial valuecenterApplies toall elementsInheritedyesComputed valuenormalized angleAnimation typediscrete Syntax <angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] | behind ] | leftwards | rightwards Values angle Audible source position is described as an angle within the
range -360deg to 360deg. The value 0deg means directly ahead in the center of the sound stage (this is the default value). 90deg is to the right, 180deg is behind, and 270deg or -90deg is to the left. Positional keywords left-side: Same as 270deg. left-side behind: Same as 270deg. far-left: Same as 300deg. far-left behind: Same as 240deg. left: Same as 320deg. left behind: Same as 220deg. ...
Processing XML with E4X - Archive of obsolete content
<p>text</p></body></html>; alert(xhtml.head); // No need to specify a namespace on subelements here either Non-default var xhtml = <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Embedded SVG demo</title> </head> <body> <h1>Embedded SVG demo</h1> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"> <circle cx="50" cy="50" r="20" stroke="o
range" stroke-width="2px" fill="yellow" /> </svg> </body> </html>; alert(xhtml.name().localName); // Alerts "html" alert(xhtml.name().uri); // Alerts "http://www.w3.org/1999/xhtml" To access elements that are within a non-default namespace, first create a Namespace object encapsulating the URI for that namespace: var svgns = new Namespace('http://www.w3.org/2000/svg'); This can now be ...
VBArray.lbound - Archive of obsolete content
osoft extension and is only supported in Internet Explorer. The VBArray.lbound method returns the lowest index value used in the specified dimension of a VBArray. Syntax safeArray.lbound(dimension) Remarks If the VBArray is empty, the lbound method returns undefined. If dimension is greater than the number of dimensions in the VBArray, or is negative, the method generates a "Subscript out of
range" error. Parameters safeArray A VBArray object. dimension Optional Optional. The dimension of the VBArray for which the lower bound index is wanted. If omitted, lbound behaves as if a 1 was passed. Example The following example consists of three parts. The first part is VBScript code to create a Visual Basic safe array. The second part is JavaScript code that determines the number of dim...
VBArray.ubound - Archive of obsolete content
ubound(dimension) Parameters safeArray A VBArray object. dimension Optional The dimension of the VBArray for which the higher bound index is wanted. If omitted, ubound behaves as if a 1 was passed. Remarks If the VBArray is empty, the ubound method returns undefined. If dim is greater than the number of dimensions in the VBArray, or is negative, the method generates a "Subscript out of
range" error. Example The following example consists of three parts. The first part is VBScript code to create a Visual Basic safe array. The second part is JavaScript code that determines the number of dimensions in the safe array and the upper bound of each dimension. Both of these parts go into the <HEAD> section of an HTML page. The third part is the JavaScript code that goes in the <BODY> sectio...
VBArray - Archive of obsolete content
ly. The safeArray argument must have obtained a VBArray value before being passed to the VBArray constructor. This can only be done by retrieving the value from an existing ActiveX or other object. VBArrays can have multiple dimensions. The indices of each dimension can be different. The dimensions method retrieves the number of dimensions in the array; the lbound and ubound methods retrieve the
range of indices used by each dimension. Example The following example consists of three parts. The first part is VBScript code to create a Visual Basic safe array. The second part is JavaScript code that converts the Visual Basic safe array to a JavaScript array. Both of these parts go into the <HEAD> section of an HTML page. The third part is the JavaScript code that goes in the <BODY> section to r...
Server-Side JavaScript - Archive of obsolete content
tion to continue to advance the state of Web technologies. Today with computing cycles having increased more than 10-fold and Mozilla's work on Rhino (JavaScript interpreter in Java) and SpiderMonkey (JavaScript interpreter in C) and JavaScript itself, we have very solid foundations for JavaScript to be extraordinarily useful and applicable on the server-side again -- with performance in the same
range as popular server-side environments like PHP and Ruby on Rails. Now, with TraceMonkey available, JavaScript (both client side and server-side) can see 20x to 40x speed improvements according to Brendan Eich, Mozilla CTO and creator of JavaScript. Server-Side JavaScript is another way in which, as this article quotes Eich, "Mozilla wants to 'get people thinking about JavaScript as a more genera...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
ally, that's all that was needed. The reason for the class value being card is that the original idea was to style each fish's description like a trading card. Although this design approach was abandoned fairly quickly, the class name stuck, kind of like a barnacle. Giving the Fish Some Style With the markup all set, it was time to style. The idea was to have the fish listed in a side-by-side ar
rangement, sort of like a two-column table, only without the table. This was most easily accomplished by floating the div elements themselves. Since I wanted them to be side by side, it was important to be sure the total width of the element boxes (including margins) was less than 50%, so the first step was this: div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} By making the content of each...
background-size - Archive of obsolete content
me ago I'v listed Opera in the property template table and removed Netscape because Netscape is Gecko based and Opera has a global market share of > 2% (> 40% in some European countries). User:Jurgen Jeka 2009-08-04 <hr> Is there anyway to have the -moz-border-image only apply if -moz-background-size is not supported? I'm guessing not, just asking because having both rules in for 3.6 creates a st
range effect: -moz-border-image gets inherited by every element on the page User:robertc 2009-08-08 -moz-border-image should not inherit. Some example code? User:Jurgen Jeka 2009-08-09 OK, here's a page with both rules - the CSS is derived from the code on the page here, this is what it looks like in 3.6a2pre on Linux, the background image appears on the whole page, and then again behind the main cont...
XForms Custom Controls - Archive of obsolete content
ntrols are defined: xforms.xml - contains the base bindings for output, label, trigger, submit, case, message, hint, help, alert, upload and repeat XForms controls. input.xml - contains the base bindings for input, secret and textarea XForms controls. select.xml - contains the base bindings for select and select1 XForms controls (except minimal/default select1 that is hosted in select1.xml file)
range.xml - contains the base bindings for the
range XForms control. xforms.xml also defines the few base bindings that are common for all XForms controls. These are: xformswidget-general - defines utility properties and methods common for all XForms controls xformswidget-accessors - defines the methods that are allow the bindings to work with bound instance nodes and the XForms element itself. xform...
XForms Alert Element - Archive of obsolete content
The message of the alert element can exist in instance data, in a remote document, or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text. ...
Window: devicelight event - Archive of obsolete content
entLight.enabled preference (bug 1462308). Bubbles No Cancelable No Interface SensorCallback Target DefaultView (window) Other properties Property Type Description value Read only Double (float) The sensor data for ambient light in Lux. min Read only Double (float) The minimum value in the
range the sensor detects (if available, 0 otherwise). max Read only Double (float) The maximum value in the
range the sensor detects (if available, 0 otherwise). Examples window.addEventListener('devicelight', function(event) { console.log(event.value); }); Specifications Specification Status Comment Ambient Light SensorThe definition of 'Ambient ...
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
ord to overlook or ignore accessibility standards. Within the web environment, the accessibility standards are closely tied to HTML, XML, XHTML, and other W3C standards. By integrating and supporting the accessibility guidelines, an organization can offer their product lines or services to a larger and more diverse user base. Interchangeability If a user experiences consistent behavior across a
range of products, they can predict how a particular action or function will work or respond. As a product provider, the goal should be the element of least surprise. By instilling a set of global goals and standards into an organizational infrastructure, an organization is ensuring its end users the ability to interact, function, view, and process information consistently as they transition from one d...
RDF in Mozilla FAQ - Archive of obsolete content
Templates XUL templates are created by specifying a datasources attribute on an element in a XUL document. There are two "forms" that XUL templates may be written in. The "simple" form, which is currently the most common form in the Mozilla codebase, and the "extended" form, which allows for sophisticated pattern matching against the RDF graph. See the XUL:Template Guide. (These are bizarrely ar
ranged because the eventual intent is to introduce templates using the extended form -- which in many ways is conceptually simpler, even if more verbose -- and then treat the "simple" form as a shorthand for the extended form.) What can I build with a XUL template? You can build any kind of content using a XUL template. You may use any kind of tag (including HTML, or arbitrary XML) in the <action> se...
Windows Media in Netscape - Archive of obsolete content
l // Redirect users to http://www.microsoft.com/windows/windowsmedia/download/default.asp } else { //Control was correctly created //Proceed with scripting calls, etc. } </script> Note that if the control is correctly instantiated, you will know that it is a version of Windows Media Player 7 and up, since the clsid used with the object element reflects the unique component in this version
range. Scripting the Control Namespacing issues are the most important distinction between scripting the Windows Media control in IE and Netscape 7.1. In code deployed for IE, invocations of the sort Player.controls.play(); are common, where Player is the id of the object element. In Netscape 7.1, plugins and ActiveX controls are not exposed to the global namespace, but rather as properties of the docu...
XUL Parser in Python - Archive of obsolete content
cts. Extending on the approach in this script, then, you could imagine a kind of introspective XUL chrome that could modify and replicate itself by calling services from the XULParser and XULWriter XPCOM objects. Please feel free to suggest changes, change the format of the results output, or adapt this script in any way you want. I have probably made some errors and undoubtedly written some st
range, graceless Python. Most of all, please feel free to experiment with the Mozilla development platform in this way or in any other way you can imagine. Original document information Author: Ian Oeschger ...
Index - Game development
back and atmosphere. Web-based audio is maturing fast, but there are still many browser differences to navigate. We often need to decide which audio parts are essential to our games' experience and which are nice to have but not essential, and devise a strategy accordingly. This article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a
range of platforms as possible. 27 Crisp pixel art look with image-rendering 2D, 3D, CSS, Canvas, Games, JavaScript, WebGL, image-rendering, pixel This article discusses a useful technique for giving your canvas/WebGL games a crisp pixel art look, even on high definition monitors. 28 Efficient animation for web games Animation, Games, JavaScript This article co...
Introduction to game development for the Web - Game development
With modern Web technologies and a recent browser, it's entirely possible to make stunning, top-notch games for the Web. And we're not talking about simple card games or multi-player social games that have in the olden days been done using Flash(R). We're talking about kick-ass 3D action shooters, RPGs, and more. ...
Game distribution - Game development
ted game into the wild. This includes hosting it yourself online, submitting it to open marketplaces, and submitting it to closed ones like Google Play or the iOS App Store. Benefits of HTML5 over native Building games with HTML5 gives you extra advantages, such as: Multiplatform bliss The technology itself is multiplatform, so you can write the code once and target multiple devices. This can
range from low-end smartphones or tablets, through laptops and desktop computers, to smart TVs, watches or even a fridge if it can handle a modern enough browser. You don't need to have separate teams to work on the same title targeting different platforms with only one code base to worry about. You can spend more time and money on Promotion and Monetization. Instant updates You don't have to wait s...
Building up a basic demo with PlayCanvas editor - Game development
-- it will add a new cylinder shape to the scene. Now follow the same steps as we did before when coloring the cube: Create a new material using the Add Asset (plus) button. Make sure the New Material in the Assets panel is selected, to bring up the entity inspector. Give the material a new name, along the lines of cylinderMaterial. Click diffuse, then click the color picker -- give it an o
range color (we used FF9500.) Drag and drop the cylinderMaterial icon onto the cylinder object on the sceene to apply that color. Follow the same approach again to add a cone to the scene, giving it a grayish color (we used EAEFF2.) You should now have three shapes on your scene, something like the below screenshot. Animating our scene Animating 3D models might be considered an advanced thing ...
Building up a basic demo with the PlayCanvas engine - Game development
l -- add the following lines below the previous code. var boxMaterial = new pc.PhongMaterial(); boxMaterial.diffuse.set(0, 0.58, 0.86); boxMaterial.update(); box.model.model.meshInstances[0].material = boxMaterial; By diffusing the light on the object we can give it it's own color --we'll choose a nice familiar blue. Note: In PlayCanvas, the color channel values are provided as floats in the
range 0-1, instead of integers of 0-255 as you might be used to using on the Web. After the material is created and its color is set, it has to be updated so our changes are going to be applied. Then all we need to do is set the box's material to the newly created boxMaterial. Congratulations, you've created your first object in a 3D environment using PlayCanvas! It was easier than you thought, righ...
Desktop gamepad controls - Game development
ache containing the information about the buttons from the previous frame and the status containing the information from the current frame. The pressed() function gets the input data and sets the information about it in our object, and the axes property stores the array containing the values signifying the amount an axis is pressed in the x and y directions, represented by a float in the (-1, 1)
range. After the gamepad is connected, the information about the controller is stored in the object: connect: function(event) { GamepadAPI.controller = event.gamepad; GamepadAPI.active = true; }, The disconnect function removes the information from the object: disconnect: function(event) { delete GamepadAPI.controller; GamepadAPI.active = false; }, The update() function is executed...
Implementing controls using the Gamepad API - Game development
ttonPressed('B')) { this.managePause(); } } If gamepadAPI.turbo is true and the given buttons are pressed (or held), we execute the proper functions assigned to them. In this case, pressing or holding A will fire the bullet and pressing B will pause the game. Axis threshold The buttons have only two states: 0 or 1, but the analog sticks can have many different values -- they have a float
range between -1 and 1 along both the X and Y axes. Gamepads can get dusty from lying around inactive, meaning that checking for exact -1 or 1 values can be a problem. For this reason, it can be good to set a threshold for the value of the axis to take effect. For example, the Fridge tank will turn right only when the X value is bigger than 0.5: if(gamepadAPI.axesStatus[0].x > 0.5) { this.player.an...
Techniques for game development - Game development
ons and CSS animations, and JavaScript loops involving window.requestAnimationFrame. Audio for Web Games Audio is an important part of any game -- it adds feedback and atmosphere. Web-based audio is maturing fast, but there are still many browser differences to negotiate. This article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a
range of platforms as possible. 2D collision detection A concise introduction to collision detection in 2D games. Tilemaps Tiles are a very popular technique in 2D games for building the game world. These articles provide an introduction to tilemaps and how to implement them with the Canvas API. ...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
ntents of a page are visibly populated. It is the average time at which visible parts of the page are displayed. Expressed in milliseconds, and dependent on the size of the viewport, the lower the score, the better. 431 Stacking context CSS, CodingScripting, Glossary Stacking context refers to how elements on a webpage appear to sit on top of other elements, just as you can ar
range index cards on your desk to lie side-by-side or overlap each other. 432 State machine CodingScripting, Finite, Glossary, Input, Mealy, Moore, State Machine, Turing Machine A state machine is a mathematical abstraction used to design algorithms. A state machine reads a set of inputs and changes to a different state based on those inputs. 433 Statement Beginner, ...
Modem - MDN Web Docs Glossary: Definitions of Web-related terms
A modem ("modulator-demodulator") is a device that converts digital information to analog signals and vice-versa, for sending data through networks. Different kinds are used for different networks: DSL modems for telephone wires, WiFi modems for short-
range wireless radio signals, 3G modems for cellular data towers, and so on. Modems are different from routers, but many companies sell modems combined with routers. Learn more General knowledge Modem on Wikipedia ...
Public-key cryptography - MDN Web Docs Glossary: Definitions of Web-related terms
wner of the private key could decrypt it. However, they are typically much slower than symmetric algorithms and the size of message they can encrypt is proportional to the size of the key, so they do not scale well for long messages. As a result, it's common for an encryption system to use a symmetric algorithm to encrypt the message, then a public-key system to encrypt the symmetric key. This ar
rangement can confer the benefits of both systems. Commonly used public-key cryptosystems are RSA (for both signing and encryption), DSA (for signing) and Diffie-Hellman (for key agreement). ...
Cascade and inheritance - Learn web development
understand the cascade, specificity, and inheritance, then don't worry! This is definitely the most complicated thing we've covered so far in the course, and is something that even professional web developers sometimes find tricky. We'd advise that you return to this article a few times as you continue through the course, and keep thinking about it. Refer back here if you start to come across st
range issues with styles not applying as expected. It could be a specificity issue. Overview: Building blocks Next In this module Cascade and inheritance CSS selectors Type, class, and ID selectors Attribute selectors Pseudo-classes and pseudo-elements Combinators The box model Backgrounds and borders Handling different text directions Overflowing content Values an...
Images, media, and form elements - Learn web development
items in it. All of the <div> elements have a background color and stretch to fill the row and column. The image, however, does not stretch. If you are following these lessons in order then you may not have looked at layout yet. Just keep in mind that replaced elements, when they become part of a grid or flex layout, have different default behaviors, essentially to avoid them being stretched st
rangely by the layout. To force the image to stretch to fill the grid cell it is in, you'd have to do something like following: img { width: 100%; height: 100%; } This would however stretch the image, so probably isn't what you'd want to do. Form elements Form elements can be a tricky issue when it comes to styling with CSS, and the Web Forms module contains detailed guides to the trickier asp...
Type, class, and ID selectors - Learn web development
applied to them. It can select an element that has the id set on it, and you can precede the ID with a type selector to only target the element if both the element and ID match. You can see both of these uses in the following example: Warning: Using the same ID multiple times in a document may appear to work for styling purposes, but don't do this. It results in invalid code, and will cause st
range behavior in many places. Note: As we learned in the lesson on specificity, an ID has high specificity and will overrule most other selectors. This can make them difficult to deal with. In most cases it is preferable to add a class to the element rather than use an ID, however if using the ID is the only way to target the element -- perhaps because you do not have access to the markup and so ca...
Sizing items in CSS - Learn web development
ainer. This is because percentages resolve against the size of the containing block. With no percentage applied our <div> would take up 100% of the available space, as it is a block level element. If we give it a percentage width, this becomes a percentage of the space it would normally fill. Percentage margins and padding If you set margins and padding as a percentage, you may notice some st
range behavior. In the below example we have a box. We have given the inner box a margin of 10% and a padding of 10%. The padding and margin on the top and bottom of the box are the same size as the margin on the left and right. You might expect for example the percentage top and bottom margins to be a percentage of the element's height, and the percentage left and right margins to be a percentage o...
Styling tables - Learn web development
h-child(3) { width: 15%; } thead th:nth-child(4) { width: 35%; } th, td { padding: 20px; } The most important parts to note are as follows: A table-layout value of fixed is generally a good idea to set on your table, as it makes the table behave a bit more predictably by default. Normally, table columns tend to be sized according to how much content they contain, which produces some st
range results. With table-layout: fixed, you can size your columns according to the width of their headings, and then deal with their content as appropriate. This is why we've selected the four different headings with the thead th:nth-child(n) (:nth-child) selector ("Select the nth child that is a <th> element in a sequence, inside a <thead> element") and given them set percentage widths. The entire co...
Test your skills: Flexbox - Learn web development
in the HTML below, a div with a class of .parent which contains another div with a class of .child. Use Flexbox to center the child inside the parent. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Flex Layout Four In this final task ar
range these items into rows as in the image. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are ...
Grids - Learn web development
low. To see something that looks more grid-like, we will need to add some columns to the grid. Let's add three 200-pixel columns here. You can use any length unit, or percentages to create these column tracks. .container { display: grid; grid-template-columns: 200px 200px 200px; } Add the 2nd declaration to your CSS rule, then reload the page, and you should see that the items have rear
ranged themselves one into each cell of the created grid. Simple Grid Example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 Arial, Helvetica, sans-serif; } .container > div { border-radius: 5px; padding: 10px; background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); } <div class="container"> <div>One</div> <div>Two</div> <div>Thre...
Introduction to CSS layout - Learn web development
s you want to lay out; all its direct children then become flex items. We can see this in a simple example. The HTML markup below gives us a containing element, with a class of wrapper, inside which are three <div> elements. By default these would display as block elements, below one another, in our English language document. However, if we add display: flex to the parent, the three items now ar
range themselves into columns. This is due to them becoming flex items and being affected by some initial values that flexbox sets on the flex container. They are displayed in a row, because the initial value of flex-direction set on their parent is row. They all appear to stretch to the height of the tallest item, because the initial value of the align-items property set on their parent is stretch. Th...
Supporting older browsers - Learn web development
bly hard to test older browsers. One way is to use an online testing tool such as Sauce Labs, as detailed in the Cross browser testing module. You can also download and install Virtual Machines, and run older versions of browsers in a contained environment on your own computer. Having access to older versions of Internet Explorer is particularly useful, and for that purpose, Microsoft has made a
range of Virtual Machines available for free download. These are available for Mac, Windows and Linux operating systems and so are a great way to test in old and modern Windows browsers even if you are not using a Windows computer. Summary You now have the knowledge to confidently use techniques such as Grid and Flexbox, create fallbacks for older browsers, and make use of any new techniques that mig...
CSS FAQ - Learn web development
ch as possible. Specificity in CSS When multiple rules apply to a certain element, the rule chosen depends on its style specificity. Inline style (in HTML style attributes) has the highest specificity and will override any selectors, followed by ID selectors, then class selectors, and eventually element selectors. The text color of the below <div> will therefore be red. div { color: black; } #o
range { color: o
range; } .green { color: green; } <div id="o
range" class="green" style="color: red;">This is red</div> The rules are more complicated when the selector has multiple parts. More detailed information about how selector specificity is calculated can be found in the CSS 2.1 Specification chapter 6.4.3. What do the -moz-*, -ms-*, -webkit-*, -o-* and -khtml-* properties do? These propert...
Using CSS generated content - Learn web development
document's structure. Note: Content specified in a stylesheet does not become part of the DOM. Specifying content in a stylesheet can cause complications. For example, you might have different language versions of your document that share a stylesheet. If you specify content in your stylesheet that requires translation, you have to put those parts of your stylesheet in different files and ar
range for them to be linked with the appropriate language versions of your doucment. This issue does not arise if the content you specify consists of symbols or images that apply in all languages and cultures. Examples Text content CSS can insert text content before or after an element. To specify this, make a rule and add ::before or ::after to the selector. In the declaration, specify the content...
Web fonts - Learn web development
t/font-style to choose between them, rather than having to call all the different members of the font family different names. @font-face tip: define font-weight and font-style to keep your CSS simple by Roger Johansson shows what to do in more detail. Note: You can also specify particular font-variant and font-stretch values for your web fonts. In newer browsers, you can also specify a unicode-
range value, which is a specific
range of characters you want to use out of the web font -- in supporting browsers, only the specified characters will be downloaded, saving unnecessary downloading. Creating Custom Font Stacks with Unicode-
Range by Drew McLellan provides some useful ideas on how to make use of this. Variable fonts There is a newer font technology available in browsers called variable...
What are browser developer tools? - Learn web development
This article explains how to use the basic functions of your browser's devtools. Note: Before you run through the examples below, open the Beginner's example site that we built during the Getting started with the Web article series. You should have this open as you follow the steps below. ...
What is a Domain Name? - Learn web development
hough most are around 2-3. The full list of TLDs is maintained by ICANN. Label (or component) The labels are what follow the TLD. A label is a case-insensitive character sequence anywhere from one to sixty-three characters in length, containing only the letters A through Z, digits 0 through 9, and the - character (which may not be the first or last character in the label). a, 97, and hello-st
range-person-16-how-are-you are all examples of valid labels. The label located right before the TLD is also called a Secondary Level Domain (SLD). A domain name can have many labels (or components). It is not mandatory nor necessary to have 3 labels to form a domain name. For instance, www.inf.ed.ac.uk is a valid domain name. For any domain you control (e.g. mozilla.org), you can create "subdomains"...
What is a web server? - Learn web development
have the same IP address all the time. This is known as a dedicated IP address. (not all ISPs provide a fixed IP address for home lines) A dedicated web server is typically maintained by a third-party. For all these reasons, finding a good hosting provider is a key part of building your website. Examine the various services companies offer. Choose one that fits your needs and budget. (Services
range from free to thousands of dollars per month.) You can find more details in this article. Once you have web hosting service, you must upload your files to your web server. Communicating through HTTP Second, a web server provides support for HTTP (Hypertext Transfer Protocol). As its name implies, HTTP specifies how to transfer hypertext (linked web documents) between two computers. A Protocol ...
CSS basics - Learn web development
the element's top and bottom side (setting it to 0 in this case); the second value affects the left and right side. (Here, auto is a special value that divides the available horizontal space evenly between left and right). You can also use one, three, or four values, as documented in Margin Syntax. background-color: #FF9500; This sets the element's background color. This project uses a reddish o
range for the body background color, as opposed to dark blue for the <html> element. (Feel free to experiment.) padding: 0 20px 20px 20px; This sets four values for padding. The goal is to put some space around the content. In this example, there is no padding on the top of the body, and 20 pixels on the right, bottom and left. The values set top, right, bottom, left, in that order. As with margin, y...
HTML basics - Learn web development
brackets. This states where the element begins or starts to take effect -- in this case where the paragraph begins. The closing tag: This is the same as the opening tag, except that it includes a forward slash before the element name. This states where the element ends -- in this case where the paragraph ends. Failing to add a closing tag is one of the standard beginner errors and can lead to st
range results. The content: This is the content of the element, which in this case, is just text. The element: The opening tag, the closing tag and the content together comprise the element. Elements can also have attributes that look like the following: Attributes contain extra information about the element that you don't want to appear in the actual content. Here, class is the attribute name a...
JavaScript basics - Learn web development
es-not-equal" gives basically the same result with different syntax. Here we are testing "is myVariable NOT equal to 3". This returns false because myVariable IS equal to 3: let myVariable = 3; myVariable !== 3; There are a lot more operators to explore, but this is enough for now. See Expressions and operators for a complete list. Note: Mixing data types can lead to some st
range results when performing calculations. Be careful that you are referring to your variables correctly, and getting the results you expect. For example, enter '35' + '25' into your console. Why don't you get the result you expected? Because the quote marks turn the numbers into strings, so you've ended up concatenating strings rather than adding numbers. If you enter, 35 + 25 you'll get the total of...
What will your website look like? - Learn web development
users will experience and interact with the website. Choosing your assets At this point, it's good to start putting together the content that will eventually appear on your webpage. Text You should still have your paragraphs and title from earlier. Keep these close by. Theme color To choose a color, go to the Color Picker and find a color you like. When you click on a color, you'll see a st
range six-character code like #660066. That's called a hex code (short for hexadecimal), and represents your color. Copy the code down somewhere safe for now. Images To choose an image, go to Google Images and search for something suitable. When you find the image you want, click on the image to get an enlarged view of it. Right-click the image (Ctrl + click on a Mac), choose Save Image As..., ...
Document and website structure - Learn web development
hanted distress letter flew through his window and landed in his lap. He read it hazily and sighed; "better get back to work then", he mused.</p> Would render like this: Planning a simple website Once you've planned out the structure of a simple webpage, the next logical step is to try to work out what content you want to put on a whole website, what pages you need, and how they should be ar
ranged and link to one another for the best possible user experience. This is called Information architecture. In a large, complex website, a lot of planning can go into this process, but for a simple website of a few pages, this can be fairly simple, and fun! Bear in mind that you'll have a few elements common to most (if not all) pages -- such as the navigation menu, and the footer content. If you...
Getting started with HTML - Learn web development
This is permitted in certain circumstances, but it can also break your markup in other circumstances. For example, if we revisit our link example from earlier, we could write a basic version with only the href attribute, like this: <a href=https://www.mozilla.org/>favorite website</a> However, as soon as we add the title attribute in thi...
Index - Learn web development
and made you excited to learn more and get stuck in! 290 React interactivity: Editing, filtering, conditional rendering Beginner, Frameworks, JavaScript, Learn, React, client-side, conditional rendering, filtering So that's it -- our app is now functionally complete. However, now that we've implemented all of our features, we can make a few improvements to ensure that a wider
range of users can use our app. Our next article rounds things off for our React tutorials by looking at including focus management in React, which can improve usability and reduce confusion for both keyboard-only and screenreader users. 291 React interactivity: Events and state Beginner, Frameworks, JavaScript, Learn, React, client-side, events, interactivity, state That's enough ...
Introduction to web APIs - Learn web development
udioDestinationNode, which represents the destination of the audio, i.e. the device on your computer that will actually output it -- usually your speakers or headphones. So how do these objects interact? If you look at our simple web audio example (see it live also), you'll first see the following HTML: <audio src="outfoxing.mp3"></audio> <button class="paused">Play</button> <br> <input type="
range" min="0" max="1" step="0.01" value="1" class="volume"> We, first of all, include an <audio> element with which we embed an MP3 into the page. We don't include any default browser controls. Next, we include a <button> that we'll use to play and stop the music, and an <input> element of type
range, which we'll use to adjust the volume of the track while it's playing. Next, let's look at the JavaS...
Video and Audio APIs - Learn web development
lly, but in reverse to one another. In windBackward() we do the following -- bear in mind that when the interval is active, this function is being run once every 200 milliseconds. We start off with an if statement that checks to see whether the current time is less than 3 seconds, i.e., if rewinding by another three seconds would take it back past the start of the video. This would cause st
range behaviour, so if this is the case we stop the video playing by calling stopMedia(), remove the active class from the rewind button, and clear the intervalRwd interval to stop the rewind functionality. If we didn't do this last step, the video would just keep rewinding forever. If the current time is not within 3 seconds of the start of the video, we simply remove three seconds from the current...
Basic math in JavaScript — numbers and operators - Learn web development
ementor is used to move to the next value when needed. We've actually provided a simple example showing how this is done -- check it out live, and look at the source code to see if you can spot the incrementors! We'll look at loops in detail later on in the course. Let's try playing with these in your console. For a start, note that you can't apply these directly to a number, which might seem st
range, but we are assigning a variable a new updated value, not operating on the value itself. The following will return an error: 3++; So, you can only increment an existing variable. Try this: let num1 = 4; num1++; Okay, st
rangeness number 2! When you do this, you'll see a value of 4 returned -- this is because the browser returns the current value, then increments the variable. You can see that ...
JavaScript object basics - Learn web development
eight'; let myDataValue = '1.75m'; person[myDataName] = myDataValue; Now try saving and refreshing, and entering the following into your text input: person.height Adding a property to an object using the method above isn't possible with dot notation, which can only accept a literal member name, not a variable value pointing to a name. What is "this"? You may have noticed something slightly st
range in our methods. Look at this one for example: greeting: function() { alert('Hi! I\'m ' + this.name.first + '.'); } You are probably wondering what "this" is. The this keyword refers to the current object the code is being written inside -- so in this case this is equivalent to person. So why not just write person instead? As you'll see in the Object-oriented JavaScript for beginners article, ...
Inheritance in JavaScript - Learn web development
chool. Defining a Teacher() constructor function The first thing we need to do is create a Teacher() constructor -- add the following below the existing code: function Teacher(first, last, age, gender, interests, subject) { Person.call(this, first, last, age, gender, interests); this.subject = subject; } This looks similar to the Person constructor in many ways, but there is something st
range here that we've not seen before -- the call() function. This function basically allows you to call a function defined somewhere else, but in the current context. The first parameter specifies the value of this that you want to use when running the function, and the other parameters are those that should be passed to the function when it is invoked. We want the Teacher() constructor to take the s...
Object prototypes - Learn web development
any object types that inherit from Object.prototype, including new object instances created from the Person() constructor. Object.is(), Object.keys(), and other members not defined inside the prototype bucket are not inherited by object instances or object types that inherit from Object.prototype. They are methods/properties available just on the Object() constructor itself. Note: This seems st
range -- how can you have a method defined on a constructor, which is itself a function? Well, a function is also a type of object. See the Function() constructor reference if you don't believe us. You can check out existing prototype properties for yourself -- go back to our previous example and try entering the following into the JavaScript console: Person.prototype The output won't show yo...
Multimedia: Images - Learn web development
lor + 1 bit transparency -- offer no more than 255 colors and just offer no or full transparency per pixel which makes the transparency borders appear hard and jagged. The size is small but the price is visual fidelity. A good online tool for optimizing SVGs is SVGOMG. For PNGs there is ImageOptim online or Squoosh. With photographic motifs that do not feature transparency there is a lot wider
range of formats to chose from. If you want to play it safe, then you would go for well compressed Progressive JPEGs. Progressive JPEGs, in contrast to normal JPEGs, render progressively (hence the name), meaning the user sees a low-resolution version that gains clarity as the image downloads, rather than the image loading at full resolution top-to-bottom or even only rendering once completely download...
Componentizing our React app - Learn web development
stant like so: const taskList = props.tasks.map(task => ( <Todo id={task.id} name={task.name} completed={task.completed} key={task.id} /> ) ); You should always pass a unique key to anything you render with iteration. Nothing obvious will change in your browser, but if you do not use unique keys, React will log warnings to your console and your app may behave st
rangely! Componentizing the rest of the app Now that we've got our most important component sorted out, we can turn the rest of our app into components. Remembering that components are either obvious pieces of UI, or reused pieces of UI, or both, we can make two more components: <Form/> <FilterButton/> Since we know we need both, we can batch some of the file creation work together with a termi...
React interactivity: Editing, filtering, conditional rendering - Learn web development
ple, FILTER_MAP[filter] will evaluate to () => true. Choosing a filter in your browser will now remove the tasks that do not meet its criteria. The count in the heading above the list will also change to reflect the list! Summary So that's it -- our app is now functionally complete. However, now that we've implemented all of our features, we can make a few improvements to ensure that a wider
range of users can use our app. Our next article rounds things off for our React tutorials by looking at including focus management in React, which can improve usability and reduce confusion for both keyboard-only and screenreader users. Previous Overview: Client-side JavaScript frameworks Next In this module Introduction to client-side frameworks Framework main features React Gett...
Beginning our React todo list - Learn web development
tion yet, but that's okay -- we'll style it in a moment. First, consider the JSX we have, and how it corresponds to our user stories: We have a <form> element, with an <input type="text"> for writing out a new task, and a button to submit the form. We have an array of buttons that will be used to filter our tasks. We have a heading that tells us how many tasks remain. We have our 3 tasks, ar
ranged in an un-ordered list. Each task is a list item (<li>), and has buttons to edit and delete it and a checkbox to check it off as done. The form will allow us to make tasks; the buttons will let us filter them; the heading and list are our way to read them. The UI for editing a task is conspicuously absent for now. That's okay - we'll write that later. Accessibility features You may notice som...
Getting started with Svelte - Learn web development
nstance demomstrating the issue. Let's have a quick look at the Svelte REPL and how you'd use it. It looks like so: To start a REPL, open your browser and navigate to https://svelte.dev/repl. On the left side of the screen you'll see the code of your components, and on the right you'll see the running output of your app. The bar above the code lets you create .svelte and .js files and rear
range them. To create a file inside a folder just specify the complete pathname, like this -- components/MyComponent.svelte. The folder will be automatically created. Above that bar you have the title of the REPL. Click on it to edit it. On the right side you have three tabs: The Result tab shows your app output, and provides a console at the bottom. The JS output tab lets you inspect the Ja...
Dynamic behavior in Svelte: working with variables and props - Learn web development
array but our UI is not updated. Remember that in Svelte reactivity is triggered with assignments. That means that the addTodo() function is executed, the element is added to the todos array, but Svelte won't detect that the push method modified the array, so it won't refresh the tasks <ul>. Just adding todos = todos to the end of the addTodo() function would solve the problem, but it seems st
range to have to include that at the end of the function. Instead, we'll take out the push() method and use spread syntax to achieve the same result -- we'll assign a value to the todos array equal to the todos array plus the new object. Note: Array has several mutable operations -- push(), pop(), splice(), shift(), unshift(), reverse(), and sort(). Using them often causes side effects and bugs t...
Introduction to cross browser testing - Learn web development
econd, when we say "across an acceptable number of web browsers", we don't mean 100% of the browsers in the world -- this is just about impossible. You can make some informed calls as to what browsers and devices your users will be using (as we'll discuss in the second article in the series -- see Gotta test 'em all?), but you can't guarantee everything. As a web developer, you need to agree on a
range of browsers and devices that the code definitely needs to work on with the site owner, but beyond that, you need to code defensively to give other browsers the best chance possible of being able to use your content. This is one of the great challenges of web development. Note: We'll cover defensive coding later in the module too. Why do cross browser issues occur? There are many different re...
Cross browser testing - Learn web development
?", "what are the most common types of problems you'll encounter?", and "what are the main approaches for testing, identifying, and fixing problems?" Strategies for carrying out testing Next, we drill down into carrying out testing, looking at identifying a target audience (e.g. what browsers, devices, and other segments should you make sure are tested), lo-fi testing strategies (get yourself a
range of devices and some virtual machines and do ad-hoc tests when needed), higher tech strategies (automation, using dedicated testing apps), and testing with user groups. Handling common HTML and CSS problems With the scene set, we'll now look specifically at the common cross-browser problems you will come across in HTML and CSS code, and what tools can be used to prevent problems from happening, ...
Command line crash course - Learn web development
"ch02-xxxx.png". If you updated the file names using your finder or explorer GUI app, it would take you a long time. Anyway, the terminal is not going away anytime soon. What does the terminal look like? Below you can see some of the different flavours of programs that are available that can get you to a terminal. The next images show the command prompts available in Windows -- there's a good
range of options from the "cmd" program to "powershell" -- which can be run from the start menu by typing the program name. And below, you can see the macOS terminal application. How do you access the terminal? Many developers today are using Unix-based tools (e.g. the terminal, and the tools you can access through it). Many tutorials and tools that exist on the web today support (and sadly assu...
Accessibility API cross-reference
ws the user to make selections from a set of choices. select (abstract role) A line that splits 2 areas from each other SEPARATOR (either in menu or splits panes) SEPARATOR (in menu only) SEPARATOR separator <hr> Adjust in increments from min to max values SLIDER SLIDER SLIDER slider <input type=
range> A system sound SOUND n/a n/a n/a No default semantics in HTML, but semantics and other accessibility features may be provided with ARIA. See also Div n/a n/a n/a <span> Span Kind of like a dial, but controls the value in a related field SPINBUTTON n/a n/a spinbutton Uned...
Embedding API for Accessibility
user to change foreground and background colors, and font sizes. Mozilla already supports some of these options. This document lays out what we already have, and what we'll need later, in the embedding API to support accessibility. Text Zoom on a Per-Window Basis The nsIDOMWindow::GetTextZoom(float *zoomFactor) and nsIDOMWindow::SetTextZoom(float zoomFactor) methods can be used to set a wide
range of text zoom factors on a content window. A zoom factor of 1.0 represents 100%, or normal zoom. For double-sized text, use nsIDOMWindow::SetTextZoom(2.0); Using Accessibility Preferences There are a number of prefs related to accessibility. For the most part, an automatic reframe is performed when one of these prefs is changed. A reframe fixes the appearance of the page to match the new prefs...
Mozilla’s UAAG evaluation report
itching profiles requires the entire application to be relaunched. There is still very little end-user documentation for editing profiles by hand. 11.7 Configure tool bars. (P3) P Can turn on and off toolbars under Show/Hide Can customize personal bookmarks toolbar Bug 15144 is for the ability to add/remove toolbar icons Bug 47418 is for the ability to rear
range toolbars Guideline 12. Provide accessible user agent documentation and help. Checkpoint Title Status Notes/plans 12.1 Accessible documentation. (P1) NR Some end user docs are under Help, Help Contents in Mozilla Here is the main page for Mozilla end user documentation None of these resources have been evaluated for WCAG compliance ...
Continuous Integration
in magnitude (specified per test). Performance sheriffs review the list of alerts on a regular basis and file bugs if appropriate. You can view the current set of alerts on the Perfherder Alerts dashboard. Intermittent failures After functional tests complete, test log data are combined with Treeherder's failure classification data. The result is the Treeherder Intermittent Failures view. The "O
range Factor" is the average number of intermittent test failures that occur per push. The dashboard can be used to view the most frequent intermittent test failures, as well as to inspect historical trends. ...
Cookies Preferences in Mozilla
ork.cookie.lifetimePolicy is set to 1 true = accepts session cookies without prompting false = prompts for session cookies network.cookie.thirdparty.sessionOnly Default Value: false true = restrict third party cookies to the session only false = no restrictions on third party cookies network.cookie.maxNumber Default Value: 1000 Configures the maximum amount of cookies to be stored Valid
range is from 0-65535, RFC 2109 and 2965 require this to be at least 300 network.cookie.maxPerHost Default Value: 50 Configures the maximum amount of cookies to be stored per host Valid
range is from 0-65535, RFC 2109 and 2965 require this to be at least 20 network.cookie.disableCookieForMailNews Default Value: true true = do not accept any cookies from within mailnews or from mail-style URIs f...
Creating a Firefox sidebar
Web publishers can offer visitors a Firefox sidebar to encourage their engagement. There are two ways to create a sidebar for Firefox users: the Social API and an extension. You can choose either depending on your needs and resources. An extension An extension is a kind of add-ons that adds new functionalities to Firefox. There is a wide
range of extensions available, and some of them provide a sidebar. Such kind of sidebar can be a simple Web panel or a full-featured extension that is completely integrated with the browser. There are some ways to create an extension: The new sidebar API has been implemented in Firefox 29 as part of the Add-on SDK. It's the easiest way to create an extension with a sidebar.Obsolete since Gecko 57 You can also build a restartless extension yourself withou...
Performance best practices for Firefox front-end engineers
How do I avoid triggering uninterruptible reflow? Here's a list of things that JavaScript can ask for that can cause uninterruptible reflow, to help you think about the problem. Note that some items in the list may be browser-specific or subject to change, and that an item not occurring explicitly in the list doesn't mean it doesn't cause reflow. For instance, at time of writing accessing event.
rangeOffset triggers reflow in Gecko, and does not occur in the earlier link. If you're unsure whether something causes reflow, check! Note how abundant the properties in that first list are. This means that when enumerating properties on DOM objects (e.g. elements/nodes, events, windows, etc.) accessing the value of each enumerated property will almost certainly (accidentally) cause uninterruptible r...
Site Identity Button
The Site Identity Button is a feature in Firefox that gives users more information about the sites they visit. Depending on the configuration of your website, this button may display a number of different icons. ...
HTMLIFrameElement.sendTouchEvent()
tive to the browser <iframe>'s visible area in CSS pixels. rx An array of numbers representing the x radius of each touch point in CSS pixels. ry An array of numbers representing the y radius of each touch point in CSS pixels. rotationAngles An array of numbers representing the angle of each touch point in degrees. forces An array of numbers representing the intensity of each touch in the
range 0-1. count The number of touches that should be performed. modifiers A number representing a key pressed at the same time the mouse button was clicked: 1 : Alt 2 : Ctrl 4 : Shift 8 : Meta 16 : Alt Gr 32 : Caps Lock 64 : Fn 128 : Num Lock 256 : Scroll 512 : Symbol Lock 1024 : Win Note: You can specify multiple key modifiers separated by a pipe symbol, f...
Gecko SDK
icially released for other platforms; if you need it, you will probably need to build it yourself. Note: You can subscribe to a calendar of the Firefox release schedule. Also, you can view the schedule on the Web. Unpack the SDK tarball to some suitable location. Issues with the OS X SDK If you need to use the xpidl utility to compile IDL files on OS X, it's likely that you will receive a st
range error when running the tool that looks something along the lines of this: dyld: Library not loaded: /opt/local/lib/libintl.3.dylib Referenced from: /Users/varmaa/xulrunner-sdk/bin/./xpidl Reason: image not found Trace/BPT trap Unfortunately, this is caused by a problem with the SDK build process which cannot currently be resolved (see Bugzilla bug #430274). To get around it, you'll need to...
HTTP Cache
n. Reason is that when the writer is interrupted (by e.g. external canceling of the loading channel) concurrent readers would not be able to reach the remaning unread content. This could be improved by keeping the network load running and being stored to the cache entry even after the writing channel has been canceled. When the writer is interrupted, the first concurrent reader in line does a
range request for the rest of the data - and becomes that way a new writer. The rest of the readers are still concurrently reading the content since output stream for the cache entry is again open and kept by the current writer. Lifetime of an existing entry with only a partial content Such a cache entry is first examined in the nsICacheEntryOpenCallback.onCacheEntryCheck callback, where it has to ...
Hacking with Bonsai
at happened when the tree was closed is reviewed to insure that only build related checkins took place. Before the tree is opened, there is a car pool lane where people who have been off on a branch and need a stable tip to merge in can pull the tip for their merge. These people, when they check in, will be "on the hook" for the next day's build. The car pool lane is only available to those who ar
range access ahead of time with the release team. When the tree is re-opened, the web page is updated and the hook is cleared. Use the bonsai query tool to see what's been checked in to the tree lately and to look at differences between versions. Read the introduction to bonsai for more information about queries. The rules No checkins when the tree is closed unless you are fixing a build problem at t...
How to add a build-time test
ile. (example to run the TestCookie program) In the test program: If the test fails, exit with a non-zero status and/or print the string "FAIL" to stdout If the test passes, exit with a zero status and don't print the string "FAIL" (bonus points for printing "PASS" :) ) Write the test so that you expect it to pass on all platforms, since if the test fails, the tree will go o
range (once we've set this up - see bug 352240 for status). For example, to add an xpcshell test to a module, do the following: Copy tools/test-harness/xpcshell-simple/example to yourmoduledir/tests_type, wheretests_type is something that describes your tests. You can of course use unit or test if you're not feeling creative. In <tt>yourmoduledir/tests_type/Makefile.in</tt> change DEPTH, MODULE,...
IPDL Best Practices
This document is intended to help correct these before the formal review process is initiated. Lifetime Management Ensure IPDL deletes your protocol All protocols must be deleted. Period. Are you sending the __delete__ message to trigger protocol deletion? This one is easy to miss, as the corresponding Recv__delete__ function has a stub implementation automatically generated in the base class. Simply calling delete on a pointer to an actor is not enough. Using IPDL generated structs as data structures outside of IPC serialization/deserialization IPDL generated structures are meant to facilitate serialization/deserialization and message passing. ...
IPDL Tutorial
s "in-order", that is, messages are delivered to the receiver in the order that they are sent, regardless of the messages' semantics. If an actor A sends messages M1 then M2 to actor B, B will be awoken to process M1 then M2. Subprotocols and Protocol Management So far we've seen a single protocol, but no real-world situation would have a single protocol in isolation. Instead, protocols are ar
ranged in a managed hierarchy of subprotocols. A sub-protocol is bound to a "manager" which tracks its lifetime and acts as a factory. A protocol hierarchy begins with a single top-level protocol from which all subprotocol actors are eventually created. In Mozilla there are two main top-level protocols: PPluginModule for remote plugins, and PContent for remote tabs. The following example extends the t...
JavaScript OS.Constants
allocate memory ENOSPC No space on device ENOTDIR Is not a directory ENXIO Device no configured or does not support operation EOPNOTSUPP (Not always available under Windows) Operation not supported. EOVERFLOW (Not always available under Windows) Value too large to be stored in datatype. EPERM Operation not permitted E
RANGE Result too large ETIMEDOUT (Not always available under Windows) Operation timed out. EWOULDBLOCK (Not always available under Windows) Operation would block. EXDEV Cross-device link Opening files Unix access rights Defined on all platforms but meaningful only on Unix. S_IRWXU Current User can Read, Write, eXecute the file. Equivalent ...
PromiseWorker.jsm
, {transfers: [aBuf]}); A simple demo showing this in live action can be found here: Github :: PromiseWorker Transfer ArrayBuffer - Worker Side Rejecting the Promise To reject the promise from the worker, simply throw. Various error objects are supported; each one has its specific meaning; they're described below. Supported built-in JavaScript Error are following: EvalError InternalError
RangeError ReferenceError SyntaxError TypeError URIError In addition to them, StopIteration is also supported (note that StopIteration is deprecated). You can also construct and throw your own custom error objects as needed. When custom error is caught by AbstractWorker, toMsg method will be called to convert it into message. The toMsg function should return an object which has exn property, th...
Localization and Plurals
ief thought processes. French Some French speaking places treat 0 as plural while others treat it as singular. The only other singular is 1 while everything else is plural. So pick either plural rule #1 or #2. pluralRule=2 seconds=seconde;secondes minutes=minute;minutes hours=heure;heures days=jour;jours Like many other times when localizing words, gender agreement might force you to rear
range words in a way that the gender is always the same. (seconde vs jour) Chinese A word doesn't change if there is a different number in front of it, so all numbers use the same plural form. With just one plural form, it has to be plural rule #0. For each word to localize, it's just like localizing a single word with no semi-colons needed. pluralRule=0 seconds=? minutes=? hours=? days=? Poli...
Localization quick start guide
move from stage to stage. Note: This guide is written for two types of contributors: those starting a new localization and those joining an existing localization. It is important to know which information applies to which type of contributor. To help you filter through to the most applicable information, note that all information that is unique to those starting a new localization will be in o
range font. All information that is unique to those joining an existing localization will be in blue font. Next >> ...
Localization sign-off reviews
visions diff between the current release revision and your newly proposed release revision. This is generated from the revision attachment in your Bugzilla bug and evaluated to verify the technical accuracy of your new changes. Text in green font represent additions you've made in this new revision. Text in red font represents content you've removed since the last released revision. Unseen here, o
range font represents content that was replaced in your new release revision. Using these colors helps us to identify potential bugs and approve your latest revision with speed while maintaining critical accuracy. All approved! Once your work is entirely approved, be prepared to celebrate! You've accomplished a massive undertaking and you deserve to be rewarded! Go grab a drink with friends and enjoy...
Localization technical reviews
long. This is something to look for, but can be difficult to diagnose immediately. For more info, see bug 435874. Check for bad migration of access keys In the past, it was common to find broken access keys for Safari and Camino in browser/chrome/browser/migration/migration.dtd. For this review, we look at this file to make sure that the access keys look normal. If they don't, we report any st
range access keys or translations that localizers might have changed during their initial translation process. For more info about access keys in the technical review process, see bug 421893. No UTF-7 in the intl.properties file Firefox no longer has a UTF-7 parser. There should not be any UTF-7 encodings in the file toolkit/chrome/global/intl.properties. For more info about UTF-7 in Firefox, see bu...
Localization formats
because file is not compiled into binaries not used as a standard by any other localization project no tools to validate syntax, so a localizer may cause accidental errors that can cause breakage (level of breakage depends on level of error) cannot use po editor, which most localizers know and love gettext (.po) Gettext is a widely-used localization format that uses .po files. With this ar
rangement, content for localization is presented in the following manner: msgid "coming soon" msgstr "Bientot disponible" where the value in the "" of the msgid is the English content, and the value in the "" of the msgstr is the translation. msgstr can be longer translations than just the exact above. For example, below is the entire introduction used for a certificate that was presented to those...
Mozilla Framework Based on Templates (MFBT)
des macros which can be used to annotate an RAII-style guard class, so that any attempt to create an unnamed temporary for it will assert. (An unnamed temporary lives for a shorter period of time than the scope where it's found, so it usually isn't what was desired.) Data structures LinkedList.h implements a type-safe doubly-linked list class. Most new code should use this rather than PRCList.
RangedPtr.h implements
RangedPtr, a smart pointer template whose value may be manipulated only within a
range specified at construction time, and which may be dereferenced only at valid locations in that
range. This pointer is a useful way to expose access to values within an array. RefPtr.h implements various smart pointer templates to simplify reference counting of values of particular classes. Sc...
Basics
: : : an1 an2 an3 ... a n n ] [ x1 x2 x3 : xn ] In Mozilla, MathML runs inside the main browser. So it responds to other browser operations such as the zoom (try View -> Text Zoom), and you can do links a 2 + b 2 = c 2 , apply stylistic effects a 2 + b 2 = c 2 , or use color a 2 + b 2 = c 2 in very st
range ways p(x) q(x) = a0 + a1x + a2 x2 + ... + an-1 xn-1 b0 + b1x + b2 x2 + ... + bn-1 xn-1 . You can also do other weird and risky things which are not portable, bongo warns, such as mixing MathML with other markups lizard + bongo = ? a b d x + MathML and Javascript HTML Content <p> And you can turn to JavaScript and the DOM for dynamic operations. </p> <d...
Mozilla DOM Hacking Guide
ily coded. The relevant code is at nsDOMClassInfo.cpp, around line 4520. These two examples demonstrate the power of the DOM combined with XPConnect and the JavaScript engine. The possibilities are endless. "What do you want to code today?" ;-) All the DOM classes are listed in an enum defined in nsIDOMClassInfo.h, nsDOMClassInfoID. There are classes for the DOM0, Core DOM, HTML, XML, XUL, XBL,
range, css, events, etc... The array sClassInfoData, defined in nsDOMClassInfo.cpp, maps each DOM class to its helper class and to the interfaces that are exposed to JavaScript. It is an array of type nsDOMClassInfoData, which is a structure defined in nsIDOMClassInfo.h. The array uses two macros to define its items: NS_DEFINE_CLASSINFO_DATA and NS_DEFINE_CLASSINFO_DATA_WITH_NAME. The first one calls ...
Mozilla Web Developer FAQ
in a table of tabular data does not constitute a paragraph. In that case, the easy solution is not to mark the contents of the cell as a paragraph. When the paragraph markup is called for but the default margins are unwanted, zero margins can be suggested using CSS. My style sheet doesn't work! Why? Here's the check list: Does the HTML document validate? Styling misnested markup may cause st
range effects. The <link> and <style> elements should be inside the <head> element. Does the CSS style sheet pass the syntax check? The CSS error handling rules require erroneous parts to be ignored rather than fixed by guessing. Lengths other than zero should be followed by a proper unit without a space between the number and the unit (eg. 1.2em). The character to use between the...
Build Metrics
latform / configuration. Lower is better. compiler warnings Number of compiler warnings detected during a build. Lower is better. Due to the way the build system works, compiler warnings are not consistently detected. So the value may fluctuate from build to build even if the number of compiler warnings didn't actually change. Since Perfherder alerts are calculated based on the mean value of a
range, a regression may be reported as a fractional value. ...
DMD
interesting ones. -f / --max-frames. By default, records show up to 8 stack frames. You can choose a smaller number, in which case more allocations will be aggregated into each record, but you'll have less context. Or you can choose a larger number, in which cases allocations will be split across more records, but you will have more context. There is no single best value, but values in the
range 2..10 are often good. The maximum is 24. -a / --ignore-alloc-frames. Many allocation stack traces start with multiple frames that mention allocation wrapper functions, e.g. js_calloc() calls replace_calloc(). This option filters these out. It often helps improve the quality of the output when using a small --max-frames value. -s / --sort-by. This controls how records are sorted. Accep...
Memory reporting
r not worth measuring every member of an object of in a Foo::SizeOfExcludingThis method. This is ok, but it's worth adding a comment explaining this to the method. Occasionally you do want to compute sizes analytically instead of using moz_malloc_size_of. In that case, use ComputedSizeOf as the prefix for the function name. It's important that no memory is measured twice; this can lead to st
range results in about:memory. Avoiding double measurement is easy in tree-like structures. In graph-like structures (where an object might be pointed to by more than one other object) it gets more difficult, and might even require some way to mark objects that have been counted (and then a way to unmark them once the measurement is complete). It's easy to get confused as to whether you should use S...
Profiling with Xperf
ce data, so you can do "xperf -on base -stackwalk profile". In the viewer, when summary data is viewed for heap events (Heap Allocations Outstanding, etc. all lead to the same summary graphs), 3 types of allocations are listed -- AIFI, AIFO, AOFI. This is shorthand for "Allocated Inside, Freed Inside", "Allocated Inside, Freed Outside", "Allocated Outside, Freed Inside". These refer to the time
range that was selected for the summary graph; for example, something that's in the AOFI category was allocated before the start of the selected time
range, but the free event happened inside. Tips In the summary views, the yellow bar can be dragged left and right to change the grouping -- for example, drag it to the left of the Module column to have grouping happen only by process (stuff that's to t...
Refcount tracing and balancing
ariable; see the BloatView documentation for more details). An object's serial number is simply a unique number, starting at one, that is assigned to the object when it is allocated. You may use an object's serial number with the following variable to further restrict the reference count tracing: XPCOM_MEM_LOG_OBJECTS Set this variable to a comma-separated list of object serial number or
ranges of serial number, e.g., 1,37-42,73,165 (serial numbers start from 1, not 0). When this is set, along with XPCOM_MEM_LOG_CLASSES and XPCOM_MEM_REFCNT_LOG, a stack track will be generated for only the specific objects that you list. For example, env XPCOM_MEM_LOG_CLASSES=nsDocShell XPCOM_MEM_LOG_OBJECTS=2 XPCOM_MEM_REFCNT_LOG=./refcounts.log ./mach run will log stack traces to refcounts.log f...
turbostat
2 6 782 21.15 3698 3398 0 11.92 3 3 702 19.14 3670 3398 0 8.39 3.09 2.03 67.36 39 3 7 648 17.67 3667 3398 0 9.85 The man page has good explanations of what each column measures. The various "Watt" measurements come from the Intel RAPL MSRs. ...
Performance
pproaches. It should be the starting point for anybody new to power profiling. tools/power/rapl (Mac, Linux) tools/power/rapl is a command-line utility in the Mozilla codebase that uses the Intel RAPL interface to gather direct power estimates for the package, cores, GPU and memory. powermetrics (Mac-only) powermetrics is a command-line utility that gathers and displays a wide
range of global and per-process measurements, including CPU usage, GPU usage, and various wakeups frequencies. TimerFirings logging (All platforms) TimerFirings logging is a built-in logging mechanism that prints data on every time fired. Activity Monitor, Battery Status Menu and top (Mac-only) The battery status menu, Activity Monitor and top are three related Mac tools that have m...
Nonblocking IO In NSPR
ocket nonblocking */ PR_SetSockOpt(sock, PR_SockOpt_Nonblocking, &optval, sizeof(optval)); Programming Constraints There are some constraints due to the use of NT asynchronous I/O in the NSPR. In NSPR, blocking sockets on NT are associated with an I/O completion port. Once associated with an I/O completion port, we can't disassociate the socket from the I/O completion port. I have seen some st
range problems with using a nonblocking socket associated with an I/O completion port. So the first constraint is: The blocking/nonblocking io mode of a new socket is committed the first time a potentially-blocking io function is invoked on the socket. Once the io mode of a socket is committed, it cannot be changed. The potentially-blocking io functions include <tt>PR_Connect()</tt>, <tt>PR_Accept()</...
Cached Monitors
A hash table is used to quickly map addresses to their respective monitors. The system automatically enlarges the hash table as needed. ...
Introduction to NSPR
ss or across processes on the entire host. Global threads correspond to native threads on the host OS. NSPR threads can also be either user threads or system threads. NSPR provides a function, PR_Cleanup, that synchronizes process termination. PR_Cleanup waits for the last user thread to exit before returning, whereas it ignores system threads when determining when a process should exit. This ar
rangement implies that a system thread should not have volatile data that needs to be safely stored away. Priorities for NSPR threads are based loosely on hints provided by the client and sometimes constrained by the underlying operating system. Therefore, priorities are not rigidly defined. For more information, see Thread Scheduling. In general, it's preferable to create local user threads with nor...
PRIntervalTime
or the host OS, yet provide sufficient resolution and period to be useful to clients. The increasing interval value represented by PRIntervalTime wraps. It should therefore never be used for intervals greater than approximately 6 hours. Interval times are accurate regardless of host processing requirements and are very cheap to acquire. The constants PR_INTERVAL_MIN and PR_INTERVAL_MAX define a
range in ticks per second. These constants bound both the period and the resolution of a PRIntervalTime object. The reserved constants PR_INTERVAL_NO_WAIT and PR_INTERVAL_NO_TIMEOUT have special meaning for NSPR. They indicate that the process should wait no time (return immediately) or wait forever (never time out), respectively. Important Note The counters used for interval times are allowed to ov...
PRThreadType
HREAD PR_Cleanup blocks until the last thread of type PR_USER_THREAD terminates. PR_SYSTEM_THREAD NSPR ignores threads of type PR_SYSTEM_THREAD when determining when a call to PR_Cleanup should return. Description Threads can be either user threads or system threads. NSPR allows the client to synchronize the termination of all user threads and ignores those created as system threads. This ar
rangement implies that a system thread should not have volatile data that needs to be safely stored away. The applicability of system threads is somewhat dubious; therefore, they should be used with caution. ...
PR_Available
s that are available for reading. For a normal file, these are the bytes beyond the current file pointer. If the function fails, it returns the value -1. The error code can then be retrieved via PR_GetError. Description PR_Available works on normal files and sockets. PR_Available does not work with pipes on Win32 platforms. See Also If the number of bytes available for reading is out of the
range of a 32-bit integer, use PR_Available64. ...
PR_Available64
that are available for reading. For a normal file, these are the bytes beyond the current file pointer. If the function fails, it returns the value -1. The error code can then be retrieved via PR_GetError. Description PR_Available64 works on normal files and sockets. PR_Available does not work with pipes on Win32 platforms. See Also If the number of bytes available for reading is within the
range of a 32-bit integer, use PR_Available. ...
PR_InitializeNetAddr
_IpAddrAny, or PR_IpAddrLoopback. port The port number to be assigned in the network address structure. The value is specified in host byte order. addr A pointer to the PRNetAddr structure to be manipulated. Returns The function returns one of the following values: If successful, PR_SUCCESS. If unsuccessful, PR_FAILURE. This may occur, for example, if the value of val is not within the
ranges defined by PRNetAddrValue. You can retrieve the reason for the failure by calling PR_GetError. Description PR_InitializeNetAddr allows the assignment of special network address values and the port number, while also setting the state that indicates the version of the address being used. The special network address values are identified by the enum PRNetAddrValue: typedef enum PRNetAddrValue...
PR_Interrupt
he thread whose interrupt request you want to set. Returns The function returns one of the following values: If the specified thread is currently blocked, PR_SUCCESS. Otherwise, PR_FAILURE. Description The purpose of PR_Interrupt is to request that a thread performing some task stop what it is doing and return to some control point. It is assumed that a control point has been mutually ar
ranged between the thread doing the interrupting and the thread being interrupted. When the interrupted thread reaches the prear
ranged point, it can communicate with its peer to discover the real reason behind the change in plans. The interrupt request remains in the thread's state until it is delivered exactly once or explicitly canceled. The interrupted thread returns PR_FAILURE (-1) with an error c...
PR_NormalizeTime
Adjusts the fields of a clock/calendar time to their proper
ranges, using a callback function. Syntax #include <prtime.h> void PR_NormalizeTime ( PRExplodedTime *time, PRTimeParamFn params); Parameters The function has these parameters: time A pointer to a clock/calendar time in the PRExplodedTime format. params A time parameter callback function. Returns Nothing; the time parameter is altered by the callback function. Description This function adjusts the fields of the specified time structure using the specified time parameter callback function, so that they are in the proper
range. Call this function in these situations: To normalize a time after performing arithmetic operations directly on the field values of the calendar time object. For example, if you have a ] o...
PR_Seek
om the beginning of the file. If the function fails, the file pointer remains unchanged and the function returns -1. The error code can then be retrieved with PR_GetError. Description Here's an idiom for obtaining the current location of the file pointer for the file descriptor fd: PR_Seek(fd, 0, PR_SEEK_CUR) See Also If you need to move the file pointer by a large offset that's out of the
range of a 32-bit integer, use PR_Seek64. New code should use PR_Seek64 so that it can handle files larger than 2 GB. ...
PR_Seek64
-1. The error code can then be retrieved with PR_GetError. Description This is the idiom for obtaining the current location (expressed as a 64-bit integer) of the file pointer for the file descriptor fd: PR_Seek64(fd, 0, PR_SEEK_CUR) If the operating system can handle only a 32-bit file offset, PR_Seek64 may fail with the error code PR_FILE_TOO_BIG_ERROR if the offset parameter is out of the
range of a 32-bit integer. See Also PR_Seek ...
PR_strtod
IEEE round-even rule. The string is scanned up to the first unrecognized character. If the value of se is not (char **) NULL, PR_strtod stores a pointer to the character terminating the scan in *se. If the answer would overflow, a properly signed HUGE_VAL (infinity) is returned. If the answer would underflow, a properly signed 0 is returned. In both cases, PR_GetError() returns the error code PR_
RANGE_ERROR. If no number can be formed, se is set to s00, and 0 is returned. ...
NSS 3.12.4 release notes
will escape a special character $ matches the end of the string Bracketed expressions: [abc] matches one occurence of a, b, or c. [^abc] matches any character except a, b, or c. To be matched between [ and ], these characters must be escaped: \ ] No other characters need be escaped between brackets. Unnecessary escaping is permitted. [a-z] matches any character between a and z, inclusive. The two
range-definition characters must be alphanumeric ASCII. If one is upper case and the other is lower case, then the ASCII non-alphanumeric characters between Z and a will also be in
range. [^a-z] matches any character except those between a and z, inclusive. These forms cannot be combined, e.g [a-gp-z] does not work. Exclusions: As a top level, outter-most expression only, the expression foo~bar will ma...
NSS 3.28 release notes
elease contains improved support for TLS 1.3, however, the code that supports TLS 1.3 is still disabled by default (not built). For the future NSS 3.29 release, it is planned that standard builds of NSS will support the TLS 1.3 protocol (although the maximum TLS protocol version enabled by default will remain at TLS 1.2). We know that some applications which use NSS, query NSS for the supported
range of SSL/TLS protocols, and will enable the maximum enabled protocol version. In NSS 3.29, those applications will therefore enable support for the TLS 1.3 protocol. In order to prepare for this future change, we'd like to encourage all users of NSS to override the standard NSS 3.28 build configuration, by defining NSS_ENABLE_TLS_1_3=1 at build time. This will enable support for TLS 1.3. Please g...
nss tech note1
SEC_ASN1_GENERAL_STRING, SEC_ASN1_UNIVERSAL_STRING, SEC_ASN1_BMP_STRING Note that for SEC_ASN1_SET and SEC_ASN1_SEQUENCE types, you must also include the method type macro SEC_ASN1_CONSTRUCTED to construct a fully valid tag, as defined by the ASN.1 standard . Decoder modifiers : These modifiers are also specified in the kind field of the template structure. All the values are in the 9 - 31 bit
range. SEC_ASN1_OPTIONAL: tells the decoder that this component is optional. If the component in the input data does not match this template, the decoder will continue processing the input data using the next available template. SEC_ASN1_EXPLICIT: tells the decoder that explicit tagging is being used. This is always a constructed type. It requires a subtemplate defining the types of the data wi...
Overview of NSS
a CVS tree. For details, see Network Security Services for Java. NSS makes use of Netscape Portable Runtime (NSPR), a platform-neutral open-source API for system functions designed to facilitate cross-platform development. Like NSS, NSPR has been battle-tested in multiple products. For more information, see the NSPR Project Page. Interoperability and Open Standards You can use NSS to support a
range of security standards in your application, including the following: SSL v3. The Secure Sockets Layer (SSL) protocol allows mutual authentication between a client and server and the establishment of an authenticated and encrypted connection. TLS v1.3 (RFC 8446), TLS v1.2 (RFC 5246), TLS v1.1 (RFC 4346), TLS v1 (RFC 2246). The Transport Layer Security (TLS) protocol from the IETF that supersede...
PKCS11 FAQ
rompted with a keygen dialog. Normally this dialog does not have any options and just provides information; however, if you have more than one token that can be used in this key generation process (for example, your smartcard and the NSS internal PKCS#11 module), you will see a selection of "cards and databases" that can be used to generate your new key info. In the key generation process, NSS ar
ranges for the key to have it's CKA_ID set to some value derived from the public key, and the public key will be extracted using C_GetAttributes. This key will be sent to the CA. At some later point, the CA presents the certificate to you (as part of this keygen, or in an e-mail, or you go back and fetch it from a web page once the CA notifies you of the arrival of the new certificate). NSS uses the p...
PKCS11 Implement
ns to distribute private keys. Signing tokens include a signing certificate and are used to sign objects or messages or to perform SSL authentication. They cannot be used for encrypted S/MIME, because they can't decrypt messages. Signing and decryption tokens can be used for S/MIME and for encrypted transactions over unsecured networks such as the Internet. Multipurpose tokens provide the full
range of cryptographic services. They can be thought of as cryptographic accelerator cards. Future releases of NSS will also support multipurpose tokens that are FIPS-140 compliant. Table 1.2 summarizes the PKCS #11 functions (in addition to the other functions described in this document) that NSS expects each type of token to support. PKCS #11 functions required for different kinds of tokens E...
FC_EncryptInit
or subsequent encryption. hKey[in] handle of the encryption key. Description FC_EncryptInit initializes an encryption operation with the mechanism and key to be used. A user must log into the token (to assume the NSS User role) before calling FC_EncryptInit. Return value CKR_OK Slot information was successfully copied. CKR_SLOT_ID_INVALID The specified slot number is out of the defined
range of values. Examples See also NSC_EncryptInit ...
FC_GetSlotInfo
o [out] The address of a CK_SLOT_INFO structure. Description FC_GetSlotInfo stores the information about the slot in the CK_SLOT_INFO structure that pInfo points to. A user may call FC_GetSlotInfo without logging into the token (to assume the NSS User role). Return value CKR_OK Slot information was successfully copied. CKR_SLOT_ID_INVALID The specified slot number is out of the defined
range of values. Examples See also NSC_GetSlotInfo ...
FC_GetTokenInfo
espectively. firmwareVersion: firmware version number, 0.0 (major=0x00, minor=0x00). A user may call FC_GetTokenInfo without logging into the token (to assume the NSS User role). Return value CKR_OK Token information was successfully copied. CKR_CRYPTOKI_NOT_INITIALIZED The PKCS #11 module library is not initialized. CKR_SLOT_ID_INVALID The specified slot number is out of the defined
range of values. FC_GetTokenInfo should return CKR_ARGUMENTS_BAD if pInfo is NULL. Examples Note the use of the %.32s format string to print the label and manufacturerID members of the CK_TOKEN_INFO structure. See also FC_GetSlotInfo, NSC_GetTokenInfo ...
FC_InitPIN
log in if the normal user's PIN has not yet been set or has been reset. Return value FC_InitPIN() returns the following return codes. CKR_OK: normal user's PIN initialization succeeded. CKR_SESSION_HANDLE_INVALID: the session handle is invalid. CKR_USER_NOT_LOGGED_IN: the session is not in the "R/W SO Functions" state. CKR_PIN_INVALID: the PIN has an invalid UTF-8 character. CKR_PIN_LEN_
RANGE: the PIN is too short, too long, or too weak (doesn't have enough character types). CKR_DEVICE_ERROR: normal user's PIN is already initialized. See also NSC_InitPIN, FC_SetPIN ...
FC_Login
. The SO PIN is the empty string. The NSS cryptographic module doesn't allow the SO to log in if the normal user's PIN is already initialized. Return value FC_Login() returns the following return codes. CKR_OK: the user logged in successfully. CKR_DEVICE_ERROR: the token is in the Error state. CKR_HOST_MEMORY: memory allocation failed. CKR_PIN_INCORRECT: the PIN is incorrect. CKR_PIN_LEN_
RANGE: the PIN is too long (ulPinLen is greater than 255). The function should return CKR_PIN_INCORRECT in this case. CKR_SESSION_HANDLE_INVALID: the session handle is invalid. CKR_USER_ALREADY_LOGGED_IN: the user is already logged in. CKR_USER_TYPE_INVALID The token can't authenticate the user because there is no key database or the user's password isn't initialized. userType is CKU_SO...
NSC_Login
The SO PIN is the empty string. The NSS cryptographic module doesn't allow the SO to log in if the normal user's PIN is already initialized. Return value NSC_Login() returns the following return codes. CKR_OK: the user logged in successfully. CKR_DEVICE_ERROR: the token is in the Error state. CKR_HOST_MEMORY: memory allocation failed. CKR_PIN_INCORRECT: the PIN is incorrect. CKR_PIN_LEN_
RANGE: the PIN is too long (ulPinLen is greater than 255).The function should return CKR_PIN_INCORRECT in this case. CKR_SESSION_HANDLE_INVALID: the session handle is invalid. CKR_USER_ALREADY_LOGGED_IN: the user is already logged in. CKR_USER_TYPE_INVALID The token can't authenticate the user because there is no key database or the user's password isn't initialized. userType is CKU_SO and the nor...
Rebranding SpiderMonkey (1.8.5)
_config_file: $(pkg_config_files) Those two lines should be modified to read back: install:: $BRAND.pc @echo pkg_config_file: $BRAND.pc Note: While it is possible to automate the manual editing process, this has been discouraged due to the fact that these files are automatically generated and very little constant data can be depended upon. It also allows these instructions to apply to a wide
range platforms without introducing more software dependencies. Save the file and exit the editor. You may now perform the build and installation of your custom branded SpiderMonkey library: make Note: Depending on your system you may need administrative rights to perform the installation: make install The following information isn't technically needed for using your library but it will help other ap...
SpiderMonkey Build Documentation
architecture-independent data /usr/local/share --sharedir C header files /usr/local/include --includedir For convenience, you can pass the configure script an option of the form --prefix=<PREFIXDIR>, which substitutes <PREFIXDIR> for /usr/local in all the settings above, in one step. This is usually the least troublesome thing to do, as it preserves the typical ar
rangement of lib, bin, and the rest. Note: All directories you pass to configure are recorded in the generated makefile, so you don't need to specify them again until you re-run configure. Building SpiderMonkey as a static library By default, SpiderMonkey builds as a shared library. However, you can build SpiderMonkey as a static library by specifying the --disable-shared-js flag when you run config...
Creating JavaScript jstest reftests
tory and read about here. An update script exists in the js/src/tests directories to fetch and reformat the Test262 suite, see test262-update.py. Writing a new test file Please read the high level advice for test writing in the parent article here. jstests has a special requirement: The call to reportCompare in every jstest is required by the test harness. Except in old tests or super st
range new tests, it should be the last line of the test. Comparison functions and shared test functionality The jstest runner loads the code in js/src/tests/shell.js for every test. Additionally, it loads every shell.js and broswer.js file in the subdirectories on the path from js/src/tests to the location of your test. If you have functionality several tests share in a given folder, you can add the...
Creating JavaScript tests
is run on a wide variety of wildly varying hardware plaforms, from phones all the way up to servers. Even tests that check for polynomial time complexity will start to fail in a few years when they have sped up enough to run faster than the granularity of the OS scheduler or when run on platforms with higher latencies than your development workstation. These tests will also show up as infrequent o
ranges on our heavily loaded test machines, lowering the value of our test suite for everyone. Just don't do it, it's never worth it. Do not add performance tests to the test suite. It is not generally even possible to tell if the speed of any particular feature is going to be important in the real world without running a real-world benchmark. It is very hard to write a good real-world benchmark. For...
GC Rooting Guide
JSObject subclass that contains Heap<T> fields, set the trace hook to invoke a function that traces those fields. General Classes/Structures For a regular struct or class, tracing must be triggered manually. The usual way is to define a void trace(JSTracer* trc, const char* name) method on the class -- which is already enough be able to create a JS::Rooted<YourStruct> on the stack -- and then ar
range for it to be called during tracing. If a pointer to your structure is stored in the private field of a JSObject, the usual way would be to define a trace hook on the JSObject (see above) that casts the private pointer to your structure and invokes trace() on it: class MyObject : public JSObject { { ... static void trace(JSTracer* trc, JSObject* obj) { MyClass* mine = static_cast<...
Self-hosted builtins in SpiderMonkey
mplemented builtins is installed via the intrinsic_functions array in SelfHosting.cpp, as described below. Using the same mechanism, C++-implemented helper functions are made available to self-hosted code. Some general-purpose functions provided in this way are: The abstract operations ToObject, ToInteger, and IsCallable specified in the ECMAScript Language Specification. ThrowTypeError, Throw
RangeError, ThrowSyntaxError, which self-hosted code should use instead of throw so that the error message is specified in js.msg and can be localized. The MakeConstructible function described above. The file Utilities.js provides some additional, JS-implemented helper functions. Of note, it provides implementations of List and Record, types defined in the ECMAScript specifications that are similar ...
SpiderMonkey Internals
In addition to the interpreter, SpiderMonkey contains a Just-In-Time (JIT) compiler, a garbage collector, code implementing the basic behavior of JavaScript values, a standard library implementing ECMA 262-5.1 ?15 with various extensions, and a few public APIs. ...
JS::AutoVectorRooter
perator[](size_t i) const Returns to the i-th element as JS::Handle<T>. const T *begin() const Returns a pointer to the first element. T *begin() Returns a pointer to the first element. const T *end() const Returns a pointer to the element next to the last element. T *end() Returns a pointer to the element next to the last element.
Range all() Returns the
Range of the array. const T &back() const Returns the last element. Description JS::AutoVectorRooter<T> holds a variable-size rooted array of type T. There are derived classes for the main types: Class Parent class JS::AutoValueVector AutoVectorRooter<Value> JS::AutoIdVector AutoVectorRooter<jsid> JS::AutoObje...
JSClass.flags
omparisons to values other than null or undefined (including to an object that emulates undefined) are unaffected by this flag. Strict equality (=== and !==) comparisons are also unaffected by this flag. MXR ID Search for JSCLASS_EMULATES_UNDEFINED JSCLASS_HAS_RESERVED_SLOTS(n) Indicates that instances of this class have n reserved slots. n is an integer in the
range [0..255]. The slots initially contain unspecified valid jsval values. They can be accessed using JS_GetReservedSlot and JS_SetReservedSlot. (The JSClass.reserveSlots hook also allocates reserved slots to objects.) MXR ID Search for JSCLASS_HAS_RESERVED_SLOTS JSCLASS_GLOBAL_FLAGS This flag is only relevant for the class of an object that is used as a global ...
JSExnType
This article covers features introduced in SpiderMonkey 17 Possible exception types. Value Prototype in JavaScript JSEXN_NONE An unthrowable error. (lower bound) JSEXN_ERR Error JSEXN_INTERNALERR InternalError JSEXN_EVALERR EvalError JSEXN_
RANGEERR
RangeError JSEXN_REFERENCEERR ReferenceError JSEXN_SYNTAXERR SyntaxError JSEXN_TYPEERR TypeError JSEXN_URIERR URIError JSEXN_LIMIT (upper bound) Description These types are part of a JSErrorFormatString structure. They define which error to throw in case of a runtime error. JSEXN_NONE marks an unthrowable error. See Also MXR ID Search for JSExnType JSErrorFormatString bug 684526 ...
JSProtoKey
oto_Number JSProto_String String MXR Search for JSProto_String JSProto_RegExp RegExp MXR Search for JSProto_RegExp JSProto_Error Error MXR Search for JSProto_Error JSProto_InternalError InternalError MXR Search for JSProto_InternalError JSProto_EvalError EvalError MXR Search for JSProto_EvalError JSProto_
RangeError
RangeError MXR Search for JSProto_
RangeError JSProto_ReferenceError ReferenceError MXR Search for JSProto_ReferenceError JSProto_SyntaxError SyntaxError MXR Search for JSProto_SyntaxError JSProto_TypeError TypeError MXR Search for JSProto_TypeError JSProto_URIError URIError MXR Search for JSProto_URIError JS...
JS_ConvertArguments
s to convert. Obsolete since JSAPI 30 argv jsval * Pointer to the vector of arguments to convert. Obsolete since JSAPI 30 This must be an argv pointer created by the JS engine and passed to a JSNative or JSFastNative callback, not an array created by application code. In certain error cases, JS_ConvertArguments calls JS_ARGV_CALLEE(argv), which accesses memory outside the
range [argv .. argv+argc). JS_ConvertArguments may modify argv in place by replacing an argument with the converted value. (The purpose is to ensure GC safety.) format const char * Null-terminated string describing the types of the out parameters and how to convert the values in argv. ... void * Out parameters. Pointers to variables into which to store the co...
JS_InitStandardClasses
FLAGS bits set. Description JS_InitStandardClasses initializes the built-in JavaScript global properties. These include all the standard ECMAScript global properties defined in ECMA 262-3 ?15.1: Array, Boolean, Date, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, Error, eval, EvalError, Function, Infinity, isNaN, isFinite, Math, NaN, Number, Object, parseInt, parseFloat,
RangeError, ReferenceError, RegExp, String, SyntaxError, TypeError, undefined, and URIError as well as a few SpiderMonkey-specific globals, depending on compile-time options: escape, unescape, uneval, InternalError, Script, XML, Namespace, QName, File, Generator, Iterator, and StopIteration, as of SpiderMonkey 1.7. These global objects, functions, constructors, and constants are created as prope...
JS_NewDependentString
Syntax JSString * JS_NewDependentString(JSContext *cx, JS::HandleString str, size_t start, size_t length); Name Type Description cx JSContext * The context in which to create the new string. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JS::HandleString The string containing the characters for the new string. start size_t The start index of the substring. length size_t Length of the substring, in characters. ...
JS_ValueToInt32
jsval The value to convert. ip int32 * Out parameter. On success, *ip receives the converted integer value. Description JS_ValueToInt32 converts a specified JS value, v, to a 32-bit signed integer (-2147483648 to 2147483647). First it converts v to a floating-point number as if by calling JS::ToNumber. If the result is NaN, an infinity, or a number outside the 32-bit
range, JS_ValueToInt32 reports an error and conversion fails. Otherwise, the floating-point number is rounded to the nearest integer value. On success, JS_ValueToInt32 stores the converted value in *ip and returns JS_TRUE. On error or exception, it returns JS_FALSE, and the value left in *ip is undefined. JS_ValueToInt32 is pre-ECMA-262 Edition 1, and rounds differently than JS_ValueToECMAInt32 and J...
Split object
because they have fast property accessors that do not perform security checks. Therefore, no function may be allowed to see an inner object that has different JSPrincipals. Apart from the security issue, if one page directly or indirectly gets a reference to another page's window object, that window object must appear to behave like the outer window and navigate from page to page. SpiderMonkey ar
ranges this by not allowing JS code to see inner objects at all. To enforce this rule: If this would evaluate to an inner object, it evaluates to the corresponding outer object instead. Outer objects are dangerous because their JSPrincipals may change over time. Because a Function inherits the JSPrincipals of its lexical scope (specifically, the nearest principals-aware object in its scope chain), u...
Web Replay
ont property of a CanvasRenderingContext2D. Failed operations currently just produce a placeholder "INCOMPLETE" result. Operations on the debuggee which have side effects -- eval("x.f = 3") -- should be avoided. When the process resumes forward or backward these side effects will be lost (the process reverts to its original state) and while paused at a breakpoint these effects can cause some st
range behavior -- after the above eval, getting the x.f property directly could produce a different value from eval("x.f"). While the st
range behavior could be fixed (it's due to caching) it would be good to prevent or at least discourage users from performing such effectful operations. The underlying object of a Debugger.Object is inaccessible; object.unsafeDereference is null. As described above u...
Secure Development Guidelines
. for (i = 0, ni = 0; i < length; i++) { if ((ch = chars[i]) < 128 && IS_OK(ch, mask)) { newchars[ni++] = ch; ... } ... } ... ...
Handling Mozilla Security Bugs
Version 1.1 IMPORTANT: Anyone who believes they have found a Mozilla-related security vulnerability can and should report it by sending email to address security@mozilla.org. For more information read the rest of this document. Introduction In order to improve the Mozilla project's approach to resolving Mozilla security vulnerabilities, mozilla.org is creating more formal ar
rangements for handling Mozilla security-related bugs. First, mozilla.org is appointing a security module owner charged with primary responsibility for coordinating the investigation and resolution of reported Mozilla security vulnerabilities. The security module owner will have one or more peers to assist in this task. At the same time, mozilla.org is also creating a larger "Mozilla security bug group" by which M...
Task graph
s pushed to version-control, jobs for that change appear on Treeherder. How does this work? A "decision task" is created to decide what to do with the push. The decision task creates a lot of additional tasks. These tasks include build and test tasks, along with lots of other kinds of tasks to build docker images, build toolchains, perform analyses, check syntax, and so on. These tasks are ar
ranged in a "task graph", with some tasks (e.g., tests) depending on others (builds). Once its prerequisite tasks complete, a dependent task begins. The result of each task is sent to TreeHerder where developers and sheriffs can track the status of the push. The outputs from each task, log files, Firefox installers, and so on, appear attached to each task when it completes. These are viewable in the ...
Animated PNG graphics
uffer before being composited onto the canvas. The contents of the output buffer are available to the decoder. The corners of the output buffer are mapped to the corners of the canvas. Fully transparent black means red, green, blue and alpha components are all set to zero. For purposes of chunk descriptions, an unsigned int shall be a 32-bit unsigned integer in network byte order limited to the
range 0 to (2^32)-1; an unsigned short shall be a 16-bit unsigned integer in network byte order with the
range 0 to (2^16)-1; and a byte shall be an 8-bit unsigned integer with the
range 0 to (2^8)-1. Error handling APNG is designed to allow incremental display of frames before the entire image has been read. This implies that some errors may not be detected until partway through the animation. It is...
Querying Places
re done with it, since it will give better performance. If you close a container and re-open it before any history or bookmark change notifications come, the results will generally still be there and this operation will be fast. This example uses the Places history service to display all the titles of the history pages. // queries parameters (e.g. domain name matching, text terms matching, time
range...) // see : https://developer.mozilla.org/en/nsINavHistoryQuery var query = PlacesUtils.history.getNewQuery(); // options parameters (e.g. ordering mode and sorting mode...) // see : https://developer.mozilla.org/en/nsINavHistoryQueryOptions var options = PlacesUtils.history.getNewQueryOptions(); // execute the query // see : https://developer.mozilla.org/en/nsINavHistoryService#executeQuery()...
Retrieving part of the bookmarks tree
If you have a complex query the root will be a nsINavHistoryQueryResultNode. Before accessing the children of any result container, you must first open it, and then you can iterate the children. As long as the container is open, it will listen for notifications from the bookmark...
XPCOM array guide
alls the same method on each member: void NotifyObservers(const nsTArray<ObserverClass*>& observers) { for (PRUint32 i = observers.Length(); i > 0 ; ) { --i; observers[i]->Observe(); } } Bounds-safe access to elements You can also access elements in an nsTArray<T> using the SafeElementAt() method. This method is bounds-safe; that is, if you attempt to access an element outside the
range of the array, a specified "safe" value is returned. For example: var value = myArray.SafeElementAt(idx, defaultValue); if (value == defaultValue) { /* the index idx was out of bounds, or the value at that index was the default value */ } Note: As of Gecko 8.0, if the element type is a pointer type, you can use the SafeElementAt() method without providing a default value. It returns a null ...
Preface
Next >> This is a book about Gecko, and about creating XPCOM components for Gecko-based applications. Though the emphasis is on the practical steps you take to make your C++ code into a component that can be used in Gecko, we hope that these steps will also give us an occasion to discuss all of the tools, techniques, and technologies that make up XPCOM. Accordingly, the book is ar
ranged so that you can follow along and create your own components or learn about different XPCOM topics individually, as in a reference work. For example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with Mozilla - prompts a discussion of the relationship between components and modules, of XPCOM inter...
Using XPCOM Components
er interface of the Mozilla browser, to other Gecko-based XUL, and to JavaScript environments like xpcshell, which is a command-line JavaScript interpreter and XPCOM tool is built with Mozilla. See http://www.mozilla.org/scriptable/ for more information about XPConnect and JavaScript. This isn't quite all there is to it, of course, but this shows an important aspect of XPCOM. The contractual ar
rangements that XPCOM enforces open up the way to binary interoperability - to being able to access, use, and reuse XPCOM components at runtime. And they make it possible to use components written in other languages - such as JavaScript, Python, and others - and to use C++-based XPCOM components from these other languages as well. In the Mozilla browser, components are used as often from JavaScript in...
Creating XPCOM components
Next >> This guide is about Gecko, and about creating XPCOM components for Gecko-based applications. Though the emphasis is on the practical steps you take to make your C++ code into a component that can be used in Gecko, we hope that these steps will also give us an occasion to discuss all of the tools, techniques, and technologies that make up XPCOM. Accordingly, the book is ar
ranged so that you can follow along and create your own components or learn about different XPCOM topics individually, as in a reference work. For example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with Mozilla - prompts a discussion of the relationship between components and modules, of XPCOM interf...
Mozilla internal string guide
ery similar to the UTF-8 / UTF-16 conversion helpers above. UTF-16 to Latin1 converters These converters are very dangerous because they lose information during the conversion process. You should avoid UTF-16 to Latin1 conversions unless your strings are guaranteed to be Latin1 or ASCII. (In the future, these conversions may start asserting in debug builds that their input is in the permissible
range.) If the input is actually in the Latin1
range, each 16-bit code unit in narrowed to an 8-bit byte by removing the high half. Unicode code points above U+00FF result in garbage whose nature must not be relied upon. (In the future the nature of the garbage will be CPU architecture-dependent.) If you want to printf() something and don't care what happens to non-ASCII, please convert to UTF-8 instea...
IAccessibleTable
tribute is obtained by parsing the attribute string returned by IAccessible2.attributes(). The "table-cell-index" attribute can be used just like a child index of the typical case. ATs should first test for the presence of the "table-cell-index" attribute and if it is not present then IAccessible2.indexInParent() can be used as in the typical case where cells are direct children of the table. The
range of valid coordinates for this interface are implementation dependent. However, that
range includes at least the intervals from the from the first row or column with the index 0 up to the last (but not including) used row or column as returned by nRows() and nColumns(). Method overview [propget] HRESULT accessibleAt([in] long row, [in] long column, [out] IUnknown accessible ); [propget] HRESU...
imgIContainer
ing Exception Missing Description Native code only!ensureCleanFrame Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Create or reuse a frame at index aFrameNum. It is an error to call this with aFrameNum not in the
range [0, numFrames]. void ensureCleanFrame( in unsigned long aFramenum, in PRInt32 aX, in PRInt32 aY, in PRInt32 aWidth, in PRInt32 aHeight, in gfxImageFormat aFormat, [array, size_is(imageLength)] out PRUint8 imageData, out unsigned long imageLength ); Parameters aFramenum Missing Description aX Missing Description aY Missing Description aWidth Missin...
mozIStorageVacuumParticipant
void onEndVacuum(in boolean aSucceeded); Attributes Attribute Type Description databaseConnection mozIStorageConnection A connection to the database file to be vacuumed. expectedDatabasePageSize long The expected page size, in bytes, for the database. The vacuum manager will try to correct the page size when the browser is idle, using this value as a target. Valid page sizes are in the
range 512 to 65,536. The recommended value is mozIStorageConnection::DEFAULT_PAGE_SIZE. Note: If the database is using the WAL journal node and the current page size is not the expected one, the journal node will be changed to TRUNCATE because WAL doesn't allow page size changes. The vacuum manager will try to restore WAL mode, but this will only work reliably if the participant properly resets stateme...
DoAction
<< nsIAccessible Page Summary This method performs the accessible action at the given zero-based index. Action number 0 is the default action. void doAction( in PRUint8 aIndex ); Parameters aIndex[in] The zero-based index. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. NS_ERROR_INVALID_ARG Indicates that the given index is our of
range. See Also nsIAccessible.numActions nsIAccessible.getActionName() nsIAccessible.getActionDescription() ...
GetActionDescription
ed name) of the accessible action at the given zero-based index. AString getActionDescription( in PRUint8 aIndex ); Parameters aIndex[in] The zero-based index. Return value Returns the description of the accessible action. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. NS_ERROR_INVALID_ARG Indicates that the given index is our of
range. See Also nsIAccessible.numActions nsIAccessible.getActionName() nsIAccessible.doAction() ...
GetActionName
thod retrieves the name of the accessible action at the given zero-based index. AString getActionName( in PRUint8 aIndex ); Parameters aIndex[in] The zero-based index. Return value Returns the name of the accessible action. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree.NS_ERROR_INVALID_ARG Indicates that the given index is our of
range. See Also nsIAccessible.numActions nsIAccessible.getActionDescription() nsIAccessible.doAction() ...
nsIAccessibleProvider
Used for label element. XFormsOuput 0x00002002 Used for output element. XFormsTrigger 0x00002003 Used for trigger and submit elements. XFormsInput 0x00002004 Used for input and textarea elements. XFormsInputBoolean 0x00002005 Used for input[xsd:boolean] element. XFormsInputDate 0x00002006 Used for input[xsd:date] element. XFormsSecret 0x00002007 Used for secret element. XFormsSlider
Range 0x00002008 Used for
range element represented by slider. XFormsSelect 0x00002009 Used for select and select1 that are implemented using host document's native widget. For example, a select1 in a xhtml document may be represented by the native html control html:select. XFormsChoices 0x00002010 Used for xforms choices element. XFormsSelectFull 0x00002011 Used for xforms full select/select1 el...
nsIAccessibleRelation
d for MSAA only, no for IA2 nor ATK/AT-SPI. Methods getTarget() Returns accessible relation target at the given index. nsIAccessible getTarget( in unsigned long index ); Parameters index Zero-based index of relation target. Return value Returns an nsIAccessible object. Exceptions thrown NS_ERROR_INVALID_ARG Indicates the given index is out of
range. getTargets() Returns an array of accessible relation targets. nsIArray getTargets(); Parameters None. Return value An nsIArray object, each item in the array implements an nsIAccessible. ...
nsIAccessibleRole
sbar". ROLE_DIAL 49 Represents a dial or knob whose purpose is to allow a user to set a value. ROLE_HOTKEYFIELD 50 Represents a hot-key field that allows the user to enter a combination or sequence of keystrokes. ROLE_SLIDER 51 Represents a slider, which allows the user to adjust a setting in given increments between minimum and maximum values. It is used by xul:scale, role="slider", xforms:
range. ROLE_SPINBUTTON 52 Represents a spin box, which is a control that allows the user to increment or decrement the value displayed in a separate "buddy" control associated with the spin box. It is used for xul:spinbuttons. ROLE_DIAGRAM 53 Represents a graphical image used to diagram data. It is used for svg:svg. ROLE_ANIMATION 54 Represents an animation control, which contains content that ch...
nsIAccessibleValue
alue(in double value); Obsolete since Gecko 1.9 Attributes Attribute Type Description currentValue double maximumValue double Read only. minimumIncrement double Read only. minimumValue double Read only. Methods setCurrentValue() Obsolete since Gecko 1.9 (Firefox 3) Return a success condition of the value getting set. That is if the value is within the
range of minimumValue - maximumValue. boolean setCurrentValue( in double value ); Parameters value New value for current value. Return value true if the value is within the
range of minimumValue - maximumValue, false if it is not. ...
nsICommandLine
ag, in boolean aCaseSensitive ); Parameters aFlag The flag name to find and remove. aCaseSensitive Whether to do case-sensitive flag search. Return value The value of the specified flag, an empty string if the flag's value is the empty string, or null if the specified parameter wasn't found. Exceptions thrown NS_ERROR_INVALID_ARG The specified flag has no value. removeArguments() Removes a
range of arguments from the command line; this is typically done once those arguments have been handled. void removeArguments( in long aStart, in long aEnd ); Parameters aStart The index to the first argument to remove from the command line; this is 0-based, and the name of the application is not included. aEnd The index to the last argument to remove from the command line. resolveFile() Resolve...
nsIDOMFontFace
its from: nsISupports Last changed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) This object describes a single font. It's returned in a list you can get using inIDOMUtils.getUsedFontFaces(). Attributes Font source attributes These attributes indicate how the font was found during the font matching process. Note: The same physical font may have been found in multiple ways within a
range. Attribute Type Description fromFontGroup boolean Indicates whether or not the font was located in a font group. Read only. fromLanguagePrefs boolean Indicates whether or not the font was located using language preferences. Read only. fromSystemFallback boolean Indicates whether or not the font is the system fallback font. Read only. Attributes available for all fonts These attributes...
nsIDOMNSHTMLDocument
String commandID ); Parameters commandID The name of the command to query. Return value For stateful commands, returns true if the command has is active, false otherwise. queryCommandSupported() boolean queryCommandSupported( in DOMString commandID ); Parameters commandID The name of the command to query. Return value Returns true if the command is supported on the current
range, false otherwise. queryCommandText() Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) This method never did anything but throw an exception, and was removed entirely in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11). DOMString queryCommandText( in DOMString commandID ); Parameters commandID The name of the command to...
nsIDOMOrientationEvent
DOMString eventTypeArg, in boolean canBubbleArg, in boolean cancelableArg, in double x, in double y, in double z); Attributes Attribute Type Description x double The amount of tilt along the X axis. Read only. y double The amount of tilt along the Y axis. Read only. z double The amount of tilt along the Z axis. Read only. The values of x, y, and z can
range from -1 to 1, where 0 means the device is balanced on that axis. See Accelerometer values explained for details. Methods initOrientationEvent() Initializes the orientation event object. void initProgressEvent( in DOMString eventTypeArg, in boolean canBubbleArg, in boolean cancelableArg, in double x, in double y, in double z ); Parameters eventTypeArg The type of event. Must be "MozO...
nsIDOMSimpleGestureEvent
rotation and negative values indicate counter-clockwise rotation). For magnify gestures, the units are implementation-specific; however, positive values indicate zooming in, and negative values indicate zooming out. Read only. Note: On Mac OS X, the units used for magnification gestures by the underlying operating system API are not documented at this time; typical values appear to be in the
range 0.0 to 100.0, but currently you can only rely on the value being either positive or negative. On Windows, the units indicate the difference between the previous and current width between the two touch points, in pixels. direction unsigned long The direction in which the gesture moved. See Direction constants and Rotation constants on this page. Read only. Constants Dire...
nsIDeviceMotionData
/ SeaMonkey 2.3). Attributes Attribute Type Description type unsigned long The type of motion data reported by this object; see Motion type constants for possible values. Read only. x double The amount of tilt along the X axis. Read only. y double The amount of tilt along the Y axis. Read only. z double The amount of tilt along the Z axis. Read only. The values of x, y, and z can
range from -1 to 1, where 0 means the device is balanced on that axis. See Accelerometer values explained for details. Constants Motion type constants Constant Value Description TYPE_ACCELERATION 0 The motion data describes device acceleration. TYPE_ORIENTATION 1 The motion data describes a device orientation chang. See also MozOrientation nsIDOMOrientationEvent nsIDeviceMotionListener nsI...
nsIMsgDBView
et of specified headers. Note: This is not implemented in the base implementation. void openWithHdrs(in nsISimpleEnumerator aHeaders, in nsMsgViewSortTypeValue aSortType, in nsMsgViewSortOrderValue aSortOrder, in nsMsgViewFlagsTypeValue aViewFlags, out long aCount); Parameters aHeaders A list of headers to open, ar
ranged in an nsISimpleEnumerator. aSortType A nsMsgViewSortTypeValue designating the sort type used for the folder. Defined in the interface: nsMsgViewSortType. sortOrder An nsMsgViewSortOrderValue designating the sort order used for the folder. Defined in the interface: nsMsgViewSortOrder. viewFlags Other flags to be used. Defined in the interface: nsMsgViewFlagsType. Return values aCount ...
nsIMsgSearchValue
tatus; attribute unsigned long size; attribute nsMsgKey msgKey; attribute long age; // in days attribute nsIMsgFolder folder; attribute nsMsgLabelValue label; attribute nsMsgJunkStatus junkStatus; /* * junkPercent is set by the message filter plugin, and is approximately * proportional to the probability that a message is junk. * (
range 0-100, 100 is junk) */ attribute unsigned long junkPercent; AString toString(); }; ...
nsINavHistoryResultNode
, this is a sorted list of the tags, delimited with commans, for the uri represented by this node. Otherwise this is an empty string. Read only. time PRTime The time at which the user accessed the page. Read only. For visits, this is the exact time at which the page visit occurred. For URIs, this is the most recent time at which the URI was visited. Even if you ask for all URIs for a given date
range long ago, this might contain today's date if the URI was visited today. For hosts, or other node types with children, this is the most recent access time for any of the children. For days, this is midnight on the morning of the day in question in UTC. title AUTF8String Title of the web page or of the node's grouping (day, host, folder, and so on.). Read only. type unsigned long Identifies th...
nsIProgressEventSink
onProgress( in nsIRequest aRequest, in nsISupports aContext, in unsigned long long aProgress, in unsigned long long aProgressMax ); Parameters aRequest The request being observed (may QI to nsIChannel). aContext If aRequest is a channel, then this parameter is the listener context passed to nsIChannel.asyncOpen(). aProgress Numeric value in the
range 0 to aProgressMax indicating the number of bytes transfered thus far. aProgressMax Numeric value indicating maximum number of bytes that will be transfered (or 0xFFFFFFFFFFFFFFFF if total is unknown). onStatus() Called to notify the event sink with a status message for the given request. void onStatus( in nsIRequest aRequest, in nsISupports aContext, in nsresult aStatus, in...
nsISocketTransport
) Sets a Socket timeout. void setTimeout( in unsigned long aType, in unsigned long aValue ); Parameters aType The timeout type which should be set to aValue. Can be one of the constants TIMEOUT_CONNECT or TIMEOUT_READ_WRITE. aValue Defines the timeout in seconds, pass PR_UINT32_MAX to specify no timeout. The implementation may truncate timeout values to a smaller
range of values (for example, 0 to 0xFFFF). Remarks This is a free-threaded interface, meaning that the methods on this interface may be called from any thread. See also nsITransport nsISocketTransportService ...
nsISupports proxies
feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. XPCOM proxies were a technology which allowed code to make asynchronous or synchronous XPCOM calls to a different thread on arbitrary XPCOM interfaces. This technology has been removed in Firefox 12 because it was very complex and often lead to st
range deadlock conditions. It is no longer needed because JavaScript code can no longer run on arbitrary threads, and compiled code can use compiled runnable to achieve the same effect in a much simpler manner. For more information about alternatives, see Making cross-thread calls using runnables. The following interface is now obsolete: nsIProxyObjectManager. About XPCOM proxies A proxy, in this ...
nsITelemetry
ots jsval An object containing a snapshot from all of the currently registered histograms. { name1: {data1}, name2:{data2}...} where data consists of the following properties: min - Minimal bucket size max - Maximum bucket size histogram_type - HISTOGRAM_EXPONENTIAL or HISTOGRAM_LINEAR counts - An array representing the values of buckets in the histogram.
ranges - An array with corresponding bucket sizes. sum - Sum of the counts array. static - true for histograms defined in Histograms.json, false for ones defined with newHistogram(). Read only. Constants Histogram Types Constant Value Description HISTOGRAM_EXPONENTIAL 0 Buckets increase exponentially. HISTOGRAM_LINEAR 1 Buckets in...
nsIVariant
is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRUint64 then the value is returned. Native code only!getAsUint64 PRUint64 getAsUint64(); Parameters None. Return value If the internal value is a string, it is first converted to a double, if possible. If it is of a numeric type, it is cast to PRInt64 and then to PRUint64. Note that this will do st
range things with negative numbers, and float and double values greater than the numeric limits of a PRInt64 will not convert correctly. Native code only!getAsUint8 PRUint8 getAsUint8(); Parameters None. Return value If the internal value is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRUint8 then the value is returned. Native code only!getAsWChar wch...
nsIWebNavigation
LOAD_FLAGS_NONE 0 This is the default value for the load flags parameter. LOAD_FLAGS_IS_REFRESH 16 This flag specifies that the load should have the semantics of an HTML Meta-refresh tag (That is, that the cache should be bypassed). This flag is only applicable to loadURI. XXX the meaning of this flag is poorly defined. XXX no one uses ...
nsIWebProgress
However, in some cases a nsIWebProgress instance may not have an associated DOM window. The parent-child relationship of nsIWebProgress instances is not made explicit by this interface, but the relationship may exist in some implementations. ...
nsIWindowsRegKey
the binary contents of the named value. The value will be created if it does not already exist. JavaScript callers should take care with the value passed to this method since it will be truncated from a JS string (unicode) to a ISO-Latin-1 string. (The binary data will be treated as an ISO-Latin-1 character string, which it is not). So, JavaScript callers should only pass character values in the
range \u0000 to \u00FF, or else data loss will occur. void writeBinaryValue( in AString name, in ACString data ); Parameters name The name of the value to modify. data The data for the value to modify. writeInt64Value() This method writes the 64-bit integer contents of the named value. The value will be created if it does not already exist. void writeInt64Value( in AString name...
XPCOM Interface Reference
rnsIDOMFileExceptionnsIDOMFileListnsIDOMFileReadernsIDOMFontFacensIDOMFontFaceListnsIDOMGeoGeolocationnsIDOMGeoPositionnsIDOMGeoPositionAddressnsIDOMGeoPositionCallbacknsIDOMGeoPositionCoordsnsIDOMGeoPositionErrornsIDOMGeoPositionErrorCallbacknsIDOMGeoPositionOptionsnsIDOMGlobalPropertyInitializernsIDOMHTMLAudioElementnsIDOMHTMLFormElementnsIDOMHTMLMediaElementnsIDOMHTMLSourceElementnsIDOMHTMLTime
RangesnsIDOMJSWindownsIDOMMouseScrollEventnsIDOMMozNetworkStatsnsIDOMMozNetworkStatsDatansIDOMMozNetworkStatsManagernsIDOMMozTouchEventnsIDOMNSHTMLDocumentnsIDOMNavigatorDesktopNotificationnsIDOMNodensIDOMOfflineResourceListnsIDOMOrientationEventnsIDOMParsernsIDOMProgressEventnsIDOMSerializernsIDOMSimpleGestureEventnsIDOMStoragensIDOMStorage2nsIDOMStorageEventObsoletensIDOMStorageItemnsIDOMStorageListn...
XPCOM Interface Reference by grouping
ionAddress nsIDOMGeoPositionCallback nsIDOMGeoPositionCoords nsIDOMGeoPositionError nsIDOMGeoPositionErrorCallback nsIDOMGeoPositionOptions nsIDOMGlobalPropertyInitializer Element nsIDOMChromeWindow nsIDOMClientRect nsIDOMElement nsIDOMHTMLAudioElement nsIDOMHTMLFormElement nsIDOMHTMLMediaElement nsIDOMHTMLSourceElement nsIDOMHTMLTime
Ranges nsIDOMJSWindow nsIDOMNode nsIDOMNSHTMLDocument nsIDOMStorageItem nsIDOMStorageManager nsIDOMWindow nsIDOMWindow2 nsIDOMWindowInternal nsIDOMWindowUtils nsIDynamicContainer nsIEditor Event nsIDOMEvent nsIDOMEventGroup nsIDOMEventListener nsIDOMEventTarget nsIDOMMouseScrollEvent nsIDOMMozTouchEvent nsIDOMOrientationEve...
nsIMsgSearchValue
tatus; attribute unsigned long size; attribute nsMsgKey msgKey; attribute long age; // in days attribute nsIMsgFolder folder; attribute nsMsgLabelValue label; attribute nsMsgJunkStatus junkStatus; /* * junkPercent is set by the message filter plugin, and is approximately * proportional to the probability that a message is junk. * (
range 0-100, 100 is junk) */ attribute unsigned long junkPercent; AString toString(); }; ...
Frequently Asked Questions
any. Assigning in the value 0 is just like assigning in a raw pointer that happens to be NULL. The old referent will be Released. [See Initialization and Assignment for more details] You should note, though, that there is a small performance penalty for this. The nsCOMPtr will still exercize logic in its destructor to attempt to Release the value it has at that time. The optimal solution is to ar
range the lifetime of your nsCOMPtr to correspond to exactly how long you want to hold the reference. E.g., using blocks as in this sample // The most efficient scheme is to scope your |nsCOMPtr| to live exactly as long // as you need to hold the reference nsresult SomeLongFunction( nsIBar* aBar ) { nsresult rv; // ... { // I only need the |nsIFoo| interface for a...
Weak reference
EFNSIID aIID, void** aInstancePtr ) { // ... else if ( aIID.Equals(nsCOMTypeInfo<nsISupportsWeakReference>::GetIID()) ) *aInstancePr = NS_STATIC_CAST(nsISupportsWeakReference*, this); // ... } Alternatives This technique is useful, but in situations where you need this, there are two alternatives which you may want to consider: You might hold an owning reference, but ar
range to Release it out-of-band; this must be before the destructor, which would otherwise never be called. You might hold a raw pointer (without AddRefing and Releaseing it), and avoid using it in cases where it might dangle. See also The source xpcom/base/nsIWeakReference.idl xpcom/glue/nsWeakReference.h xpcom/glue/nsWeakReference.cpp XPCOM ownership guidelines Using nsCOMPtr...
Creating a gloda message query
ous color constraint it would match a red square, a green square, or a blue square. query.involves(identity1, identity2, ...): Add the constraint that the message must "involve" one of the identities provided. An identity is involved if the message was to them, from them, or carbon-copied to them. gloda.from, gloda.to, gloda.cc: Just like gloda.involves, but specific to from/to/cc. gloda.date
Range([lowerDate1, upperDate1], [lowerDate2, upperDate2], ...): Add the constraint that the message date (per the message's Date header) must fall within one of the specified inclusive
ranges. The date instances are JavaScript Date instances. query.folder(folder1, folder2, ...): Add the constraint that the message must be found in one of the specified folders. The folder may be a GlodaFolder instance ...
Gloda examples
N); query.subjectMatches("Gloda makes searching easy"); query.getCollection(aListener) Search messages by tags Searches for all messages having any (or several) of all tags defined in TB let query = Gloda.newQuery(Gloda.NOUN_MESSAGE); let tagArray = MailServices.tags.getAllTags({}); query.tags(...tagArray); let collection = query.getCollection(myListener); Search messages by date
Range Searches for all messages within a date
range id_q=Gloda.newQuery(Gloda.NOUN_MESSAGE); // Define a date
range form yesterday to now id_q.date
Range([new Date() - 86400000, new Date()]); var myListener = { /* called when new items are returned by the database query or freshly indexed */ onItemsAdded: function _onItemsAdded(aItems, aCollection) { }, /* called when items that are al...
Finding the code for a feature
I use mxr and look for "cmd_tag". I see it occurs in mail3PaneWindowCommands.js a couple of times. I look at the last occurrence, and see it is just an enable item with no real action involved. Oops, I guess I need to get the submenu instead. Repeating this process, I see that the submenu items all call a function ToggleMessageTagMenu. Looking that up in mxr, its underlying function uses a very st
range call prevHdrFolder[toggler](messages, key) to change the key. Trying to figure that out from the code, I see that is just a clever way to do the addKeywordsToMessages or removeKeywordsFromMessages method call. (Please don't do that guys, it really makes code search difficult!) So the answer the your question is, use the nsIMsgFolder method "addKeywordsToMessages" (and now I remember that I knew ...
Using the Multiple Accounts API
you have a working account, identity, and server. It is possible, through some tricks with server and identity keys, to share servers and identities between accounts. You can do this by referring to the same identity or server key in the preferences, or with clever calls to the account manager. (Left as an exercise for the reader.)This will work but it is not supported. The UI will act slighty st
range when you share information between accounts. The current plans prevent sharing of information between accounts using the UI. Relevant API calls: nsIMsgAccount nsIMsgAccountManager.createAccount() nsIMsgAccount nsIMsgAccountManager.getAccount(in string key) nsIMsgIncomingServer nsIMsgAccountManager.createIncomingServer(in string type) nsIMsgIncomingServer nsIMsgAccountManager.getInco...
Using the Mozilla symbol server
0.0.4. This allows debugging of those builds without forcing all users to download large debugging files. The server functions like Microsoft's symbol server so the documentation there can be useful. Note that because Mozilla release builds are heavily optimized, debugging is not always easy. The debugger will not be able to show you the content of all variables and the execution path can seem st
range because of inlining, tail calls, and other compiler optimizations. The only workaround is to build an unoptimized local build. The official symbol server URL for Firefox is https://symbols.mozilla.org/. You cannot visit this URL directly: you must add it to the symbol path of your debugging tool. In the examples below, a local cache directory is used to avoid repeatedly fetching the PDB from the...
WebIDL bindings
be able to throw and do not need to be flagged as throwing. [DependsOn] Used for a method or attribute to indicate what the return value depends on. Possible values are: Everything This value can't actually be specified explicitly; this is the default value you get when [DependsOn] is not specified. This means we don't know anything about the return value's dependencies and hence can't rear
range other code that might change values around the method or attribute. DOMState The return value depends on the state of the "DOM", by which we mean all objects specified via Web IDL. The return value is guaranteed to not depend on the state of the JS heap or other JS engine data structures, and is guaranteed to not change unless some function with [Affects=Everything] is executed. DeviceState T...
Using Objective-C from js-ctypes
d(NSSpeechSynthesizer, alloc); Selector for a method with arguments In this case, [NSSpeechSynthesizer initWithVoice:] takes one argument; the selector name with a trailing colon. SEL initWithVoice = sel_registerName("initWithVoice:"); If a method takes two or more arguments, the selector name becomes a concatenation of each name. // [NSString getBytes:maxLength:usedLength:encoding:options:
range:remaining
Range:] SEL foo = sel_registerName("getBytes:maxLength:usedLength:encoding:options:
range:remaining
Range:"); Method which returns non-id type If a method returns a type which is compatible with id, we can cast it, or just use it as id type (since we don't need to use a different type for each instance, in terms of C). Otherwise, the following functions can be used, depending on return...
ArrayType
otes the number of entries present in an array or the number of elements that an array should contain. If you don't specify this parameter, the array's length is unspecified. Return value A CType represents the newly declared array type. Exceptions thrown TypeError type is not a CType, or type.size is undefined.If the length is specifed but if it is not a valid one,then it is also thrown
RangeError The size of the resulting array can't be represented as both a size_t and as a JavaScript number. Properties Property Type Description elementType CType The data type of the elements in an array type. Read only. length Number The number of elements in the array, or undefined if the array type doesn't have a specified length. Read only. ...
Int64
se a string to represent a 64-bit value that is too large to represent as a 32-bit JavaScript Number. Return value A new object representing the specified value. Exceptions thrown TypeError The specified value cannot be converted into a 64-bit integer. Either it's not a Number, String, or 64-bit integer object, or it's a string that is incorrectly formatted or contains a value outside the
range that can be represented in 64 bits. This will also be thrown if the source value is a floating-point number that can't be precisely represented as a 64-bit integer. Method overview Number compare(a, b); Number hi(a); Int64 join(high, low); Number lo(a); String toSource(); String toString([radix]); Methods compare() Compares two 64-...
StructType
d opaque and you can't access its contents directly. You can call the resulting type's define() method to assign it a non-opaque type later. See Opaque structures for further explanation and an example. Return value A CType object describing the newly created struct data type. Exceptions thrown TypeError The name is not a string, or one or more of the fields does not have a defined size.
RangeError The size of the structure, in bytes, cannot be represented both as a size_t and as a JavaScript Number. Describing fields The fields array is comprised of field descriptors, one for each field in the structure. Each field descriptor contains the field's name and its type, such as {'serialNumber': ctypes.int}. A complete field descriptor list might look like this: [ {'serialNumber': ctyp...
UInt64
se a string to represent a 64-bit value that is too large to represent as a 32-bit JavaScript Number. Return value A new object representing the specified value. Exceptions thrown TypeError The specified value cannot be converted into a 64-bit integer. Either it's not a Number, String, or 64-bit integer object, or it's a string that is incorrectly formatted or contains a value outside the
range that can be represented in 64 bits. This will also be thrown if the source value is a floating-point number that can't be precisely represented as a 64-bit integer. Method overview Number compare(a, b); Number hi(a); UInt64 join(high, low); Number lo(a); String toSource(); String toString([radix]); Methods compare() Compares two 64...
ctypes
Signed 16-bit integer. uint16_t Unsigned 16-bit integer. int32_t Signed 32-bit integer. uint32_t Unsigned 32-bit integer. int64_t Signed 64-bit integer. uint64_t Unsigned 64-bit integer. float32_t 32-bit floating-point value. float64_t 64-bit floating-point value. Note: Some 64-bit values are outside the
range of numeric values supported by JavaScript. Because of this, ctypes.int64 and ctypes.uint64 do not automatically convert to JavaScript numbers. Instead, they convert to objects of the wrapper types ctypes.Int64 and ctypes.UInt64, which are JavaScript objects rather than CData objects. See 64-bit integers for details. Types that act like specific C types These types are designed to work exactly l...
Browser Side Plug-in API - Plugins
plug-in thread (the thread on which the plug-in was initiated). NPN_PopPopupsEnabledState Pops the popups-enabled state. NPN_PostURL Posts data to a URL. NPN_PostURLNotify Posts data to a URL, and receives notification of the result. NPN_PushPopupsEnabledState Pushes the popups-enabled state. NPN_ReloadPlugins Reloads all plug-ins in the Plugins directory. NPN_RequestRead Requests a
range of bytes for a seekable stream. NPN_SetValue Sets windowless plug-in as transparent or opaque. NPN_SetValueForURL Allows a plug-in to change the stored information associated with a URL, in particular its cookies. NPN_Status Displays a message on the status line of the browser window. NPN_UserAgent Returns the browser's user agent field. NPN_Version Returns version information for the ...
Plug-in Basics - Plugins
Next >> How Plug-ins are used Plug-ins offer a rich variety of features that can increase the flexibility of Gecko-based browsers. Plug-ins like these are now available: multimedia viewers such as Adobe Flash and Adobe Acrobat utilities that provide object embedding and compression/decompression services applications that
range from personal information managers to games The
range of possibilities for using plug-in technology seems boundless, as shown by the growing numbers of independent software vendors who are creating new and innovative plug-ins. With the Plug-in API, you can create dynamically loaded plug-ins that can: register one or more MIME types draw into a part of a browser window receive keyboard and mouse events obtain data from the network using URLs post dat...
Version, UI, and Status Information - Plugins
pports a particular feature by using version or NPVERS constants (see Version Feature Constants). Each NPVERS constant represents a feature. The plug-in can compare the NPVERS constant to the version number. If the version supports the feature, the plug-in can operate according to plan. If not, the plug-in cannot use some functionality. If an essential feature is unavailable, the developer must ar
range for alternative behavior, shut down the plug-in, or give the user a chance to decide what to do. Detecting Windowless Support on MS Windows and Mac OS X In this example, the has_windowless method finds out whether the current version of the API supports windowless plug-ins. This method for detecting support is only useful on MS Windows and Mac OS X. It starts by using NPN_Version to get the ve...
Accessibility Inspector - Firefox Developer Tools
s about recommended contrast ratios. For example: The color contrast in the image above is 2.86, so potentially not enough contrast to make it easy to read. Notice the warning symbol that indicates that the contrast fails to meet the acceptable contrast ratio. As of Firefox 65, viewing this information for some foreground text that has a complex background image (e.g. a gradient) gives you a
range of color contrast values. For example: In this example, the contrast
ranges from 4.72 to 5.98. The numbers are followed by AAA and a checkmark in green, indicating that the large text has a contrast ratio of 4.5:1 or more, meeting the criteria for enhanced contrast, or Level AAA. See Color contrast for more information on color contrast. Accessibility picker Like the element picker button o...
Set a breakpoint - Firefox Developer Tools
e above), or by highlighting the line you want to break at in the source pane and pressing Ctrl + Shift + B (Windows/Linux) or Cmd + Shift + B (macOS). When you first choose to set a conditional breakpoint, a text entry line will appear into which you add the condition you want it to break on: Once you've entered your condition and pressed Enter/Return, the line number will be highlighted in o
range: Breakpoints list Once you've set some breakpoints, the breakpoints list in the right-hand column shows the filename and line number for each one: Unsetting a breakpoint Once a breakpoint has been set, you can unset it again in various ways: Click on the line number highlight. Highlight the line of code the breakpoint is set on and pressing Ctrl + B (Windows/Linux) or Cmd + B (macOS).
Set a conditional breakpoint - Firefox Developer Tools
s that only happen on odd entries in a list, or errors that occur the last time through a loop, for example. To set a conditional breakpoint, activate the context menu in the source pane, on the line where you want the breakpoint, and select "Add Conditional Breakpoint". You'll then see a textbox where you can enter the expression. Press Return to finish. Conditional breakpoints are shown as o
range arrows laid over the line number. If you context-click on any breakpoint, you'll see a menu item "Edit Breakpoint". You can use this to modify an existing condition or to add a condition to a normal breakpoint. ...
Set a logpoint - Firefox Developer Tools
n the Debugger panel and pick Add log action from the context menu. Create an expression inline. The result is logged in the console panel every time the line with the logpoint executes. You can use any variable or function available in the current scope. Working with logpoints When you set a logpoint, the indicator is purple, rather than the blue of an unconditional breakpoint or the o
range of a conditional breakpoint. You can view the list of logpoints in the Breakpoints side panel. When execution hits a logpoint, the message you have defined is logged to the console. You can make it easier to see the message by opening a split console under the debugger. (Either press Esc or select the elipsis menu (...) and then click Show Split Console.) When should you use logpoints? ...
Set event listener breakpoints - Firefox Developer Tools
. This article explains how to use it. Using a standard event breakpoint To use an event breakpoint, you open up the JavaScript debugger, and find and expand the Event Listener Breakpoints section in the right hand column. To break when event listeners are hit, check the boxes next the events you are interested in. All of the standard events supported in your version of Firefox are listed, ar
ranged by which API or API area they're part of. Now when a keydown, keyup, keypress, or input event occurs, execution will pause as soon as it enters the listener code. When execution pauses, the source pane displays the highlighted line of the JavaScript code that is next to be executed, along with the surrounding code for context. In addition, you get a box overlaid on the viewport saying "Pause...
UI Tour - Firefox Developer Tools
he Outline view shows a tree for navigating the currently open file. Use it to jump directly to a function, class or method definition. Source pane This shows the JavaScript file currently loaded. When the source pane is focused you can search for a string in the file using Ctrl + F (Cmd + F on a Mac). Breakpoints have a blue arrow overlaid on the line number. Conditional breakpoints have an o
range arrow. If you're stopped at a breakpoint, the entire line gets a green overlay. In the screenshot below there are three breakpoints: line 82 has a normal breakpoint and execution is paused here line 85 has a logpoint which logs the contents of tablerow to the console line 100 has a conditional breakpoint The third column shows more information about the breakpoints. For example, the logp...
Index - Firefox Developer Tools
he same machine. In this guide, the instance of Firefox being debugged is called the debuggee, and the instance of Firefox doing the debugging is called the debugger. 101 Responsive Design Mode Design, Dev Tools, Firefox, Guide, Responsive Design, Tools, Web Development, l10n:priority Responsive design is the practice of designing a website so it looks and works properly on a
range of different devices -- particularly mobile phones and tablets as well as desktops and laptops. 102 Rulers DevTools, Firefox, Rulers, Tools You can overlay horizontal and vertical rulers on a web page: 103 Settings Beginning with Firefox 62, the icon to open Developer Tools settings has been moved into a menu accessed by clicking/touching ... (the elipsi...
Aggregate view - Firefox Developer Tools
occupied by objects in each category, and that number as a percentage of the whole heap size for that tab. The screenshots in this section are taken from a snapshot of the monster example page. For example, in the screenshot above, you can see that: there are four Array objects that account for 15% of the total heap. Next to the type's name, there's an icon that contains three stars ar
ranged in a triangle: Click this to see every instance of that type. For example, the entry for Array tells us that there are four Array objects in the snapshot. If we click the star-triangle, we'll see all four Array instances: For each instance, you can see the retained size and shallow size of that instance. In this case, you can see that the first three arrays have a fairly large shallow size...
Examine and edit HTML - Firefox Developer Tools
dable. Usually this white space seems to have no effect and no visual output, but in fact, when a browser parses HTML it will automatically generate anonymous text nodes for elements not contained in a node. This includes white space (which is after all a type of text). If these auto generated text nodes are inline level, browsers will give them a non-zero width and height. Then you will find st
range gaps between elements, even if you haven't set any margin or padding on them. Since Firefox 52, the Inspector displays these whitespace nodes, so you can see where the gaps in your markup come from. Whitespace nodes are represented with a dot: and you get an explanatory tooltip when you hover over them: To see this in action, see the demo at https://mdn.github.io/devtools-examples/whitespace...
Work with animations - Firefox Developer Tools
children. The timeline starts at the start of the first animation, ends at the end of the last animation, and is labeled with markers every 250 milliseconds (this depends on the time scale of the animations currently displayed). Animation bars Each animation or transition is shown as a horizontal bar laid across the timeline. The bar is: blue if a transition was used to animate a property o
range if a @keyframes animation was used green if the Web Animations API was used The bar contains a lightning bolt icon if the property was animated using the compositor thread (see more about the cost of animating different CSS properties). The bar is shaped to reflect the easing effect used for the animation. In the example above you can see that the first bar is concave, representing ease-in, ...
Frame rate - Firefox Developer Tools
see that the average frame rate is reasonably healthy, but there are three spots where frame rate collapses for tens of milliseconds. This would certainly cause a noticeable stutter for any animations that were playing in the page. The frame rate graph is correlated with the waterfall summary directly above it, and there we can see that the first two drops in the frame rate are correlated with o
range bars, which denote time spent executing JavaScript. If we select one of these slices of the recording, the main Waterfall view underneath it is zoomed into it, and we can see the function that's causing the problem: We have a JavaScript function from a click event that's blocking the main thread for 170 milliseconds. Which function, though? Switch to the Flame Chart to see the call stack at ...
Waterfall - Firefox Developer Tools
ers, and their colors, are the same in the Waterfall tool as in the Waterfall overview, making is easy to correlate from one to the other. Filtering markers You can control which markers are displayed using a button in the Toolbar: Waterfall patterns Exactly what you'll see in the Waterfall is very dependent on the kind of thing your site is doing: JavaScript-heavy sites will have a lot of o
range, while visually dynamic sites will have a lot of purple and green. But there are common patterns which can alert you to possible performance problems. Rendering waterfall One pattern that you'll often see in the Waterfall view is something like this: This is a visualization of the basic algorithm the browser uses to update the page in response to some event: JavaScript Function Call: some...
Responsive Design Mode - Firefox Developer Tools
The most obvious factor here is screen size, but there are other factors as well, including the pixel density of the display and whether it supports touch. Responsive Design Mode gives you a simple way to simulate these factors, to test how your website will look and behave on different devices. ...
Console messages - Firefox Developer Tools
ly messages of particular categories, click the button labeled with that category (Errors, CSS, and so on). For Errors and Warnings, when you turn off display of the category, a number appears next to the button text to indicate how many messages of that type are available. For example, "Warnings (25)". Network requests with response codes in the 400-499 (client error) or 500-599 (server error)
ranges are considered errors. Their display is controlled by the Errors button, not the Requests button. Filtering by text To see only messages that contain a specific string, type in the text box labeled "Filter output". For example, if you entered the string img into the text box, you would have a list something like this: A small "x" icon appears at the right end of the text box when you have e...
The JavaScript input interpreter - Firefox Developer Tools
ing pane opens on the left side the of Web Console. You can enter multiple lines of JavaScript by default in this mode, pressing Enter after each one. To execute the snippet that is currently in the editing pane, click the Run button or press Ctrl+Enter (or Cmd+Return on MacOS). The snippet is echoed under the input prompt (in the right-side pane), followed by the result. You can also select a
range of lines in the editing pane, and run just the code on those lines. Starting in Firefox 76, if the code snippet is more than five lines long, only the first five lines are echoed in the console, preceeded by a disclosure triangle (or "twistie"), and followed by an ellipsis (...). Click anywhere in the area containing the echoed code to show the whole snippet; click again in that area to collapse...
ANGLE_instanced_arrays - Web APIs
ch can be used in the gl.getVertexAttrib() method: ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE Returns a GLint describing the frequency divisor used for instanced rendering when used in the gl.getVertexAttrib() as the pname parameter. Methods This extension exposes three new methods. ext.drawArraysInstancedANGLE() Behaves identically to gl.drawArrays() except that multiple instances of the
range of elements are executed, and the instance advances for each iteration. ext.drawElementsInstancedANGLE() Behaves identically to gl.drawElements() except that multiple instances of the set of elements are executed and the instance advances between each set. ext.vertexAttribDivisorANGLE() Modifies the rate at which generic vertex attributes advance when rendering multiple instances of p...
AnalyserNode.fftSize - Web APIs
d integer, representing the window size of the FFT, given in number of samples. A higher value will result in more details in the frequency domain but fewer details in the time domain. Must be a power of 2 between 252^5 and 2152^15, so one of: 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768. Defaults to 2048. Note: If its value is not a power of 2, or it is outside the specified
range, a DOMException with the name IndexSizeError is thrown. Example The following example shows basic usage of an AudioContext to create an AnalyserNode, then requestAnimationFrame and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js ...
AnalyserNode.maxDecibels - Web APIs
Syntax var curValue = analyserNode.maxDecibels; analyserNode.maxDecibels = newValue; Value A double, representing the maximum decibel value for scaling the FFT analysis data, where 0 dB is the loudest possible sound, -10 dB is a 10th of that, etc. The default value is -30 dB. ...
AnalyserNode.minDecibels - Web APIs
Syntax var curValue = analyserNode.minDecibels; analyserNode.minDecibels = newValue; Value A double, representing the minimum decibel value for scaling the FFT analysis data, where 0 dB is the loudest possible sound, -10 dB is a 10th of that, etc. The default value is -100 dB. ...
Animation.playState - Web APIs
e In the Growing/Shrinking Alice Game example, players can get an ending with Alice crying into a pool of tears. In the game, for performance reasons, the tears should only be animating when they're visible. So they must be paused as soon as they are animated like so: // Setting up the tear animations tears.forEach(function(el) { el.animate( tearsFalling, { delay: getRandomMs
Range(-1000, 1000), // randomized for each tear duration: getRandomMs
Range(2000, 6000), // randomized for each tear iterations: Infinity, easing: 'cubic-bezier(0.6, 0.04, 0.98, 0.335)' }); el.pause(); }); // Play the tears falling when the ending needs to be shown. tears.forEach(function(el) { el.play(); }); // Reset the crying tears animations and pause them. tears.forE...
AudioBuffer() - Web APIs
ate. numberOfChannels: The number of channels for the buffer. The default is 1, and all user agents are required to support at least 32 channels. sampleRate: The sample rate in Hz for the buffer. The default is the sample rate of the context used in constructing this object. User agents are required to support sample rates from 8,000 Hz to 96,000 Hz (but are allowed to go farther outside this
range). Deprecated parameters context A reference to an AudioContext. This parameter was removed from the spec. Return value A new AudioBuffer object instance. Exceptions NotSupportedError One or more of the options are negative or otherwise has an invalid value (such as numberOfChannels being higher than supported, or a sampleRate outside the nominal
range).
RangeError There isn'...
AudioBuffer.copyFromChannel() - Web APIs
channel number of the current AudioBuffer to copy the channel data from. startInChannel Optional An optional offset into the source channel's buffer from which to begin copying samples. If not specified, a value of 0 (the beginning of the buffer) is assumed by default. Return value undefined. Exceptions indexSizeError One of the input parameters has a value that is outside the accepted
range: The value of channelNumber specifies a channel number which doesn't exist (that is, it's greater than or equal to the value of numberOfChannels on the channel). The value of startInChannel is outside the current
range of samples that already exist in the source buffer; that is, it's greater than its current length. Example This example creates a new audio buffer, then copies the sam...
AudioBuffer - Web APIs
). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. Objects of these types are designed to hold small audio snippets, typically less than 45 s. For longer sounds, objects implementing the MediaElementAudioSourceNode are more suitable. The buffer contains data in the following format: non-interleaved IEEE754 32-bit linear PCM with a nominal
range between -1 and +1, that is, 32bits floating point buffer, with each samples between -1.0 and 1.0. If the AudioBuffer has multiple channels, they are stored in separate buffer. Constructor AudioBuffer() Creates and returns a new AudioBuffer object instance. Properties AudioBuffer.sampleRate Read only Returns a float representing the sample rate, in samples per second, of the PCM data s...
AudioBufferSourceNode - Web APIs
r that defines the audio asset to be played, or when set to the value null, defines a single channel of silence (in which every sample is 0.0). AudioBufferSourceNode.detune Is a k-rate AudioParam representing detuning of playback in cents. This value is compounded with playbackRate to determine the speed at which the sound is played. Its default value is 0 (meaning no detuning), and its nominal
range is -? to ?. AudioBufferSourceNode.loop A Boolean attribute indicating if the audio asset must be replayed when the end of the AudioBuffer is reached. Its default value is false. AudioBufferSourceNode.loopStart Optional A floating-point value indicating the time, in seconds, at which playback of the AudioBuffer must begin when loop is true. Its default value is 0 (meaning that at the beginning...
AudioListener.forwardX - Web APIs
presenting the x value of the direction vector defining the forward direction the listener is pointing in. Note: The parameter is a-rate when used with a PannerNode whose panningModel is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.forwardX.value = 0; Value An AudioParam. Its default value is 0, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioListener.forwardY - Web APIs
presenting the y value of the direction vector defining the forward direction the listener is pointing in. Note: The parameter is a-rate when used with a PannerNode whose panningModel is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.forwardY.value = 0; Value An AudioParam. Its default value is 0, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioListener.forwardZ - Web APIs
resenting the z value of the direction vector defining the forward direction the listener is pointing in. Note: The parameter is a-rate when used with a PannerNode whose panningModel is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.forwardZ.value = 0; Value An AudioParam. Its default value is -1, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioListener.positionX - Web APIs
AudioListener interface is an AudioParam representing the x position of the listener in 3D cartesian space. Note: The parameter is a-rate when used with a PannerNode whose PannerNode is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.positionX.value = 1; Value An AudioParam. Its default value is 0, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioListener.positionY - Web APIs
AudioListener interface is an AudioParam representing the y position of the listener in 3D cartesian space. Note: The parameter is a-rate when used with a PannerNode whose PannerNode is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.positionY.value = 1; Value An AudioParam. Its default value is 0, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioListener.positionZ - Web APIs
AudioListener interface is an AudioParam representing the z position of the listener in 3D cartesian space. Note: The parameter is a-rate when used with a PannerNode whose PannerNode is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.positionZ.value = 1; Value An AudioParam. Its default value is 0, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioListener.upX - Web APIs
udioParam representing the x value of the direction vector defining the up direction the listener is pointing in. Note: The parameter is a-rate when used with a PannerNode whose PannerNode is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.upX.value = 0; Value An AudioParam. Its default value is 0, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioListener.upY - Web APIs
udioParam representing the y value of the direction vector defining the up direction the listener is pointing in. Note: The parameter is a-rate when used with a PannerNode whose PannerNode is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.upY.value = 0; Value An AudioParam. Its default value is 1, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioListener.upZ - Web APIs
udioParam representing the z value of the direction vector defining the up direction the listener is pointing in. Note: The parameter is a-rate when used with a PannerNode whose PannerNode is set to equalpower, or k-rate otherwise. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.upZ.value = 0; Value An AudioParam. Its default value is 0, and it can
range between positive and negative infinity. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is ...
AudioNode.connect() - Web APIs
endered audio data from any AudioNode output connected to it and convert it to mono by down-mixing (if it is not already mono). Next, it will mix it together with any other such outputs, and the intrinsic parameter value (the value the AudioParam would normally have without any audio connections), including any timeline changes scheduled for the parameter. Therefore, it is possible to choose the
range in which an AudioParam will change by setting the value of the AudioParam to the central frequency, and to use a GainNode between the audio source and the AudioParam to adjust the
range of the AudioParam changes. Specifications Specification Status Comment Web Audio APIThe definition of 'connect() to an AudioNode' in that specification. Working Draft Web ...
AudioNode.disconnect() - Web APIs
cribing which input into the specified destination AudioNode is to be disconnected. The index numbers are defined according to the number of input channels (see Audio channels). If this parameter is out-of-bound, an IndexSizeError exception is thrown. Exceptions IndexSizeError A value specified for input or output is invalid, referring to a node which doesn't exist or outside the permitted
range. InvalidAccessError The node on which disconnect() was called isn't connected to the specified destination node. Example var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var oscillator = audioCtx.createOscillator(); var gainNode = audioCtx.createGain(); oscillator.connect(gainNode); gainNode.connect(audioCtx.destination); gainNode.di...
AudioParam.setValueCurveAtTime() - Web APIs
representing the total time (in seconds) over which the parameter's value will change following the specified curve. The specified values are spaced equally along this duration. Return value A reference to this AudioParam object. Some older browser implementations of this interface return undefined. Exceptions InvalidStateError The specified array of values has fewer than 2 items in it.
RangeError The specified startTime is either negative or a non-finite value, or duration is not a finite, strictly positive number. TypeError One or more of the values in the values array is non-finite. Non-finite values are NaN, Infinity, and -Infinity. Usage notes When the parameter's value finishes following the curve, its value is guaranteed to match the last value in the set of values specif...
AudioParam.value - Web APIs
to managing the value of a parameter: If the value setter has been used, the parameter's value is changed to the value given. If the current time equals or exceeds the time specified by a previous call to setValueAtTime(), the value is changed to the value passed into setValueAtTime(). If any gradiated or ramped value changing methods have been called and the current time is within the time
range over which the graduated change should occur, the value is updated based on the appropriate algorithm. These ramped or gradiated value-changing methods include linearRampToValueAtTime(), setTargetAtTime(), and setValueCurveAtTime(). Thus, the value of a parameter is maintained to accurately reflect the state of the parameter over time. Example This example instantly changes the volume of a Ga...
AudioParam - Web APIs
y precise times, using arbitrary timelime-based automation curves. The time used is the one defined in AudioContext.currentTime. Properties AudioParam.defaultValue Read only Represents the initial volume of the attribute as defined by the specific AudioNode creating the AudioParam. AudioParam.maxValue Read only Represents the maximum possible value for the parameter's nominal (effective)
range. AudioParam.minValue Read only Represents the minimum possible value for the parameter's nominal (effective)
range. AudioParam.value Represents the parameter's current value as of the current time; initially set to the value of defaultValue. Methods AudioParam.setValueAtTime() Schedules an instant change to the value of the AudioParam at a precise time, as measured against AudioConte...
AudioScheduledSourceNode.start() - Web APIs
inning. duration Optional A floating-point number indicating the duration, in seconds, to be played. If no value is passed then the duration will be equal to the length of the audio buffer minus the offset value Return value undefined Exceptions InvalidStateNode The node has already been started. This error occurs even if the node is no longer running because of a prior call to stop().
RangeError The value specified for when is negative. Example This example demonstrates how to create an OscillatorNode which is scheduled to start playing in 2 seconds and stop playing 1 second after that. The times are calculated by adding the desired number of seconds to the context's current time stamp returned by AudioContext.currentTime. context = new AudioContext(); osc = context.createOscil...
AudioScheduledSourceNode.stop() - Web APIs
onds, at which the sound should stop playing. This value is specified in the same time coordinate system as the AudioContext is using for its currentTime attribute. Omitting this parameter, specifying a value of 0, or passing a negative value causes the sound to stop playback immediately. Return value undefined Exceptions InvalidStateNode The node has not been started by calling start().
RangeError The value specified for when is negative. Example This example demonstrates starting an oscillator node, scheduled to begin playing at once and to stop playing in one second. The stop time is determined by taking the audio context's current time from AudioContext.currentTime and adding 1 second. context = new AudioContext(); osc = context.createOscillator(); osc.connect(context.destinat...
BaseAudioContext.createBuffer() - Web APIs
ength An integer representing the size of the buffer in sample-frames (where each sample-frame is the size of a sample in bytes multiplied by numOfChannels). To determine the length to use for a specific number of seconds of audio, use numSeconds * sampleRate. sampleRate The sample rate of the linear audio data in sample-frames per second. All browsers must support sample rates in at least the
range 8,000 Hz to 96,000 Hz. Returns An AudioBuffer configured based on the specified options. Exceptions NotSupportedError One or more of the options are negative or otherwise has an invalid value (such as numberOfChannels being higher than supported, or a sampleRate outside the nominal
range).
RangeError There isn't enough memory available to allocate the buffer. Examples First, a couple...
BaseAudioContext.createPeriodicWave() - Web APIs
; osc.setPeriodicWave(wave); osc.connect(ac.destination); osc.start(); osc.stop(2); This works because a sound that contains only a fundamental tone is by definition a sine wave Here, we create a PeriodicWave with two values. The first value is the DC offset, which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0]
range. The second and subsequent values are sine and cosine components. You can think of it as the result of a Fourier transform, where you get frequency domain values from time domain value. Here, with createPeriodicWave(), you specify the frequencies, and the browser performs an inverse Fourier transform to get a time domain buffer for the frequency of the oscillator. Here, we only set one component...
BasicCardResponse.expiryMonth - Web APIs
Example Let's look at a sample payment request: var request = new PaymentRequest(supportedInstruments, details, options); // Call show() to trigger the browser's payment flow. request.show().then(function(instrumentResponse) { // Do something with the response from the UI. ...
BasicCardResponse.expiryYear - Web APIs
Example Let's look at a sample payment request: var request = new PaymentRequest(supportedInstruments, details, options); // Call show() to trigger the browser's payment flow. request.show().then(function(instrumentResponse) { // Do something with the response from the UI. ...
BiquadFilterNode.Q - Web APIs
Syntax var audioCtx = new AudioContext(); var biquadFilter = audioCtx.createBiquadFilter(); biquadfilter.Q.value = 100; Note: Though the AudioParam returned is read-only, the value it represents is not. Value An AudioParam. Example The following example shows basic usage of an AudioContext to create a Biquad filter node. ...
BiquadFilterNode.frequency - Web APIs
Syntax var audioCtx = new AudioContext(); var biquadFilter = audioCtx.createBiquadFilter(); biquadFilter.frequency.value = 3000; Note: Though the AudioParam returned is read-only, the value it represents is not. Value An AudioParam. ...
BiquadFilterNode.gain - Web APIs
The gain property of the BiquadFilterNode interface Is a a-rate AudioParam, a double representing the gain used in the current filtering algorithm. When it takes a positive value it is a real gain, when negative it is an attenuation. It is expressed in dB, has a default value of 0 and can take a value in a nominal
range of -40 to 40. Syntax var audioCtx = new AudioContext(); var biquadFilter = audioCtx.createBiquadFilter(); biquadfilter.gain.value = 25; Note: Though the AudioParam returned is read-only, the value it represents is not. Value An AudioParam. Example The following example shows basic usage of an AudioContext to create a Biquad filter node. For a complete working example, check out our voice-change-o-matic demo (look at the source code too). var audioCtx = new (window...
Blob - Web APIs
Blob.prototype.type Read only A string indicating the MIME type of the data contained in the Blob. If the type is unknown, this string is empty. Instance methods Blob.prototype.arrayBuffer() Returns a promise that resolves with an ArrayBuffer containing the entire contents of the Blob as binary data. Blob.prototype.slice() Returns a new Blob object containing the data in the specified
range of bytes of the blob on which it's called. Blob.prototype.stream() Returns a ReadableStream that can be used to read the contents of the Blob. Blob.prototype.text() Returns a promise that resolves with a USVString containing the entire contents of the Blob interpreted as UTF-8 text. Examples Creating a blob The Blob() constructor can create blobs from other objects. For example, to constr...
Bluetooth.getDevices() - Web APIs
The getDevices() method of Bluetooth interface of Web Bluetooth API exposes the Bluetooth devices this origin is allowed to access. This method does not display any permission prompts. Note: This method returns a BluetoothDevice for each device the origin is currently allowed to access, even the ones that are out of
range or powered off. The program can detect when a device comes online or into
range by watching for BlueTooth advertisements by calling BluetoothDevice.watchAdvertisements() on that device. Syntax var readerPromise = Bluetooth.getDevices(); Parameters None. Return value A Promise that resolves with an array of BluetoothDevices. Exceptions This method doesn't throw any exceptions. Specifications Specification Status Comment Web BluetoothThe...
CSSCounterStyleRule - Web APIs
riptor defined for the associated rule. If the descriptor was not specified in the associated rule, the attribute returns an empty string. CSSCounterStyleRule.suffix Is a DOMString object that contains the serialization of the suffix descriptor defined for the associated rule. If the descriptor was not specified in the associated rule, the attribute returns an empty string. CSSCounterStyleRule.
range Is a DOMString object that contains the serialization of the
range descriptor defined for the associated rule. If the descriptor was not specified in the associated rule, the attribute returns an empty string. CSSCounterStyleRule.pad Is a DOMString object that contains the serialization of the pad descriptor defined for the associated rule. If the descriptor was not specified in the associated...
CSSPrimitiveValue - Web APIs
olute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. (For example, a pixel value cannot be converted to a centimeter value.) Percentage values can't be converted since they are relative to the parent value (or another property value). There is one exception for color percentage values: since a color percentage value is relative to the
range 0-255, a color percentage value can be converted to a number (see also the RGBColor interface). <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin me...
CSSStyleDeclaration.item() - Web APIs
Syntax var propertyName = style.item(index); Parameters index is the index of the node to be fetched. The index is zero-based. Return value propertyName is a DOMString that is the name of the CSS property at the specified index. ...
Using dynamic styling information - Web APIs
on a particular element. More important than the two properties noted here is the use of the style object to set individual style properties on an element: <!DOCTYPE html> <html> <head> <title>style Property Example</title> <link rel="StyleSheet" href="example.css" type="text/css"> <script type="text/javascript"> function stilo() { document.getElementById('d').style.color = 'o
range'; } function resetStyle() { document.getElementById('d').style.color = 'black'; } </script> </head> <body> <div id="d" class="thunder">Thunder</div> <button onclick="stilo()">Click here to change text color</button> <button onclick="resetStyle()">Reset text color</button> </body> </html> The media and type of the style may or may not be given. Using the setAttr...
CSS Object Model (CSSOM) - Web APIs
CSS Typed Object Model CSSImageValue CSSKeywordValue CSSMathInvert CSSMathMax CSSMathMin CSSMathNegate CSSMathProduct CSSMathSum CSSMathValue CSSMatrixComponent CSSNumericArray CSSNumericValue CSSPerspective CSSPositionValue CSSRotate CSSScale CSSSkew CSSSkewX CSSSkewY CSSStyleValue CSSTransformComp...
Cache.add() - Web APIs
e.add(request).then(function() { // request has been added to the cache }); Parameters request The request you want to add to the cache. This can be a Request object or a URL. Return value A Promise that resolves with undefined. Exceptions Exception Happens when TypeError The URL scheme is not http or https. The Response status is not in the 200
range (i.e., not a successful response.) This occurs if the request does not return successfully, but also if the request is a cross-origin no-cors request (in which case the reported status is always 0.) Examples This code block waits for an InstallEvent to fire, then calls waitUntil() to handle the install process for the app. This consists of calling CacheStorage.open to create a new cac...
Cache.addAll() - Web APIs
been added to the cache }); Parameters requests An array of string URLs that you want to be fetched and added to the cache. You can specify the Request object instead of the URL. Return value A Promise that resolves with undefined. Exceptions Exception Happens when TypeError The URL scheme is not http or https. The Response status is not in the 200
range (i.e., not a successful response.) This occurs if the request does not return successfully, but also if the request is a cross-origin no-cors request (in which case the reported status is always 0.) Examples This code block waits for an InstallEvent to fire, then runs waitUntil() to handle the install process for the app. This consists of calling CacheStorage.open to create a new cach...
Cache.match() - Web APIs
if() condition is false, then this fetch handler won't intercept the request. If there are any other fetch handlers registered, they will get a chance to call event.respondWith(). If no fetch handlers call event.respondWith(), the request will be handled by the browser as if there were no service worker involvement. If fetch() returns a valid HTTP response with an response code in the 4xx or 5xx
range, the catch() will NOT be called. self.addEventListener('fetch', function(event) { // We only want to call event.respondWith() if this is a GET request for an HTML document. if (event.request.method === 'GET' && event.request.headers.get('accept').indexOf('text/html') !== -1) { console.log('Handling fetch event for', event.request.url); event.respondWith( fetch(event.requ...
Cache.put() - Web APIs
or one or more of these operations. fetch(url).then(function(response) { if (!response.ok) { throw new TypeError('Bad response status'); } return cache.put(url, response); }) Note: put() will overwrite any key/value pair previously stored in the cache that matches the request. Note: Cache.add/Cache.addAll do not cache responses with Response.status values that are not in the 200
range, whereas Cache.put lets you store any request/response pair. As a result, Cache.add/Cache.addAll can't be used to store opaque responses, whereas Cache.put can. Syntax cache.put(request, response).then(function() { // request/response pair has been added to the cache }); Parameters request The Request object or URL that you want to add to the cache. response The Response you want to ...
CanvasGradient.addColorStop() - Web APIs
vasGradient.addColorStop() method adds a new color stop, defined by an offset and a color, to a given canvas gradient. Syntax void gradient.addColorStop(offset, color); Parameters offset A number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end; an INDEX_SIZE_ERR is raised if the number is outside that
range. color A CSS <color> value representing the color of the stop. A SYNTAX_ERR is raised if the value cannot be parsed as a CSS <color> value. Examples Adding stops to a gradient This example uses the addColorStop method to add stops to a linear CanvasGradient object. The gradient is then used to fill a rectangle. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getEl...
CanvasRenderingContext2D.clip() - Web APIs
clipping region is a full circle, with its center at (100, 75), and a radius of 50. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // Create circular clipping region ctx.beginPath(); ctx.arc(100, 75, 50, 0, Math.PI * 2); ctx.clip(); // Draw stuff that gets clipped ctx.fillStyle = 'blue'; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = 'o
range'; ctx.fillRect(0, 0, 100, 100); Result Specifying a path and a fillRule This example saves two rectangles to a Path2D object, which is then made the current clipping region using the clip() method. The "evenodd" rule creates a hole where the clipping rectangles intersect; by default (with the "nonzero" rule), there would be no hole. HTML <canvas id="canvas"></canvas> JavaScript const c...
CanvasRenderingContext2D.globalAlpha - Web APIs
ha property of the Canvas 2D API specifies the alpha (transparency) value that is applied to shapes and images before they are drawn onto the canvas. See also the chapter Applying styles and color in the Canvas Tutorial. Syntax ctx.globalAlpha = value; Options value A number between 0.0 (fully transparent) and 1.0 (fully opaque), inclusive. The default value is 1.0. Values outside that
range, including Infinity and NaN, will not be set, and globalAlpha will retain its previous value. Examples Drawing translucent shapes This example uses the globalAlpha property to draw two semi-transparent rectangles. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.globalAlpha = 0.5; ctx.fillStyle = 'b...
CanvasRenderingContext2D.stroke() - Web APIs
ed every time you call the stroke() method. In some cases, however, this may be the desired effect. HTML <canvas id="canvas"></canvas> JavaScript This code strokes the first path three times, the second path two times, and the third path only once. ...
Pixel manipulation with canvas - Web APIs
xels that were obtained from another origin without using CORS, the canvas is tainted and its contents can no longer be read and saved. See Security and tainted canvases in Allowing cross-origin use of images and canvas canvas.toDataURL('image/png') Default setting. Creates a PNG image. canvas.toDataURL('image/jpeg', quality) Creates a JPG image. Optionally, you can provide a quality in the
range from 0 to 1, with one being the best quality and with 0 almost not recognizable but small in file size. Once you have generated a data URI from you canvas, you are able to use it as the source of any <image> or put it into a hyper link with a download attribute to save it to disc, for example. You can also create a Blob from the canvas. canvas.toBlob(callback, type, encoderOptions) Creates...
CompositionEvent.data - Web APIs
hod that raised the event; its exact nature varies depending on the type of event that generated the CompositionEvent object. Syntax myData = CompositionEvent.data Value A DOMString representing the event data: For compositionstart events, this is the currently selected text that will be replaced by the string being composed. This value doesn't change even if content changes the selection
range; rather, it indicates the string that was selected when composition started. For compositionupdate, this is the string as it stands currently as editing is ongoing. For compositionend events, this is the string as committed to the editor. Specifications Specification Status Comment Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'data' in...
Console.table() - Web APIs
y, then its values will be the array indices. If data is an object, then its values will be the property names. Note that (in Firefox) console.table is limited to displaying 1000 rows (first row is the labeled index). Note: This feature is available in Web Workers. Collections of primitive types The data argument may be an array or an object. ...
ConstantSourceNode() - Web APIs
eNode = new ConstantSourceNode(context, options); Parameters context An AudioContext representing the audio context you want the node to be associated with. options A ConstantSourceOptions dictionary object defining the properties you want the ConstantSourceNode to have: offset: A read-only AudioParam specifying the constant value generated by the source. The default is 1.0. The normal
range is -1.0 to 1.0, but the value can be anywhere in the
range from -Infinity to +Infinity. Example In this example, an audio context is created, then a ConstantSourceNode is established with its offset initialized to 0.5. let audioContext = new AudioContext(); let myConstantSource = new ConstantSourceNode(audioContext, { offset: 0.5 }); Note: The new ConstantSourceNode created by the cons...
DOMError - Web APIs
s an error object that contains an error name. Properties DOMError.name Read only Returns a DOMString representing one of the error type names (see below). DOMError.message Read only Returns a DOMString representing a message or description associated with the given error type name. Error types Type Description IndexSizeError The index is not in the allowed
range (e.g. thrown in a
range object). HierarchyRequestError The node tree hierarchy is not correct. WrongDocumentError The object is in the wrong document. InvalidCharacterError The string contains invalid characters. NoModificationAllowedError The object can not be modified. NotFoundError The object can not be found here. NotSupport...
DynamicsCompressorNode - Web APIs
ressorNode() Creates a new instance of an DynamicsCompressorNode object. Properties Inherits properties from its parent, AudioNode. DynamicsCompressorNode.threshold Read only Is a k-rate AudioParam representing the decibel value above which the compression will start taking effect. DynamicsCompressorNode.knee Read only Is a k-rate AudioParam containing a decibel value representing the
range above the threshold where the curve smoothly transitions to the compressed portion. DynamicsCompressorNode.ratio Read only Is a k-rate AudioParam representing the amount of change, in dB, needed in the input for a 1 dB change in the output. DynamicsCompressorNode.reduction Read only Is a float representing the amount of gain reduction currently applied by the compressor to the signal. Dyna...
EXT_texture_compression_bptc - Web APIs
t.COMPRESSED_RGBA_BPTC_UNORM_EXT Compresses 8-bit fixed-point data. Each 4x4 block of texels consists of 128 bits of RGBA or image data. See also BC7 format. ext.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT Compresses 8-bit fixed-point data. Each 4x4 block of texels consists of 128 bits of SRGB_ALPHA or image data. See also BC7 format. ext.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT Compresses high dynamic
range signed floating point values. Each 4x4 block of texels consists of 128 bits of RGB data. It only contains RGB data, so the returned alpha value is 1.0. See also BC6H format. ext.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT Compresses high dynamic
range unsigned floating point values. Each 4x4 block of texels consists of 128 bits of RGB data. It only contains RGB data, so the returned alpha value is 1...
EffectTiming.easing - Web APIs
), or a custom cubic-bezier value like cubic-bezier(0.42, 0, 0.58, 1). Defaults to linear. Available values include: linear A constant rate of change, neither accelerating nor deccelerating. cubic-bezier(<number>, <number>, <number>, <number>) Specifies a cubic Bezier timing function. The four numbers specify points P1 and P2 of the curve as (x1, y1, x2, y2). Both x values must be in the
range [0, 1] or the definition is invalid. ease A decelerated rate of change, going from fast to slow. Equivalent to cubic-bezier(0.25, 0.1, 0.25, 1). ease-in An accelerated rate of change, going from slow to fast. Equivalent to cubic-bezier(0.42, 0, 1, 1). ease-out Another decelerated rate of change, going from fast to slow. Equivalent to cubic-bezier(0, 0, 0.58, 1). ease-in-out This rate of c...
EffectTiming.fill - Web APIs
ming dictionary's fill property specifies a fill mode, which defines how the element to which the animation is applied should look when the animation sequence is not actively running, such as before the time specified by iterationStart or after animation's end time. For example, setting fill to "none" means the animation's effects are not applied to the element if the current time is outside the
range of times during which the animation is running, while "forwards" ensures that once the animation's end time has been passed, the element will continue to be drawn in the state it was in at its last rendered frame. Note that authors are discouraged from using fill modes to persist the effect of an animation indefinitely. See the alternatives to fill modes section below for approaches that are sim...
Element.matches() - Web APIs
see if the Element would be selected by the provided selectorString -- in other words -- checks if the element "is" the selector. Syntax var result = element.matches(selectorString); Parameters selectorString is a string representing the selector to test. Return value result is a Boolean. Exceptions SYNTAX_ERR The specified selector string is invalid. ...
Element: paste event - Web APIs
border: 1px solid gray; margin: .5rem; padding: .5rem; height: 1rem; background-color: #e9eef1; } JS const target = document.querySelector('div.target'); target.addEventListener('paste', (event) => { let paste = (event.clipboardData || window.clipboardData).getData('text'); paste = paste.toUpperCase(); const selection = window.getSelection(); if (!selection.
rangeCount) return false; selection.deleteFromDocument(); selection.get
RangeAt(0).insertNode(document.createTextNode(paste)); event.preventDefault(); }); Result Specifications Specification Status Clipboard API and events Working Draft ...
Using Fetch - Web APIs
e instances are returned when fetch() promises are resolved. The most common response properties you'll use are: Response.status -- An integer (default value 200) containing the response status code. Response.statusText -- A string (default value "OK"), which corresponds to the HTTP status code message. Response.ok -- seen in use above, this is a shorthand for checking that status is in the
range 200-299 inclusive. This returns a Boolean. They can also be created programmatically via JavaScript, but this is only really useful in ServiceWorkers, when you are providing a custom response to a received request using a respondWith() method: const myBody = new Blob(); addEventListener('fetch', function(event) { // ServiceWorker intercepting a fetch event.respondWith( new Response(my...
File - Web APIs
operties available to it: File.prototype.size Read only Returns the size of the file in bytes. File.prototype.type Read only Returns the MIME type of the file. Instance methods The File interface doesn't define any methods, but inherits methods from the Blob interface: Blob.prototype.slice([start[, end[, contentType]]]) Returns a new Blob object containing the data in the specified
range of bytes of the source Blob. Blob.prototype.stream() Transforms the File into a ReadableStream that can be used to read the File contents. Blob.prototype.text() Transforms the File into a stream and reads it to completion. It returns a promise that resolves with a USVString (text). Blob.prototype.arrayBuffer() Transforms the File into a stream and reads it to completion. It returns a promis...
FontFace - Web APIs
s Read only Returns an enumerated value indicating the status of the font, one of "unloaded", "loading", "loaded", or "error". FontFace.stretch A CSSOMString that retrieves or sets how the font stretches. It is equivalent to the font-stretch descriptor. FontFace.style A CSSOMString that retrieves or sets the style of the font. It is equivalent to the font-style descriptor. FontFace.unicode
Range A CSSOMString that retrieves or sets the
range of unicode codepoints encompassing the font. It is equivalent to the unicode-
range descriptor. FontFace.variant A CSSOMString that retrieves or sets the variant of the font. It is equivalent to the font-variant descriptor. FontFace.weight A CSSOMString that contains the weight of the font. It is equivalent to the font-weight descriptor. Method...
FontFaceSet.check() - Web APIs
f the FontFaceSet returns whether all fonts in the given font list have been loaded and are available. Syntax bool = aFontFaceSet.check(font); bool = aFontFaceSet.check(font, text); Returns A Boolean that is true if the font list is available Parameters font: a font specification using the CSS value syntax, e.g. "italic bold 16px Roboto" text: limit the font faces to those whose Unicode
range contains at least one of the characters in text. This does not check for individual glyph coverage. Examples document.fonts.check("12px courier"); // returns true if the font courier is available at 12px document.fonts.check("12px MyFont", "ss"); // returns true if the font 'MyFont' has a ss character. Specifications Specification Status Comment CSS Font Loading Mod...
FontFaceSet.load() - Web APIs
ed. Syntax result = aFontFaceSet.load(font); result = aFontFaceSet.load(font, text); Returns A Promise of an Array of FontFace loaded. The promise is fulfilled when all the fonts are loaded; it is rejected if one of the fonts failed to load. Parameters font: a font specification using the CSS value syntax, e.g. "italic bold 16px Roboto" text: limit the font faces to those whose Unicode
range contains at least one of the characters in text. This does not check for individual glyph coverage. Examples // returns a promise that will be fulfilled or rejected according the success to load MyFont // The code in 'then' can assume the availability of that font. document.fonts.load("12px MyFont", "ss").then(...); Specifications Specification Status Comment CSS Fo...
GainNode() - Web APIs
s a change in volume. Note: You should typically call AudioContext.createGain() to create a gain node. Syntax var gainNode = new GainNode(context, options) Parameters Inherits parameters from the AudioNodeOptions dictionary. context A reference to an AudioContext. options Optional Options are as follows: gain: The amount of gain to apply. This parameter is a-rate and it's nominal
range is (-?,+?). The default is 1. Return value A new GainNode object instance. Specifications Specification Status Comment Web Audio APIThe definition of 'GainNode()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the da...
Gamepad.axes - Web APIs
The Gamepad.axes property of the Gamepad interface returns an array representing the controls with axes present on the device (e.g. analog thumb sticks).- Each entry in the array is a floating point value in the
range -1.0 - 1.0, representing the axis position from the lowest value (-1.0) to the highest value (1.0). Syntax readonly attribute double[] axes; Example function gameLoop() { if(navigator.webkitGetGamepads) { var gp = navigator.webkitGetGamepads()[0]; } else { var gp = navigator.getGamepads()[0]; } if(gp.axes[0] != 0) { b -= gp.axes[0]; } else if(gp.axes[1] != 0) { a += gp.axes[1]; } else if(gp.axes[2] != 0) { b += gp.axes[2]; } else if(gp.axes[3] != 0) { a -= gp.axes[3]; } ball.style.left = a*2 + "px"; ball.style.top =...
Gamepad.buttons - Web APIs
n-zero (typically 1.0) if the button is pressed. Each gamepadButton object has two properties: pressed and value: The pressed property is a boolean indicating whether the button is currently pressed (true) or unpressed (false). The value property is a floating point value used to enable representing analog buttons, such as the triggers on many modern gamepads. The values are normalized to the
range 0.0 - 1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. Syntax readonly attribute GamepadButton[] buttons; Example The following code is taken from my Gamepad API button demo (you can view the demo live, and find the source code on Github.) Note the code fork -- in Chrome Navigator.getGamepads needs a webkit prefix and the bu...
GamepadButton.value - Web APIs
The GamepadButton.value property of the GamepadButton interface returns a double value used to represent the current state of analog buttons on many modern gamepads, such as the triggers. The values are normalized to the
range 0.0 -- 1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. Syntax readonly attribute double value; Example var gp = navigator.getGamepads()[0]; if(gp.buttons[0].value > 0) { // respond to analog button being pressed in } Value A double. Specifications Specification Status Comment GamepadThe definition of 'GamepadButton.value' in that specification. Working Draft Initial definition ...
GamepadButton - Web APIs
tons property of the Gamepad interface. Note: This is the case in Firefox Gecko 28 and later; Chrome and earlier Firefox versions still return an array of double values when this property is accessed. Properties GamepadButton.value Read only A double value used to represent the current state of analog buttons, such as the triggers on many modern gamepads. The values are normalized to the
range 0.0 --1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. GamepadButton.pressed Read only A Boolean value indicating whether the button is currently pressed (true) or unpressed (false). Example The following code is taken from my Gamepad API button demo (you can view the demo live, and find the source code on Github.) Note the code f...
Using the Gamepad API - Web APIs
jects representing the buttons present on the device. Each GamepadButton has a pressed and a value property: The pressed property is a boolean indicating whether the button is currently pressed (true) or unpressed (false). The value property is a floating point value used to enable representing analog buttons, such as the triggers on many modern gamepads. The values are normalized to the
range 0.0..1.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed. axes: An array representing the controls with axes present on the device (e.g. analog thumb sticks). Each entry in the array is a floating point value in the
range -1.0 - 1.0, representing the axis position from the lowest value (-1.0) to the highest value (1.0). timestamp: Th...
HTMLBaseFontElement - Web APIs
of one or more font names. The document text in the default style is rendered in the first font face that the client's browser supports. If no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. HTMLBaseFontElement.size Is a DOMString representing the font size as either a numeric or relative value. Numeric values
range from 1 to 7 with 1 being the smallest and 3 the default. Relative value starts with a '+' or a '-'. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLBaseFontElement' in that specification. Obsolete No change ...
HTMLCollection - Web APIs
could only have HTML elements as their items). An HTMLCollection in the HTML DOM is live; it is automatically updated when the underlying document is changed. Properties HTMLCollection.length Read only Returns the number of items in the collection. Methods HTMLCollection.item() Returns the specific node at the given zero-based index into the list. Returns null if the index is out of
range. An alternative to accessing collection[i] (which instead returns undefined when i is out-of-bounds). This is mostly useful for non-JavaScript DOM implementations. HTMLCollection.namedItem() Returns the specific node whose ID or, as a fallback, name matches the string specified by name. Matching by name is only done as a last resort, only in HTML, and only if the referenced element supports t...
HTMLElement.dir - Web APIs
text writing directionality of an element is which direction that text goes (for support of different language systems). Arabic languages and Hebrew are typical languages using the RTL directionality. An image can have its dir property set to "rtl" in which case the HTML attributes title and alt will be formatted and defined as "rtl". When a table has its dir set to "rtl", the column order is ar
ranged from right to left. When an element has its dir set to "auto", the direction of the element is determined based on its first strong directionality character, or default to the directionality of its parent element. Browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content. Chrome and Safari provide a directionality option in th...
HTMLElement: pointerleave event - Web APIs
The pointerleave event is fired when a pointing device is moved out of the hit test boundaries of an element. For pen devices, this event is fired when the stylus leaves the hover
range detectable by the digitizer. Bubbles No Cancelable No Interface PointerEvent Event handler property onpointerleave Examples Using addEventListener(): const para = document.querySelector('p'); para.addEventListener('pointerleave', (event) => { console.log('Pointer left element'); }); Using the onpointerleave event handler property: const para = document.querySelector('p'); para.onpointerleave = (event) => { console.log('Pointer left element'); }; Specifications Specification Status Pointer Events Obsolete ...
HTMLElement: pointerout event - Web APIs
The pointerout event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not support hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover
range detectable by the digitizer. Bubbles Yes Cancelable Yes Interface PointerEvent Event handler property onpointerout Examples Using addEventListener(): const para = document.querySelector('p'); para.addEventListener('pointerout', (event) => { console.log('Pointer moved out'); }); Using the onpointerout event handler property: const para = document.querySelector('p'); para.onpointerout = (event) => { console.log('Pointer ...
HTMLFontElement.color - Web APIs
ecified in the hexadecimal #RRGGBB format. The format of the string must follow one of the following HTML microsyntaxes: Microsyntax Description Examples Valid name color string nameOfColor (case insensitive) Green green GREEN Valid hex color string in rgb format: #RRGGBB #008000 RGB using decimal values rgb(x,x,x) (x in 0-255
range) rgb(0,128,0) Syntax colorString = fontObj.color; fontObj.color = colorString; Examples // Assumes there is <font id="f"> element in the HTML var f = document.getElementById("f"); f.color = "green"; Specifications The <font> tag is not supported in HTML5 and as a result neither is <font>.color. ...
HTMLImageElement.lowSrc - Web APIs
ed at 15%. Reduced color depth; a primary image in 32-bit color might have an alternate image in 8-bit color. Important: The lowSrc property is obsolete and should not be used. Instead, you should use an image format which loads progressively (such as progressive JPEG). Or simply make sure your images are all well-optimized and balanced for appearance versus size. Usage notes lowSrc is a st
range case. It was never technically part of the HTML specification (it was a Mozilla extension to HTML); however, HTML 5 does list it among the obsolete attributes. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobile...
HTMLInputElement.select() - Web APIs
ectText()">Select text</button> JavaScript function selectText() { const input = document.getElementById('text-box'); input.focus(); input.select(); } Result Notes Calling element.select() will not necessarily focus the input, so it is often used with HTMLElement.focus(). In browsers where it is not supported, it is possible to replace it with a call to HTMLInputElement.setSelection
Range() with parameters 0 and the input's value length: <input onClick="this.select();" value="Sample Text" /> <!-- equivalent to --> <input onClick="this.setSelection
Range(0, this.value.length);" value="Sample Text" /> Specifications Specification Status Comment HTML Living StandardThe definition of 'select' in that specification. Living Standard ...
HTMLMediaElement.buffered - Web APIs
The HTMLMediaElement.buffered read-only property returns a new Time
Ranges object that indicates the
ranges of the media source that the browser has buffered (if any) at the moment the buffered property is accessed. Note: This feature is not available in Web Workers. Syntax var time
Range = audioObject.buffered Value A Time
Ranges object. This object is normalized, which means that
ranges are ordered, don't overlap, aren't empty, and don't touch (adjacent
ranges are folded into one bigger
range). Example var obj = document.createElement('video'); console.log(obj.buffered); // Time
Ranges { length: 0 } Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.buffered' in that specification. Living Standard No change ...
HTMLMediaElement.playbackRate - Web APIs
the rate at which the media is being played back. This is used to implement user controls for fast forward, slow motion, and so forth. The normal playback rate is multiplied by this value to obtain the current rate, so a value of 1.0 indicates normal speed. If playbackRate is negative, the media is not played backwards. The audio is muted when the fast forward or slow motion is outside a useful
range (for example, Gecko mutes the sound outside the
range 0.25 to 5.0). The pitch of the audio is corrected by default and is the same for every speed. Some browsers implement the non-standard HTMLMediaElement.preservesPitch property to control this. Syntax // video video.playbackRate = 1.5; // audio audio.playbackRate = 1.0; Value A double. 1.0 is "normal speed," values lower than 1.0 make t...
HTMLObjectElement.setCustomValidity - Web APIs
is missing, too low or too high. Additionally you must call the reportValidity method on the same element or nothing will happen. function validate(inputID) { var input = document.getElementById(inputID); var validityState_object = input.validity; if (validityState_object.valueMissing) { input.setCustomValidity('You gotta fill this out, yo!'); input.reportValidity(); } else if (input.
rangeUnderflow) { input.setCustomValidity('We need a higher number!'); input.reportValidity(); } else if (input.
rangeOverflow) { input.setCustomValidity('Thats too high!'); input.reportValidity(); } else { input.setCustomValidity(''); input.reportValidity(); } } It's vital to set the message to an empty string if there are no errors. As long as the error message is not null, the fo...
HTMLTableRowElement.rowIndex - Web APIs
to <tbody>, from <tbody> to <tfoot>. Syntax var index = HTMLTableRowElement.rowIndex Value Returns the index of the row, or -1 if the row is not part of a table. Example This example uses JavaScript to label all the row numbers in a table. ...
The HTML DOM API - Web APIs
ient CanvasPattern CanvasRenderingContext2D ImageBitmap ImageBitmapRenderingContext ImageData OffscreenCanvas OffscreenCanvasRenderingContext2D Path2D TextMetrics Media interfaces The media interfaces provide HTML access to the contents of the media elements: <audio> and <video>. AudioTrack AudioTrackList MediaError TextTrack TextTrackCue TextTrackCueList TextTrackList Time
Ranges TrackEvent VideoTrack VideoTrackList Drag and drop interfaces These interfaces are used by the HTML_Drag_and_Drop_API to represent individual draggable (or dragged) items, groups of dragged or draggable items, and to handle the drag and drop process. DataTransfer DataTransferItem DataTransferItemList DragEvent Page history interfaces The History API interfaces let you access in...
Recommended Drag Types - Web APIs
e of the innerHTML property of an element. XML content may use the text/xml type, but ensure that the data is well-formed XML. You may also include a plain text representation of the HTML or XML data using the text/plain type. The data should be just the text without any of the source tags or attributes. For instance: var dt = event.dataTransfer; dt.setData("text/html", "Hello there, <strong>st
ranger</strong>"); dt.setData("text/plain", "Hello there, st
ranger"); Dragging Files A local file is dragged using the application/x-moz-file type with a data value that is an nsIFile object. Non-privileged web pages canot retrieve or modify data of this type. Because a file is not a string, you must use the mozSetDataAt() method to assign the data. Similarly, when retrieving the data, you must use...
Ajax navigation example - Web APIs
406: "Not Acceptable", 407: "Proxy Authentication Required", 408: "Request Timeout", 409: "Conflict", 410: "Gone", 411: "Length Required", 412: "Precondition Failed", 413: "Request Entity Too Large", 414: "Request-URI Too Long", 415: "Unsupported Media Type", 416: "Requested
Range Not Satisfiable", 417: "Expectation Failed", 422: "Unprocessable Entity", 423: "Locked", 424: "Failed Dependency", 425: "Unassigned", 426: "Upgrade Required", 427: "Unassigned", 428: "Precondition Required", 429: "Too Many Requests", 430: "Unassigned", 431: "Request ...
IDBCursor.key - Web APIs
The cursor's key can be any data type. Note: This feature is available in Web Workers. Syntax var key = cursor.key; Value A value of any type. Example In this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. Within each iteration we log the key of the cursor to the console, something like this (its the album title in each case, which is our key). ...
IDBCursor.primaryKey - Web APIs
The cursor's primary key can be any data type. Note: This feature is available in Web Workers. Syntax var value = cursor.primaryKey; Value A value of any data type. Example In this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. ...
IDBCursorWithValue - Web APIs
The IDBCursorWithValue interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. The cursor has a source that indicates which index or object store it is iterating over. It has a position within the
range, and moves in a direction that is increasing or decreasing in the order of record keys. The cursor enables an application to asynchronously process all the records in the cursor's
range. You can have an unlimited number of cursors at the same time. You always get the same IDBCursorWithValue object representing a given cursor. Operations are performed on the underlying index or object store. Note: This feature is available in Web Workers. <div id="inter...
IDBIndex.count() - Web APIs
The count() method of the IDBIndex interface returns an IDBRequest object, and in a separate thread, returns the number of records within a key
range. Note: This feature is available in Web Workers. Syntax var request = myIndex.count(); var request = myIndex.count(key); Parameters key Optional The key or key
range that identifies the record to be counted. Return value A IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description TransactionInactiveError This IDBIndex's transaction is inactive. DataError The key or key
range provided contains an invalid key. InvalidStateError The IDBIndex has been ...
IDBIndex.getAll() - Web APIs
ested in looking at each of the keys, for instance, it is more efficient to use a cursor. If you are trying to get an array of all the objects in an object store, though, you should use getAll(). Syntax var getAllKeysRequest = IDBIndex.getAll(); var getAllKeysRequest = IDBIndex.getAll(query); var getAllKeysRequest = IDBIndex.getAll(query, count); Parameters query Optional A key or an IDBKey
Range identifying the records to retrieve. If this value is null or missing, the browser will use an unbound key
range. count Optional The number records to return. If this value exceeds the number of records in the query, the browser will only retrieve the first item. If it is lower than 0 or greater than 232-1 a TypeError exception will be thrown. Return value An IDBRequest object on which subse...
IDBIndex.getAllKeys() - Web APIs
The getAllKeys() method of the IDBIndex interface instantly retrieves the primary keys of all objects inside the index, setting them as the result of the request object. Syntax var allKeysRequest = IDBIndex.getAllKeys(); var allKeysRequest = IDBIndex.getAllKeys(query); var allKeysRequest = IDBIndex.getAllKeys(query, count); Parameters query Optional A key or an IDBKey
Range identifying the keys to retrieve. If this value is null or missing, the browser will use an unbound key
range. count Optional The number records to return. If this value exceeds the number of records in the query, the browser will only retrieve the first item. If it is lower than 0 or greater than 232-1 a TypeError exception will be thrown. Return value An IDBRequest object on which subsequent events related to...
IDBObjectStore.clear() - Web APIs
ately returns an IDBRequest object, and clears this object store in a separate thread. This is for deleting all the current data out of an object store. Clearing an object store consists of removing all records from the object store and removing all records in indexes that reference the object store. To remove only some of the records in a store, use IDBObjectStore.delete passing a key or IDBKey
Range. Note: This feature is available in Web Workers. Syntax var request = objectStore.clear(); Returns An IDBRequest object on which subsequent events related to this operation are fired. Exceptions This method may raise a DOMException of one of the following types: Exception Description ReadOnlyError The transaction associated with this operation is in read-only m...
IDBObjectStore.createIndex() - Web APIs
w duplicate values for a single key. multiEntry If true, the index will add an entry in the index for each array element when the keyPath resolves to an Array. If false, it will add one single entry containing the Array. locale Currently Firefox-only (43+), this allows you to specify a locale for the index. Any sorting operations performed on the data via key
ranges will then obey sorting rules of that locale (see locale-aware sorting.) You can specify its value in one of three ways: string: A string containing a specific locale code, e.g. en-US, or pl. auto: The platform default locale will be used (may be changed by user agent settings.) null or undefined: If no locale is specified, normal JavaScript sorting will be used -- not lo...
IDBObjectStore - Web APIs
his is for adding new records to an object store. IDBObjectStore.clear() Creates and immediately returns an IDBRequest object, and clears this object store in a separate thread. This is for deleting all current records out of an object store. IDBObjectStore.count() Returns an IDBRequest object, and, in a separate thread, returns the total number of records that match the provided key or IDBKey
Range. If no arguments are provided, it returns the total number of records in the store. IDBObjectStore.createIndex() Creates a new index during a version upgrade, returning a new IDBIndex object in the connected database. IDBObjectStore.delete() returns an IDBRequest object, and, in a separate thread, deletes the store object selected by the specified key. This is for deleting individual records ...
IIRFilterNode() - Web APIs
ers from the AudioNodeOptions dictionary. context A reference to an AudioContext. options Options are as follows: feedforward: A sequence of feedforward coefficients. feedback: A sequence of feedback coefficients. Unlike other nodes in the Web Audio API, the options passed into the IIR filter upon creation are not optional. The filter needs these values to work and with the vast
range of filters available, there is no default. Return value A new IIRFilterNode object instance. Examples let feedForward = [0.00020298, 0.0004059599, 0.00020298]; let feedBackward = [1.0126964558, -1.9991880801, 0.9873035442]; const AudioContext = window.AudioContext || window.webkitAudioContext; const audioCtx = new AudioContext(); const iirFilter = new IIRFilterNode(audioCtx, { feedforward: ...
ImageCapture - Web APIs
n EventTarget, so it includes the methods defined by that interface as well as the ones listed below. ImageCapture.takePhoto() Takes a single exposure using the video capture device sourcing a MediaStreamTrack and returns a Promise that resolves with a Blob containing the data. ImageCapture.getPhotoCapabilities() Returns a Promise that resolves with a PhotoCapabilities object containing the
ranges of available configuration options. ImageCapture.getPhotoSettings() Returns a Promise that resolves with a PhotoSettings object containing the current photo configuration settings. ImageCapture.grabFrame() Takes a snapshot of the live video in a MediaStreamTrack, returning an ImageBitmap, if successful. Example The following code is taken from Chrome's Grab Frame - Take Photo Sample. Sinc...
IndexedDB API - Web APIs
database, looked up via primary key. IDBIndex Also allows access to a subset of data in an IndexedDB database, but uses an index to retrieve the record(s) rather than the primary key. This is sometimes faster than using IDBObjectStore. IDBCursor Iterates over object stores and indexes. IDBCursorWithValue Iterates over object stores and indexes and returns the cursor's current value. IDBKey
Range Defines a key
range that can be used to retrieve data from a database in a certain
range. IDBLocaleAwareKey
Range Defines a key
range that can be used to retrieve data from a database in a certain
range, sorted according to the rules of the locale specified for a certain index (see createIndex()'s optionalParameters.). This interface isn't part of the 2.0 specification. Custom event interfa...
InputEvent() - Web APIs
such as when deleting characters, for example). dataTransfer: (Optional) A DataTransfer object containing information about richtext or plaintext data being added to or removed from editible content. isComposing: (Optional) A boolean indicating that the event is part of a composition session, meaning it is after a compositionstart event but before a compositionend event. The default is false.
ranges: (Optional) An array of static
ranges that will be affected by a change to the DOM if the input event is not canceled. The InputEventInit dictionary also accepts fields from UIEventInit and from EventInit dictionaries. ...
InputEvent - Web APIs
pe of change for editable content such as, for example, inserting, deleting, or formatting text. See the property page for a complete list of input types. InputEvent.isComposingRead only Returns a Boolean value indicating if the event is fired after compositionstart and before compositionend. Methods This interface inherits methods from its parents, UIEvent and Event. InputEvent.getTarget
Ranges() Returns an array of static
ranges that will be affected by a change to the DOM if the input event is not canceled. Specifications Specification Status Comment Input Events Level 2The definition of 'InputEvent' in that specification. Working Draft UI EventsThe definition of 'InputEvent' in that specification. Working Draft Initial definition...
KeyboardEvent.code - Web APIs
s if the user is using an AZERTY keyboard. HTML <p>Use the WASD (ZQSD on AZERTY) keys to move and steer.</p> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="world"> <polygon id="spaceship" points="15,0 0,30 30,30"/> </svg> <script>refresh();</script> CSS .world { margin: 0px; padding: 0px; background-color: black; width: 400px; height: 400px; } #spaceship { fill: o
range; stroke: red; stroke-width: 2px; } JavaScript The first section of the JavaScript code establishes some variables we'll be using. shipSize contains the size of the ship the player is moving around, for convenience. position is used to track the position of the ship within the play field. moveRate and turnRate are the number of pixels forward and backward each keystroke moves the ship and ho...
KeyframeEffect.setKeyframes() - Web APIs
pacity: 0, color: "#fff" }, { // to opacity: 1, color: "#000" } ], 2000); Offsets for each keyframe can be specified by providing an offset value. element.animate([ { opacity: 1 }, { opacity: 0.1, offset: 0.7 }, { opacity: 0 } ], 2000); Note: offset values, if provided, must be between 0.0 and 1.0 (inclusive) and ar
ranged in ascending order. It is not necessary to specify an offset for every keyframe. Keyframes without a specified offset will be evenly spaced between adjacent keyframes. The easing to apply between keyframes can be specified by providing an easing value as illustrated below. element.animate([ { opacity: 1, easing: 'ease-out' }, { opacity: 0.1, easing: 'ease-in' }, ...
MediaSessionActionDetails.seekOffset - Web APIs
by. Syntax let mediaSessionActionDetails = { seekOffset: deltaTimeInSeconds }; let deltaTime = mediaSessionActionDetails.seekOffset; Value A floating-point value indicating the time delta in seconds by which to move the playback position relative to its current timestamp. If the offset isn't specified, the user agent will choose an appropriate offset automatically. This is typically in the
range of five to ten seconds. Specifications Specification Status Comment Media Session StandardThe definition of 'MediaSessionActionDetails.seekOffset' in that specification. Draft Initial definition. ...
MediaSource - Web APIs
the sourceclose event. MediaSource.onsourceended The event handler for the sourceended event. MediaSource.onsourceopen The event handler for the sourceopen event. Methods Inherits methods from its parent interface, EventTarget. MediaSource.addSourceBuffer() Creates a new SourceBuffer of the given MIME type and adds it to the MediaSource.sourceBuffers list. MediaSource.clearLiveSeekable
Range() Clears a seekable
range previously set with a call to setLiveSeekable
Range(). MediaSource.endOfStream() Signals the end of the stream. MediaSource.removeSourceBuffer() Removes the given SourceBuffer from the MediaSource.sourceBuffers list. MediaSource.setLiveSeekable
Range() Sets the
range that the user can seek to in the media element. Static methods MediaSource.isTypeSupported() R...
MediaStreamConstraints.audio - Web APIs
, it simply indicates whether or not an audio track should be included in the returned stream; if it's true, an audio track is included; if no audio source is available or if permission is not given to use the audio source, the call to getUserMedia() will fail. If false, no audio track is included. MediaTrackConstraints A constraints dictionary detailing the preferable and/or required values or
ranges of values for the track's constrainable properties. If you specify constraints, an audio track meeting the constraints is required. Examples For browsers with Feature Policy enabled, the samples below need the microphone feature enabled. See Security in MediaDevices.getUserMedia() for details and examples on how to configure this. Using a Boolean value In this example, we provide a simple v...
MediaStreamConstraints.video - Web APIs
ed, it simply indicates whether or not a video track should be included in the returned stream; if it's true, a video track is included; if no video source is available or if permission is not given to use the video source, the call to getUserMedia() will fail. If false, no video track is included. MediaTrackConstraints A constraints dictionary detailing the preferable and/or required values or
ranges of values for the track's constrainable properties. If you specify constraints, a video track meeting these constraints is required. Examples Using a Boolean value In this example, we provide a simple value of true for the video property. This tells getUserMedia() that we require a video track, but we don't care about any specifics beyond that. HTML content <p>Click the start button below...
MediaStreamTrack.applyConstraints() - Web APIs
The applyConstraints() method of the MediaStreamTrack interface applies a set of constraints to the track; these constraints let the Web site or app establish ideal values and acceptable
ranges of values for the constrainable properties of the track, such as frame rate, dimensions, echo cancelation, and so forth. Constraints can be used to ensure that the media meets certain guidelines you prefer. For example, you may prefer high-density video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. Constraints can also specify ideal and/or acceptable sizes or
ranges of sizes. See Applying constraints in Capabilities, constraints, and settings for more information on how to apply your preferred constraints. Syntax const appliedPromise = ...
MediaStreamTrack.getCapabilities() - Web APIs
The getCapabilities() method of the MediaStreamTrack interface returns a MediaTrackCapabilities object which specifies the values or
range of values which each constrainable property, based upon the platform and user agent. Once you know what the browser's capabilities are, your script can use applyConstraints() to ask for the track to be configured to match ideal or acceptable settings. See Capabilities, constraints, and settings for details on how to work with constrainable properties. Syntax const capabilities = track.getCapabilities() Return value A MediaTrackCapabilities object which specifies the value or
range of values which are supported for each of the user agent's supported constrainable properties. Specifications Specification Status Comment Media Cap...
MediaStreamTrack.getConstraints() - Web APIs
The getConstraints() method of the MediaStreamTrack interface returns a MediaTrackConstraints object containing the set of constraints most recently established for the track using a prior call to applyConstraints(). These constraints indicate values and
ranges of values that the Web site or application has specified are required or acceptable for the included constrainable properties. Constraints can be used to ensure that the media meets certain guidelines you prefer. For example, you may prefer high definition video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. Constraints can also specify ideal and/or acceptable sizes or
ranges of sizes. See Capabilities, constraints, and settings for details on how to work with constrainabl...
MediaStreamTrack - Web APIs
can be switched on or off using the enabled attribute. "ended" which indicates that the input is not giving any more data and will never provide new data. MediaStreamTrack.remote Read only Returns a Boolean with a value of true if the track is sourced by a RTCPeerConnection, false otherwise. Methods MediaStreamTrack.applyConstraints() Lets the application specify the ideal and/or
ranges of acceptable values for any number of the available constrainable properties of the MediaStreamTrack. MediaStreamTrack.clone() Returns a duplicate of the MediaStreamTrack. MediaStreamTrack.getCapabilities() Returns the a list of constrainable properties available for the MediaStreamTrack. MediaStreamTrack.getConstraints() Returns a MediaTrackConstraints object containing the currently set...
Recording a media element - Web APIs
d. Lines 5-9 When the Promise returned by getUserMedia() is resolved, the preview <video> element's srcObject property is set to be the input stream, which causes the video being captured by the user's camera to be displayed in the preview box. Since the <video> element is muted, the audio won't play. The "Download" button's link is then set to refer to the stream as well. Then, in line 8, we ar
range for preview.captureStream() to call preview.mozCaptureStream() so that our code will work on Firefox, on which the MediaRecorder.captureStream() method is prefixed. Then a new Promise which resolves when the preview video starts to play is created and returned. Line 10 When the preview video begins to play, we know there's media to record, so we respond by calling the startRecording() function ...
MediaTrackControls.volume - Web APIs
sible to this number given the capabilities of the hardware and the other constraints specified. Otherwise, the value of this ConstrainDouble will guide the user agent in its efforts to provide an exact match to the required volume (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. Any constraint set which only permits values outside the
range 0.0 to 1.0 cannot be satisfied and will result in failure. Example See Example: Constraint exerciser in Capabilities, constraints, and settings for an example. ...
Using the Media Capabilities API - Web APIs
oothly. In short, this API replaces--and improves upon--the MediaSource method isTypeSupported() or the HTMLMediaElement method canPlayType(). More and more finely-detailed information about the display's properties, so that informed decisions can be made when choosing the best format to play on the user's device. For example, you can use the API to ensure that you don't try to play High Dynamic
Range (HDR) content on a Standard Dynamic
Range (SDR) screen. Support for getting real-time feedback about the playback of media, so your code can make informed decisions about adapting the stream's quality or other settings to manage the user's perceived media performance and quality. One feature of this is the ability to detect when the device switches GPUs, so you can make appropriate adjustments b...
Media Source API - Web APIs
efaultList A simple container list for multiple TrackDefault objects. Extensions to other interfaces URL.createObjectURL() Creates an object URL pointing to a MediaSource object that can then be specified as the src value of an HTML media element to play a media stream. HTMLMediaElement.seekable When a MediaSource object is played by an HTML media element, this property will return a Time
Ranges object that contains the time
ranges that the user is able to seek to. HTMLVideoElement.getVideoPlaybackQuality() Returns a VideoPlaybackQuality object for the currently played video. AudioTrack.sourceBuffer, VideoTrack.sourceBuffer, TextTrack.sourceBuffer Returns the SourceBuffer that created the track in question. Specifications Specification Status Comment Media...
MerchantValidationEvent() - Web APIs
ayment handler specific verification information used to validate the merchant. This is an empty string by default. Return value A newly-created MerchantValidationEvent providing the information that needs to be delivered to the client-side code to present to the user agent by calling complete(). Exceptions TypeError The string specified as validationURL could not be parsed as a URL.
RangeError The specified methodName does not correspond to a known and supported merchant or is not a well-formed standard payment method identifier. Specifications Specification Status Comment Payment Request APIThe definition of 'MerchantValidationEvent()' in that specification. Candidate Recommendation Initial definition. ...
MouseEvent - Web APIs
The Y coordinate of the mouse pointer in global (screen) coordinates. MouseEvent.shiftKey Read only Returns true if the shift key was down when the mouse event was fired. MouseEvent.which Read only The button being pressed when the mouse event was fired. MouseEvent.mozPressure Read only The amount of pressure applied to a touch or tablet device when generating the event; this value
ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). Instead of using this deprecated (and non-standard) property, you should instead use PointerEvent and look at its pressure property. MouseEvent.mozInputSource Read only The type of device that generated the event (one of the MOZ_SOURCE_* constants listed below). This lets you, for example, determine whether a mouse event was generat...
NodeIterator - Web APIs
DOMThe definition of 'NodeIterator' in that specification. Living Standard Added the referenceNode and pointerBeforeReferenceNode properties. Removed the expandEntityReferences property. The method detach() has been changed to be a no-op. The methods previousNode() and nextNode() don't raise an exception any more. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of 'NodeIterator' in that specification. Obsolete Initial definition. ...
NodeList.item() - Web APIs
Syntax nodeItem = nodeList.item(index) nodeList is a NodeList. This is usually obtained from another DOM property or method, such as childNodes. index is the index of the node to be fetched. The index is zero-based. nodeItem is the indexth node in the nodeList returned by the item method. ...
OfflineAudioContext.OfflineAudioContext() - Web APIs
for the audio context, in sample-frames, where one sample-frame is a unit that can contain a single sample of audio data for every channel in the audio data. For example, a 5-second buffer with a sampleRate of 48000Hz would have a length of 5 * 48000 = 240000 sample-frames. sampleRate The sample-rate of the linear audio data in sample-frames per second. All user agents are required to support a
range of 22050Hz to 96000Hz, and may support a wider
range than that. The most commonly-used rate is 44100Hz, which is the sample rate used by CD audio. It is important to note that, whereas you can create a new AudioContext using the new AudioContext() constructor with no arguments, the OfflineAudioContext() constructor requires three arguments, since it needs to create an AudioBuffer. This works in...
OscillatorNode.setPeriodicWave() - Web APIs
osc.setPeriodicWave(wave); osc.connect(ac.destination); osc.start(); osc.stop(2); This works because a sound that contains only a fundamental tone is by definition a sine wave. Here, we create a PeriodicWave with two values. The first value is the DC offset, which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0]
range. The second and subsequent values are sine and cosine components. You can think of it as the result of a Fourier transform, where you get frequency domain values from time domain value. Here, with createPeriodicWave(), you specify the frequencies, and the browser performs a an inverse Fourier transform to get a time domain buffer for the frequency of the oscillator. Here, we only set one compone...
PannerNode.PannerNode() - Web APIs
erNode to have. The default is 1, and negative values are not allowed. coneInnerAngle: The PannerNode.coneInnerAngle you want the PannerNode to have (the default is 360.) coneOuterAngle: The PannerNode.coneOuterAngle you want the PannerNode to have (the default is 360.) coneOuterGain: The PannerNode.coneOuterGain you want the PannerNode to have. The default is 0, and its value can be in the
range 0-1. Return value A new PannerNode object instance. Exceptions
RangeError The refDistance, maxDistance, or rolloffFactor properties have been given a value that is outside the accepted
range. InvalidStateError The coneOuterGain property has been given a value outside the accepted
range (0-1). Example var ctx = new AudioContext(); var options = { positionX : 1, maxDistance: 5...
PannerNode.coneInnerAngle - Web APIs
his utility converts amount of rotation around the Y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yRotationToVector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (Math.PI / 180); // using cosine and sine here ensures the output values are always normalised // i.e. ...
PannerNode.coneOuterAngle - Web APIs
his utility converts amount of rotation around the Y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yRotationToVector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (Math.PI / 180); // using cosine and sine here ensures the output values are always normalised // i.e. ...
PannerNode.maxDistance - Web APIs
the audio source and the listener, after which the volume is not reduced any further. This value is used only by the linear distance model. The maxDistance property's default value is 10000. Syntax var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.maxDistance = 10000; Value A double. The default is 10000, and non-positive values are not allowed. Exceptions
RangeError The property has been given a value that is outside the accepted
range. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the position in 3D space that your audio listener and panner (source) occupy initially, and then update the position of one ...
PannerNode.orientationX - Web APIs
his utility converts amount of rotation around the Y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yRotationToVector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (Math.PI / 180); // using cosine and sine here ensures the output values are always normalised // i.e. ...
PannerNode.orientationY - Web APIs
his utility converts amount of rotation around the Y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yRotationToVector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (Math.PI / 180); // using cosine and sine here ensures the output values are always normalised // i.e. ...
PannerNode.orientationZ - Web APIs
his utility converts amount of rotation around the Y axis // (i.e. rotation in the 'horizontal plane') to an orientation vector const yRotationToVector = degrees => { // convert degrees to radians and offset the angle so 0 points towards the listener const radians = (degrees - 90) * (Math.PI / 180); // using cosine and sine here ensures the output values are always normalised // i.e. ...
PannerNode.refDistance - Web APIs
g volume as the audio source moves further from the listener - i.e. the distance at which the volume reduction starts taking effect. This value is used by all distance models. The refDistance property's default value is 1. Syntax var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.refDistance = 1; Value A non-negative number. If the value is set to less than 0, a
RangeError is thrown. Exceptions
RangeError The property has been given a value that is outside the accepted
range. Example This example demonstrates how different values of refDistance affect how the volume of a sound decays as it moves away from the listener. Unlike rolloffFactor, changing this value also delays the volume decay until the sound moves past the reference point. const context =...
PannerNode.rolloffFactor - Web APIs
The rolloffFactor property of the PannerNode interface is a double value describing how quickly the volume is reduced as the source moves away from the listener. This value is used by all distance models.The rolloffFactor property's default value is 1. Syntax var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.rolloffFactor = 1; Value A number whose
range depends on the distanceModel of the panner as follows (negative values are not allowed): "linear" The
range is 0 to 1. "inverse" The
range is 0 to Infinity. "exponential" The
range is 0 to Infinity. Exceptions
RangeError The property has been given a value that is outside the accepted
range. Example This example demonstrates how different rolloffFactor values affect how the volume...
ParentNode.replaceChildren() - Web APIs
ansfer nodes between parents, without having to resort to verbose looping code. For example, say we have a simple application allowing you to choose what food you want for your party. ...
PeriodicWave - Web APIs
; osc.setPeriodicWave(wave); osc.connect(ac.destination); osc.start(); osc.stop(2); This works because a sound that contains only a fundamental tone is by definition a sine wave Here, we create a PeriodicWave with two values. The first value is the DC offset, which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0]
range. The second and subsequent values are sine and cosine components. You can think of it as the result of a Fourier transform, where you get frequency domain values from time domain value. Here, with createPeriodicWave(), you specify the frequencies, and the browser performs an inverse Fourier transform to get a time domain buffer for the frequency of the oscillator. Here, we only set one component...
PhotoCapabilities.imageHeight - Web APIs
Specifications Specification Status Comment MediaStream Image CaptureThe definition of 'imageHeight' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
imageWidth - Web APIs
Specifications Specification Status Comment MediaStream Image CaptureThe definition of 'imageWidth' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
PointerEvent.pressure - Web APIs
For hardware that does not support pressure, such as a mouse, the value is 0.5 when the pointer is active buttons state and 0 otherwise. ...
PointerEvent.tangentialPressure - Web APIs
The tangentialPressure read-only property of the PointerEvent interface represents the normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress). Syntax var tanPressure = pointerEvent.tangentialPressure; Return value A float representing the normalized tangential pressure of the pointer input in the
range -1 to 1, inclusive, where 0 is the neutral position of the control. Note that some hardware may only support positive values in the
range 0 to 1. For hardware that does not support tangential pressure, the value will be 0. Example In this snippet, when a pointerdown event is fired, different functions are called depending on the value of the event's tangentialPressure property. someElement.addEventListener('pointerdown', function(event) { ...
PointerEvent.tiltX - Web APIs
e PointerEvent interface is the angle (in degrees) between the Y-Z plane of the pointer and the screen. This property is typically only useful for a pen/stylus pointer type. For an illustration of this property see Figure 2 in the specification. Syntax var tiltX = pointerEvent.tiltX; Return value tiltX The angle in degrees between the Y-Z plane of the pointer (stylus) and the screen. The
range of values is -90 to 90, inclusive, where a positive value is a tilt to the right. For devices that do not support this property, the value is 0. Example This example illustrates simple accessing of the tiltX and tiltY properties. someElement.addEventListener("pointerdown", function(event) { process_tilt(event.tiltX, event.tiltY); }, false); Specifications Specification Status...
PointerEvent.tiltY - Web APIs
PointerEvent interface is the angle (in degrees) between the X-Z plane of the pointer and the screen. This property is typically only useful for a pen/stylus pointer type. For an illustration of this property, see Figure 3 in the specification. Syntax var tiltY = pointerEvent.tiltY; Return value tiltY The angle in degrees between the X-Z plane of the pointer (stylus) and the screen. The
range of values is -90 to 90, inclusive, where a positive value is a tilt towards the user. For devices that do not support this property, the value is 0. Example This example illustrates simple accessing of the tiltX and tiltY properties. someElement.addEventListener("pointerdown", function(event) { process_tilt(event.tiltX, event.tiltY); }, false); Specifications Specification Sta...
RTCIceCandidateStats.priority - Web APIs
Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCIceCandidateStats.port' in that specification. Candidate Recommendation Initial specification. ...
RTCPeerConnection: icecandidateerror event - Web APIs
error in some amount of detail. Bubbles No Cancelable No Interface RTCPeerConnectionIceErrorEvent Event handler property RTCPeerConnection.onicecandidateerror Description The error object's errorCode property is one of the numeric STUN error codes. There is one additional, WebRTC-specific, error which lies outside the valid STUN error code
range: 701. Error 701 indicates that none of the ICE candidates were able to successfully make contact with the STUN or TURN server. The 701 error is fired only once per server URL from the list of available STUN or TURN servers provided when creating the RTCPeerConnection. These errors occur only when the connection's ICE gathering state is gathering. Example The following example establishes a han...
RTCPeerConnection.onicecandidateerror - Web APIs
; Value This should be set to a function you provide which is passed a single parameter: an RTCPeerConnectionIceErrorEvent object describing the icecandidateerror event. The event offers properties describing the error to help you handle it appropriately. Example pc.onicecandidateerror = function(event) { if (event.errorCode >= 300 && event.errorCode <= 699) { // STUN errors are in the
range 300-699. See RFC 5389, section 15.6 // for a list of codes. TURN adds a few more error codes; see // RFC 5766, section 15 for details. } else if (event.errorCode >= 700 && event.errorCode <= 799) { // Server could not be reached; a specific error number is // provided but these are not yet specified. } } Specifications Specification Status Comment ...
RTCPeerConnectionIceErrorEvent - Web APIs
o communicate with the STUN or TURN server being used to negotiate the connection, or null if the local IP address has not yet been exposed as part of a local ICE candidate. errorCode Read only An unsigned integer value stating the numeric STUN error code returned by the STUN or TURN server. If no host candidate can reach the server, this property is set to the number 701, which is outside the
range of valid STUN error codes. The 701 error is fired only once per server URL, and only while the is icegatheringstate is gathering. errorText Read only A DOMString containing the STUN reason text returned by the STUN or TURN server. If communication with the STUN or TURN server couldn't be established at all, this string will be a browser-specific string explaining the error. port Read only A...
RTCRtpCodecParameters - Web APIs
e used to identify this codec. mimeType Optional The codec's MIME media type and subtype specified as a DOMString of the form "type/subtype". IANA maintains a registry of valid MIME types. clockRate Optional An unsigned long integer value specifying the codec's clock rate in hertz (Hz). The clock rate is the rate at which the codec's RTP timestamp advances. Most codecs have specific values or
ranges of values they permit; see the IANA payload format media type registry for details. channels Optional An unsigned short integer indicating the number of channels the codec should support. For example, for audio codecs, a value of 1 specifies monaural sound while 2 indicates stereo. sdpFmtpLine Optional A DOMString containing the format-specific parameters field from the "a=fmtp" line in the ...
RTCRtpContributingSource.audioLevel - Web APIs
vel will be the level value defined in [RFC6465] if the RFC 6465 header extension is present, and otherwise null. Syntax var audioLevel = RTCRtpContributingSource.audioLevel Value A double-precision floating-point number which indicates the volume level of the audio in the most recently received RTP packet from the source described by the RTCRtpContributingSource. This value, which is in the
range 0.0 to 1.0, is on a linear scale and its value is defined in dBov, or decibels (overload). This is the amplitude relative to the point at which clipping of the audio begins to occur. A value of 1.0 represents 0 dBov (maximum volume), a value of 0.0 represents silence, and a value of 0.5 represents approximately 6 dB SPL (decibels of sound pressure level) change in the sound pressure level from 0 ...
RTCRtpEncodingParameters.scaleResolutionDownBy - Web APIs
s that the video will be encoded at its original size. A value of 2.0 would reduce the size of the video by a factor of 2 both horizontally and vertically, resulting in a video 25% the original size. A value less than 1.0 would cause the video to get larger rather than smaller, which is not the intent of this property. Therefore, specifying a value less than 1.0 is not permitted and will cause a
RangeError exception to be thrown by RTCPeerConnection.addTransceiver() or RTCRtpSender.setParameters(). Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpEncodingParameters.scaleResolutionDownBy' in that specification. Candidate Recommendation Initial definition. ...
RTCRtpSender.setParameters() - Web APIs
as changed from the current list's order. An attempt has been made to alter a property that cannot be changed after the sender is first created. InvalidStateError The transceiver of which the RTCRtpSender is a part is not running, or has no parameters to set. OperationError Any error condition which occurs that isn't covered by one of the other error codes results in an OperationError.
RangeError The value specified for scaleResolutionDownBy is less than 1.0, which would result in scaling up rather than down, which is not allowed; or one or more of the specified encodings' maxFramerate values is less than 0.0. In addition, if a WebRTC error occurs while configuring or accessing the media, an RTCError is thrown with its errorDetail set to hardware-encoder-error. Specifications ...
ReadableStream.ReadableStream() - Web APIs
ates the size to use for each chunk, in bytes. Note: You could define your own custom queuingStrategy, or use an instance of ByteLengthQueuingStrategy or CountQueuingStrategy for this object value. If no queuingStrategy is supplied, the default used is the same as a CountQueuingStrategy with a high water mark of 1. Return value An instance of the ReadableStream object. Exceptions
RangeError The supplied type value is neither "bytes" nor undefined. Examples In the following simple example, a custom ReadableStream is created using a constructor (see our Simple random stream example for the full code). The start() function generates a random string of text every second and enqueues it into the stream. A cancel() fuction is also provided to stop the generation if ReadableStream...
ReadableStream.getReader() - Web APIs
ted that can read readable byte streams (i.e. can handle "bring your own buffer" reading). undefined (or not specified at all -- this is the default), which results in a ReadableStreamDefaultReader being created that can read individual chunks from a stream. Return value A ReadableStreamDefaultReader or ReadableStreamBYOBReader object instance, depending on the mode value. Exceptions
RangeError The provided mode value is not "byob" or undefined. TypeError The stream you are trying to create a reader for is not a ReadableStream. Examples In the following simple example, a previously-created custom ReadableStream is read using a ReadableStreamDefaultReader created using getReader(). (see our Simple random stream example for the full code). Each chunk is read sequentially and ou...
Reporting API - Web APIs
endpoints Each unique origin you want to retrieve reports for can be given a series of endpoints, which are URLs that can receive given reports from a user agent. The Report-To HTTP header is used to specify details about the different endpoints that a user-agent has available to it for delivering reports to. You can then retrieve reports by making a request to those URLs. The endpoints are ar
ranged into groups; an endpoint group can work together to provide load balancing (each endpoint will receive a specified proportion of report traffic) and safeguarding against failure (fallback endpoints can be specified to use if the primary ones fail). Note: There is no absolute guarantee of report delivery -- a report could still fail to be collected if a serious error occurs. Reports sent to e...
ResizeObserver - Web APIs
to do with the viewport. We also provide a checkbox to turn the observer off and on. If it is turned off, the text will not change in response to the <div>'s width changing. ...
Response.ok - Web APIs
Syntax var myOK = response.ok; Value A Boolean. Example In our Fetch Response example (see Fetch Response live) we create a new Request object using the Request() constructor, passing it a JPG path. We then fetch this request using fetch(), extract a blob from the response using Body.blob, create an object URL out of it using URL.createObjectURL, and display this in an <img>. Note: at the top of the fetch() block we log the response ok value to the console. ...
Response.redirect() - Web APIs
direct it as desired. This will actually lead to a real redirect if a service worker sends it upstream. Syntax var response = Response.redirect(url, status); Parameters url The URL that the new response is to originate from. status Optional An optional status code for the response (e.g., 302.) Return value A Response object. Exceptions Exception Explanation
RangeError The specified status is not a redirect status. TypeError The specified URL is invalid. Example responseObj.redirect('https://www.example.com', 302); Specifications Specification Status Comment FetchThe definition of 'redirect()' in that specification. Living Standard ...
Response - Web APIs
returned as the result of another API operation--for example, a service worker FetchEvent.respondWith, or a simple WindowOrWorkerGlobalScope.fetch(). Constructor Response() Creates a new Response object. Properties Response.headers Read only The Headers object associated with the response. Response.ok Read only A boolean indicating whether the response was successful (status in the
range 200-299) or not. Response.redirected Read only Indicates whether or not the response is the result of a redirect (that is, its URL list has more than one entry). Response.status Read only The status code of the response. (This will be 200 for a success). Response.statusText Read only The status message corresponding to the status code. (e.g., OK for 200). Response.trailers A Promise re...
SVGSVGElement - Web APIs
hen the position and size are unitless values in the coordinate system of the parent document. (If the parent uses CSS or XSL layout, then unitless values represent pixel units for the current CSS or XSL viewport.) SVGSVGElement.pixelUnitToMillimeterX A float representing the size of the pixel unit (as defined by CSS2) along the x-axis of the viewport, which represents a unit somewhere in the
range of 70dpi to 120dpi, and, on systems that support this, might actually match the characteristics of the target medium. On systems where it is impossible to know the size of a pixel, a suitable default pixel size is provided. SVGSVGElement.pixelUnitToMillimeterY A float representing the size of a pixel unit along the y-axis of the viewport. SVGSVGElement.screenPixelToMillimeterX User interf...
SVGTransformList - Web APIs
teSVGTransform(); rotate.setRotate(10,0,0); var scale = svgroot.createSVGTransform(); scale.setScale(0.8,0.8); // apply the transformations by appending the SVGTranform objects to the SVGTransformList associated with the element tfmList.appendItem(translate); tfmList.appendItem(rotate); tfmList.appendItem(scale); } ]]> </script> <polygon fill="o
range" stroke="black" stroke-width="5" points="100,225 100,115 130,115 70,15 70,15 10,115 40,115 40,225" onclick="transformMe(evt)"/> <rect x="200" y="100" width="100" height="100" fill="yellow" stroke="black" stroke-width="5" onclick="transformMe(evt)"/> <text x="40" y="250" font-family="Verdana" font-size="16" fill="green" > Click on a shape to tr...
Using the Screen Capture API - Web APIs
eo is given a border, and its width is set to occupy nearly the entire available horizontal space (width: 98%). max-width is set to 860px to set an absolute upper limit on the video's size, The error, warn, and info classes are used to style the corresponding console output types. #video { border: 1px solid #999; width: 98%; max-width: 860px; } .error { color: red; } .warn { color: o
range; } .info { color: darkgreen; } Result The final product looks like this. If your browser supports Screen Capture API, clicking "Start Capture" will present the user agent's interface for selecting a screen, window, or tab to share. Security In order to function when Feature Policy is enabled, you will need the display-capture permission. This can be done using the Feature-Policy HTTP hea...
ScriptProcessorNode.bufferSize - Web APIs
Note: As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by Audio Workers. The bufferSize property of the ScriptProcessorNode interface returns an integer representing both the input and output buffer size, in sample-frames. Its value can be a power of 2 value in the
range 256-16384. Syntax var audioCtx = new AudioContext(); var scriptNode = audioCtx.createScriptProcessor(4096, 1, 1); console.log(scriptNode.bufferSize); Value An integer. Example The following example shows basic usage of a ScriptProcessorNode to take a track loaded via AudioContext.decodeAudioData(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the AudioDestinationNode. For eac...
ScriptProcessorNode - Web APIs
Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Properties Inherits properties from its parent, AudioNode. ScriptProcessorNode.bufferSize Read only Returns an integer representing both the input and output buffer size. Its value can be a power of 2 value in the
range 256-16384. Methods No specific methods; inherits methods from its parent, AudioNode. Events Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface: audioprocess Fired when an input buffer of a ScriptProcessorNode is ready to be processed. Also available via the onaudioprocess event handler property. Examples The...
Selection.collapse() - Web APIs
The Selection.collapse() method collapses the current selection to a single point. The document is not modified. If the content is focused and editable, the caret will blink there. Syntax sel.collapse(node, offset); Parameters node The caret location will be within this node. This value can also be set to null -- if null is specified, the method will behave like Selection.removeAll
Ranges(), i.e. all
ranges will be removed from the selection. offset Optional The offset in node to which the selection will be collapsed. If not specified, the default value 0 is used. Examples /* Place the caret at the beginning of an HTML document's body. */ var body = document.getElementsByTagName("body")[0]; window.getSelection().collapse(body,0); Specifications Specification ...
Selection.isCollapsed - Web APIs
The Selection.isCollapsed read-only property returns a Boolean which indicates whether or not there is currently any text selected. No text is selected when the selection's start and end points are at the same position in the content. Keep in mind that a collapsed selection may still have one (or more, in Gecko)
Ranges, so Selection.
rangeCount may not be zero. In that scenario, calling a Selection object's get
RangeAt() method may return a
Range object which is collapsed. Syntax bool = sel.isCollapsed Specifications Specification Status Comment Selection APIThe definition of 'Selection.isCollapsed' in that specification. Working Draft Current ...
Selection.setBaseAndExtent() - Web APIs
Syntax sel.setBaseAndExtent(anchorNode,anchorOffset,focusNode,focusOffset) Parameters anchorNode The node at the start of the selection. anchorOffset The number of child nodes from the start of the anchor node that should be excluded from the selection. So for example, if the value is 0 the whole node is included. If the value is 1, the whole node minus the first child node is included. And so on. focusNode The node at the end of the selection. ...
Selection.type - Web APIs
The type read-only property of the Selection interface returns a DOMString describing the type of the current selection. Syntax value = sel.type Value A DOMString describing the type of the current selection. Possible values are: None: No selection has currently been made. Caret: The selection is collapsed (i.e. the caret is placed on some text, but no
range has been selected).
Range: A
range has been selected. Example In this example, the event handler will fire each time a new selection is made. console.log(selection.type) will return Caret or
Range depending on whether the caret is placed at a single point in the text, or a
range has been selected. var selection; document.onselectionchange = function() { console.log('New selection made'); selection = document.ge...
ServiceWorkerContainer.register() - Web APIs
.then(function(serviceWorkerRegistration) { ... }); Parameters scriptURL The URL of the service worker script. The registered service worker file needs to have a valid JavaScript MIME type. options Optional An object containing registration options. Currently available options are: scope: A USVString representing a URL that defines a service worker's registration scope; that is, what
range of URLs a service worker can control. This is usually a relative URL. It is relative to the base URL of the application. By default, the scope value for a service worker registration is set to the directory where the service worker script is located. See the Examples section for more information on how it works. Return value A Promise that resolves with a ServiceWorkerRegistration object. ...
ShadowRoot - Web APIs
SStyleSheet objects for stylesheets explicitly linked into, or embedded in a document. Methods The ShadowRoot interface includes the following methods defined on the DocumentOrShadowRoot mixin. Note that this is currently only implemented by Chrome; other browsers still implement them on the Document interface. DocumentOrShadowRoot.getSelection() Returns a Selection object representing the
range of text selected by the user, or the current position of the caret. DocumentOrShadowRoot.elementFromPoint() Returns the topmost element at the specified coordinates. DocumentOrShadowRoot.elementsFromPoint() Returns an array of all elements at the specified coordinates. DocumentOrShadowRoot.caretPositionFromPoint() Returns a CaretPosition object containing the DOM node containing the caret, ...
SpeechSynthesisUtterance.pitch - Web APIs
The pitch property of the SpeechSynthesisUtterance interface gets and sets the pitch at which the utterance will be spoken at. If unset, a default value of 1 will be used. Syntax // default 1 speechSynthesisUtteranceInstance.pitch = 1.5; Value A float representing the pitch value. It can
range between 0 (lowest) and 2 (highest), with 1 being the default pitch for the current platform or voice. Some speech synthesis engines or voices may constrain the minimum and maximum rates further. If SSML is used, this value will be overridden by prosody tags in the markup. Examples var synth = window.speechSynthesis; var inputForm = document.querySelector('form'); var inputTxt = document.querySelector('input'); var voiceSelect = document.querySelector('select'); var voices = synth.getV...
SpeechSynthesisUtterance.rate - Web APIs
The rate property of the SpeechSynthesisUtterance interface gets and sets the speed at which the utterance will be spoken at. If unset, a default value of 1 will be used. Syntax var myRate = speechSynthesisUtteranceInstance.rate; speechSynthesisUtteranceInstance.rate = 1.5; Value A float representing the rate value. It can
range between 0.1 (lowest) and 10 (highest), with 1 being the default pitch for the current platform or voice, which should correspond to a normal speaking rate. Other values act as a percentage relative to this, so for example 2 is twice as fast, 0.5 is half as fast, etc. Some speech synthesis engines or voices may constrain the minimum and maximum rates further. If SSML is used, this value will be overridden by prosody tags in the markup. Examples var sy...
StereoPannerNode.StereoPannerNode() - Web APIs
erNode object which is an AudioNode that represents a simple stereo panner node that can be used to pan an audio stream left or right. Syntax var stereoPannerNode = StereoPannerNode(context, options) Parameters Inherits parameters from the AudioNodeOptions dictionary. context A reference to an AudioContext. options Optional Options are as follows: pan: A floating point number in the
range [-1,1] indicating the position of an AudioNode in an output image. The value -1 represents full left and 1 represents full right. The default value is 0. Return value A new StereoPannerNode object instance. Specifications Specification Status Comment Web Audio APIThe definition of 'StereoPannerNode()' in that specification. Working Draft Initial definition. ...
StereoPannerNode.pan - Web APIs
Syntax var audioCtx = new AudioContext(); var panNode = audioCtx.createStereoPanner(); panNode.pan.value = -0.5; Returned value An a-rate AudioParam containing the panning to apply. Note: Though the AudioParam returned is read-only, the value it represents is not. Example In our StereoPannerNode example (see source code) HTML we have a simple <audio> element along with a slider <input> to increase and decrease pan value. ...
Storage Access API - Web APIs
arty storage). The API provides methods that allow embedded resources to check whether they currently have access to their first-party storage, and to request access to their first-party storage from the user agent. Concepts and usage Most browsers implement a number of storage access policies that restrict access to cookies and site data for embedded, cross-origin resources. These restrictions
range from giving embedded resources under each top-level origin a unique storage space to outright blocking of storage access when resources are loaded in a third-party context. The semantics around third-party cookie blocking policies in particular differ from browser to browser, but the core functionality is similar: cross-origin resources embedded in a third-party context are not given access to t...
Touch() - Web APIs
that is the angle (in degrees) that the ellipse described by radiusX and radiusY is rotated clockwise about its center; 0 if no value is known. The value must be greater than or equal to 0 and less than 90. If the ellipse described by radiusX and radiusY is circular, then rotationAngle has no effect. The user agent may use 0 as the value in this case, or it may use any other value in the allowed
range. (For example, the user agent may use the rotationAngle value from the previous touch event, to avoid sudden changes.). "force", optional and defaulting to 0, of type float, that is the relative value of pressure applied, in the
range 0 to 1, where 0 is no pressure, and 1 is the highest level of pressure the touch device is capable of sensing; 0 if no value is known. In environments where force...
Touch.force - Web APIs
of 0.0 is returned if no value is known (for example the touch device does not support this property). In environments where force is known, the absolute pressure represented by the force attribute, and the sensitivity in levels of pressure, may vary. Example This example illustrates using the Touch interface's Touch.force property. This property is a relative value of pressure applied, in the
range 0.0 to 1.0, where 0.0 is no pressure, and 1.0 is the highest level of pressure the touch device is capable of sensing. In following code snippet, the touchstart event handler iterrates through the targetTouches list and logs the force value of each touch point but the code could invoke different processing depending on the value. someElement.addEventListener('touchstart', function(e) { // It...
TouchList.item() - Web APIs
Return value touchPoint The requested Touch object from the TouchList. Returns null if the index is not less than the length of the list. Example This code example illustrates the use of the TouchList interface's item method and the length property. ...
Touch events - Web APIs
rst touchmove event of a series prevents the corresponding mouse events from firing, it's common to call preventDefault() on touchmove rather than touchstart. That way, mouse events can still fire and things like links will continue to work. Alternatively, some frameworks have taken to refiring touch events as mouse events for this same purpose. (This example is oversimplified and may result in st
range behavior. It is only intended as a guide.) function onTouch(evt) { evt.preventDefault(); if (evt.touches.length > 1 || (evt.type == "touchend" && evt.touches.length > 0)) return; var newEvt = document.createEvent("MouseEvents"); var type = null; var touch = null; switch (evt.type) { case "touchstart": type = "mousedown"; touch = evt.changedTouches[0]; brea...
TreeWalker.expandEntityReferences - Web APIs
how method and the associated filter. Syntax expand = treeWalker.expandEntityReferences; Example var treeWalker = document.createTreeWalker( document.body, NodeFilter.SHOW_ELEMENT, { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }, false ); expand = treeWalker.expandEntityReferences; Specifications Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of 'TreeWalker.expandEntityReferences' in that specification. Obsolete Initial definition. ...
TreeWalker - Web APIs
and returns the found node. It also moves the current node to this one. If no such node exists, returns null and the current node is not changed. Specifications Specification Status Comment DOMThe definition of 'TreeWalker' in that specification. Living Standard Removed the expandEntityReferences property. Document Object Model (DOM) Level 2 Traversal and
Range SpecificationThe definition of 'TreeWalker' in that specification. Obsolete Initial definition. ...
USBConfiguration.USBConfiguration() - Web APIs
SBConfiguration object which contains information about the configuration on the provided USBDevice with the given configuration value. Syntax var USBConfiguration = new USBConfiguration(device, configurationValue) Parameters device Specifies the USBDevice you want to configure. configurationValue Specifies the configuration descriptor you want to read. This is an unsigned integer in the
range 0 to 255. Specifications Specification Status Comment UnknownThe definition of 'USBConfiguration' in that specification. Unknown Initial definition. ...
VTTCue() - Web APIs
The VTTCue() constructor creates and returns a new VTTCue object. Syntax vttCue = new VTTCue(startTime, endTime, text); Parameters startTime This is a double representing the initial text track cue start time. This is the time, given in seconds and fractions of a second, denoting the beginning of the
range of the media data to which this cue applies. For example, if a cue is to be visible from 50 seconds to a one minute, five and a half seconds in the media's playback, startTime will be 50.0. endTime This is a double representing the ending time for this text track cue. This is the time at which the cue should stop being presented to the user, given in seconds and fractions thereof. Given the example cue mentioned under startTime, the value of endTime would be 65.5. text A DOMStrin...
VTTCue - Web APIs
The VTTCue interface--part of the API for handling WebVTT (text tracks on media presentations)--describes and controls the text track associated with a particular <track> element. Constructor VTTCue(startTime, endTime, text) Returns a newly created VTTCue object that covers the given time
range and has the given text. Param startTime The time, in seconds and fractions of a second, that describes the beginning of the
range of the media data to which the cue applies. endTime The time, in seconds and fractions of a second, that describes the end of the
range of the media data to which the cue applies. text The raw text of the cue, and rules for its interpretation. Properties This interface also inherits properties from TextTrackCue. VTTCue.region A VTTRegion obj...
WEBGL_compressed_texture_astc.getSupportedProfiles() - Web APIs
The WEBGL_compressed_texture_astc.getSupportedProfiles() method returns an array of strings containing the names of the ASTC profiles supported by the implementation. Syntax sequence<DOMString> ext.getSupportedProfiles(); Return value An Array of DOMString elements indicating which ASTC profiles are supported by the implementation. Currently, this can be: "ldr": Low Dynamic
Range. "hdr": High Dynamic
Range. Dynamic
range refers to ratio between the brightest and darkest parts of the scene. Low dynamic
ranges are for example JPEG format images which won't exceed 255:1, or CRT monitors which won't exceed 100:1. An HDR image stores pixel values that span the whole tonal
range of real-world scenes (100,000:1). Examples var ext = gl.getExtension('WEBGL_compressed_texture_astc'); ext.ge...
WaveShaperNode.WaveShaperNode() - Web APIs
de object which is an AudioNode that represents a non-linear distorter. Syntax var waveShaperNode = new WaveShaperNode(context, options) Parameters Inherits parameters from the AudioNodeOptions dictionary. context A reference to an AudioContext. options Optional Options are as follows: curve: The shaping curve used for the waveshaping effect. The input signal is nominally within the
range [-1;1]. oversample: Specifies what type of oversampling (if any) should be used when applying the shaping curve. Valid values are 'none', '2x', or '4x'. The default is 'none'. Return value A new WaveShaperNode object instance. Specifications Specification Status Comment Web Audio APIThe definition of 'WaveShaperNode()' in that specification. Working Draft ...
WebGLRenderingContext.activeTexture() - Web APIs
The WebGLRenderingContext.activeTexture() method of the WebGL API specifies which texture unit to make active. Syntax void gl.activeTexture(texture); Parameters texture The texture unit to make active. The value is a gl.TEXTUREI where I is within the
range from 0 to gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1. Return value None. Exceptions If texture is not one of gl.TEXTUREI, where I is within the
range from 0 to gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1, a gl.INVALID_ENUM error is thrown. Examples The following call selects gl.TEXTURE1 as the current texture. Subsequent calls that modify the texture state will affect this texture. gl.activeTexture(gl.TEXTURE1); The number of texture units is implementation dependent, you can get this number with the help of the MAX_COMBINED_TEXTU...
WebGLRenderingContext.getActiveUniform() - Web APIs
{ float bar; } e; will result in Block.bar. The size attribute of the return value corresponds to the length of the array for uniforms declared as arrays. Otherwise, it is 1 (this includes interface blocks instanced with arrays). Exceptions gl.INVALID_VALUE is generated if the program WebGLProgram is invalid (not linked, deleted, etc.). gl.INVALID_VALUE is generated if index is not in the
range [0, gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS) - 1]. Examples const numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); for (let i = 0; i < numUniforms; ++i) { const info = gl.getActiveUniform(program, i); console.log('name:', info.name, 'type:', info.type, 'size:', info.size); } Specifications Specification Status Comment WebGL 1.0The def...
WebGLRenderingContext.getError() - Web APIs
ation. Syntax GLenum gl.getError(); Parameters None. Return value Constant Description gl.NO_ERROR No error has been recorded. The value of this constant is 0. gl.INVALID_ENUM An unacceptable value has been specified for an enumerated argument. The command is ignored and the error flag is set. gl.INVALID_VALUE A numeric argument is out of
range. The command is ignored and the error flag is set. gl.INVALID_OPERATION The specified command is not allowed for the current state. The command is ignored and the error flag is set. gl.INVALID_FRAMEBUFFER_OPERATION The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it. gl.OUT_OF_MEMORY Not enough memory is left ...
WebGLRenderingContext.lineWidth() - Web APIs
entations of WebGL only support a minimum of 1 and a maximum of 1 as the technology they are based on has these same limits. Syntax void gl.lineWidth(width); Parameters width A GLfloat specifying the width of rasterized lines. Default value: 1. Return value None. Examples Setting the line width: gl.lineWidth(5); Getting the line width: gl.getParameter(gl.LINE_WIDTH); Getting the
range of available widths. Returns a Float32Array. gl.getParameter(gl.ALIASED_LINE_WIDTH_
RANGE); Specifications Specification Status Comment WebGL 1.0The definition of 'lineWidth' in that specification. Recommendation Initial definition. OpenGL ES 2.0The definition of 'glLineWidth' in that specification. Standard Man page of the OpenGL API. ...
WebGLRenderingContext.sampleCoverage() - Web APIs
The default value is 1.0. invert A GLboolean which sets whether or not the coverage masks should be inverted. The default value is false. Return value None. Examples Multi-sampling is disabled by default. ...
WebGLRenderingContext.stencilFunc() - Web APIs
if (ref & mask) = (stencil & mask). gl.LEQUAL: Pass if (ref & mask) <= (stencil & mask). gl.GREATER: Pass if (ref & mask) > (stencil & mask). gl.NOTEQUAL: Pass if (ref & mask) != (stencil & mask). gl.GEQUAL: Pass if (ref & mask) >= (stencil & mask). gl.ALWAYS: Always pass. ref A GLint specifying the reference value for the stencil test. This value is clamped to the
range 0 to 2n -1 where n is the number of bitplanes in the stencil buffer. The default value is 0. mask A GLuint specifying a bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. The default value is all 1. Return value None. Examples The stencil testing is disabled by default. To enable or disable stencil testing, use the enable() and disable...
WebGLRenderingContext.stencilFuncSeparate() - Web APIs
if (ref & mask) = (stencil & mask). gl.LEQUAL: Pass if (ref & mask) <= (stencil & mask). gl.GREATER: Pass if (ref & mask) > (stencil & mask). gl.NOTEQUAL: Pass if (ref & mask) != (stencil & mask). gl.GEQUAL: Pass if (ref & mask) >= (stencil & mask). gl.ALWAYS: Always pass. ref A GLint specifying the reference value for the stencil test. This value is clamped to the
range 0 to 2n -1 where n is the number of bitplanes in the stencil buffer. The default value is 0. mask A GLuint specifying a bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. The default value is all 1. Return value None. Examples The stencil testing is disabled by default. To enable or disable stencil testing, use the enable() and disable...
WebGLRenderingContext.viewport() - Web APIs
ative value, a gl.INVALID_VALUE error is thrown. Examples When you first create a WebGL context, the size of the viewport will match the size of the canvas. However, if you resize the canvas, you will need to tell the WebGL context a new viewport setting. In this situation, you can use gl.viewport. gl.viewport(0, 0, canvas.width, canvas.height); The viewport width and height are clamped to a
range that is implementation dependent. To get this
range, you can use the MAX_VIEWPORT_DIMS constant, which returns an Int32Array. gl.getParameter(gl.MAX_VIEWPORT_DIMS); // e.g. Int32Array[16384, 16384] To get the current viewport, query the VIEWPORT constant. gl.getParameter(gl.VIEWPORT); // e.g. Int32Array[0, 0, 640, 480] Specifications Specification Status Comment Web...
WebGLRenderingContext - Web APIs
endering to a WebGLFramebuffer. WebGLRenderingContext.cullFace() Specifies whether or not front- and/or back-facing polygons can be culled. WebGLRenderingContext.depthFunc() Specifies a function that compares incoming pixel depth to the current depth buffer value. WebGLRenderingContext.depthMask() Sets whether writing into the depth buffer is enabled or disabled. WebGLRenderingContext.depth
Range() Specifies the depth
range mapping from normalized device coordinates to window or viewport coordinates. WebGLRenderingContext.disable() Disables specific WebGL capabilities for this context. WebGLRenderingContext.enable() Enables specific WebGL capabilities for this context. WebGLRenderingContext.frontFace() Specifies whether polygons are front- or back-facing by setting a winding orient...
WebGL by example - Web APIs
h a solid color. Clearing by clicking How to combine user interaction with graphics operations. Clearing the rendering context with a random color when the user clicks. Simple color animation A very basic color animation, done by clearing the WebGL drawing buffer with a different random color every second. Color masking Modifying random colors by applying color masking and thus limiting the
range of displayed colors to specific shades. Basic scissoring How to draw simple rectangles and squares with scissoring operations. Canvas size and WebGL The example explores the effect of setting (or not setting) the canvas size to its element size in CSS pixels, as it appears in the browser window. Boilerplate 1 The example describes repeated pieces of code that will be hidden from now on, as ...
Adding 2D content to a WebGL context - Web APIs
a shader program. Let's take a quick look at the two types of shader, with the example in mind of drawing a 2D shape into the WebGL context. Vertex shader Each time a shape is rendered, the vertex shader is run for each vertex in the shape. Its job is to transform the input vertex from its original coordinate system into the clip space coordinate system used by WebGL, in which each axis has a
range from -1.0 to 1.0, regardless of aspect ratio, actual size, or any other factors. The vertex shader must perform the needed transforms on the vertex's position, make any other adjustments or calculations it needs to make on a per-vertex basis, then return the transformed vertex by saving it in a special variable provided by GLSL, called gl_Position. The vertex shader can, as needed, also do thin...
Using textures in WebGL - Web APIs
position: positionBuffer, textureCoord: textureCoordBuffer, indices: indexBuffer, }; First, this code creates a WebGL buffer into which we'll store the texture coordinates for each face, then we bind that buffer as the array we'll be writing into. The textureCoordinates array defines the texture coordinates corresponding to each vertex of each face. Note that the texture coordinates
range from 0.0 to 1.0; the dimensions of textures are normalized to a
range of 0.0 to 1.0 regardless of their actual size, for the purpose of texture mapping. Once we've set up the texture mapping array, we pass the array into the buffer, so that WebGL has that data ready for its use. Updating the shaders The shader program also needs to be updated to use the textures instead of solid colors. The v...
Taking still photos with WebRTC - Web APIs
height are both 0), we clear the contents of the captured frame box by calling clearphoto(). Fun with filters Since we're capturing images from the user's webcam by grabbing frames from a <video> element, we can very easily apply filters and fun effects to the video. As it turns out, any CSS filters you apply to the element using the filter property affect the captured photo. These filters can
range from the simple (making the image black and white) to the extreme (gaussian blurs and hue rotation). You can play with this effect using, for example, the Firefox developer tools' style editor; see Edit CSS filters for details on how to do so. Using specific devices You can, if needed, restrict the set of permitted video sources to a specific device or set of devices. To do so, call navigator...
Web Video Text Tracks Format (WebVTT) - Web APIs
cue can be adjusted. After that we can set the region for that particular cue to which this cue belongs using cue.region. Vertical, horizontal, line, lineAlign, Position, positionAlign, text, size and Align can be used to alter the cue and its formation, just like we can alter the objects form, shape and visibility in HTML using CSS. But the VTTCue interface is within the WebVTT provides the vast
range of adjustment variables which can be used directly to alter the Cue. Following interface can be used to expose WebVTT cues in DOM API: enum AutoKeyword { "auto" }; enum DirectionSetting { "" /* horizontal */, "rl", "lr" }; enum LineAlignSetting { "start", "center", "end" }; enum PositionAlignSetting { "line-left", "center", "line-right", "auto" }; enum AlignSetting { "start", "center", "end", "l...
Using bounded reference spaces - Web APIs
undary. This is useful both for their safety (in case the boundary represents a physical obstacle of some nature) and to avoid possible conditions in which the accuracy is reduced near the boundaries. It's also useful because the user may be engrossed in gameplay or other activity, not realize they're approaching the boundary, and could become confused or distressed if they wander out of tracking
range (especially if doing so causes them to lose a game). The easiest solution is to just treat the each boundary segment as if it were an object to hit test against. As the user grows close to the boundary, you might warn them by displaying a message, flashing a warning indicator, playing an audio warning, or the like. And if the user actually collides with the boundary, don't let them continue past...
Geometry and reference spaces in WebXR - Web APIs
nd includes objects and interfaces that you can interact with directly. The mid-distance includes objects you can interact with to some extent, or can approach in order to examine and engage with more closely. The background, on the other hand, is usually largely or entirely non-interactive, at least until and unless the user is able to approach it, bringing it into the mid-distance or foreground
range. In WebXR, the fundamental concept of a space--as in, a coordinate space in which a scene takes place--is represented by an instance of XRSpace. The space is used to make determinations about the relative positions and motion of objects and other entities (such as light sources and cameras) within the user's environment. A point in 3D space is, as covered previously, made up of three components...
Lighting a WebXR setting - Web APIs
hting. It has sunlight, possibly light reflected off of objects or water within the scene, and so forth, but not lamps directed at the faces of objects or people in the scene. Realism in player interactions with light If your light source is located within the scene, you probably should try to ensure the viewer's avatar can't physically intersect with the light source. The results could be... st
range. If the viewer's avatar is meant to have physical form, it should have a model, even if the viewer can never see it, so that light interacts with the avatar correctly. Minimally, this means the avatar should cast an appropriate shadow; however, depending on factors such as whether or not the avatar can be seen and the materials, texturing, and other attributes of the its model--including, especi...
Targeting and hit detection - Web APIs
emented, but the end result is the same. Most commonly, it refers to "Laser Imaging, Detection, And Ranging" or "LIght Detection and Ranging"). Testing for collisions with the real world is a different problem, which may involve not only interpreting the imagery from the device's camera (if available) but also potentially multiple additional sensors. Some devices include infrared sensors to help
range objects, and others provide powerful LIDAR systems, which use lasers (usually infrared lasers, which can't be seen by the human eye) to determine
range to objects in the world. The details of how to work with an individual platform's ranging system is beyond the scope of this article. However, there's hope: a proposal has been floated for a WebXR Hit Test Module that would layer atop WebXR to pr...
Keyframe Formats - Web APIs
pacity: 0, color: "#fff" }, { // to opacity: 1, color: "#000" } ], 2000); Offsets for each keyframe can be specified by providing an offset value. element.animate([ { opacity: 1 }, { opacity: 0.1, offset: 0.7 }, { opacity: 0 } ], 2000); Note: offset values, if provided, must be between 0.0 and 1.0 (inclusive) and ar
ranged in ascending order. It is not necessary to specify an offset for every keyframe. Keyframes without a specified offset will be evenly spaced between adjacent keyframes. The easing to apply between keyframes can be specified by providing an easing value as illustrated below. element.animate([ { opacity: 1, easing: 'ease-out' }, { opacity: 0.1, easing: 'ease-in' }, ...
Web Audio API best practices - Web APIs
f you have buttons that switch audio on and off, using the ARIA role="switch" attribute on them is a good option for signalling to assistive technology what the button's exact purpose is, and therefore making the app more accessible. There's a demo of how to use it here. As you work with a lot of changing values within the Web Audio API and will want to provide users with control over these, the
range input is often a good choice of control to use. It's a good option as you can set minimum and maximum values, as well as increments with the step attribute. Setting AudioParam values There are two ways to manipulate AudioNode values, which are themselves objects of type AudioParam interface. The first is to set the value directly via the property. So for instance if we want to change the gain v...
Migrating from webkitAudioContext - Web APIs
Here is some information on how you can get these values if you need them: The name attribute is a string representing the name of the AudioParam object. For example, the name of GainNode.gain is "gain". You can simply track where the AudioParam object is coming from in your code if you need this information. The minValue and maxValue attributes are read-only values representing the nominal
range for the AudioParam. For example, for GainNode, these values are 0 and 1, respectively. Note that these bounds are not enforced by the engine, and are merely used for informational purposes. As an example, it's perfectly valid to set a gain value to 2, or even -1. In order to find out these nominal values, you can consult the specification. The units attribute as implemented in webkitAudioCon...
Web audio spatialization basics - Web APIs
ed, however, as we need to move the sound around. Not only do we have to update two axis values (e.g. if you rotate an object around the x-axis, you update the y and z coordinates for that object), but we also need to do some more maths for this. The rotation is a circle and we need Math.sin and Math.cos to help us draw that circle. ...
Window.find() - Web APIs
oleWord Unimplemented Boolean. If true, specifies a whole word search. This is not implemented; see bug 481513. aSearchInFrames Boolean. If true, specifies a search in frames. Returns true if the string is found; otherwise, false. Example JavaScript findString = function findText(text) { alert("String \x22" + text + "\x22 found? " + window.find(text)); } HTML <p>Apples, Bananas, and O
ranges.</p> <button type="button" onClick='findString("Apples")'>Search for Apples</button> <button type="button" onClick='findString("Banana")'>Search for Banana</button> <button type="button" onClick='findString("O
range")'>Search for O
range</button> Result Notes In some browsers, Window.find() selects (highlights) the found content on the site. Specification This is not part of any specificat...
Window - Web APIs
ne="middle">Window</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructors See also the DOM Interfaces. DOMParser DOMParser can parse XML or HTML source stored in a string into a DOM Document. DOMParser is specified in DOM Parsing and Serialization. Image Used for creating an HTMLImageElement. Option Used for creating an HTMLOptionElement. Static
Range Read only Returns a Static
Range() constructor which creates a Static
Range object. Worker Used for creating a Web worker. XMLSerializer Converts a DOM tree into XML or HTML source. Properties This interface inherits properties from the EventTarget interface and implements properties from the WindowOrWorkerGlobalScope and WindowEventHandlers mixins. Note that properties which are object...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
to include a string instead of a function, which is compiled and executed every delay milliseconds. This syntax is not recommended for the same reasons that make using eval() a security risk. delayOptional The time, in milliseconds (thousandths of a second), the timer should delay in between executions of the specified function or code. See Delay restrictions below for details on the permitted
range of delay values. arg1, ..., argN Optional Additional arguments which are passed through to the function specified by func once the timer expires. Note: Passing additional arguments to setInterval() in the first syntax does not work in Internet Explorer 9 and earlier. If you want to enable this functionality on that browser, you must use a polyfill (see the Callback arguments section). Retu...
WorkerGlobalScope.performance - Web APIs
Specifications Specification Status Comment High Resolution Time Level 2The definition of 'performance' in that specification. Recommendation Defines WorkerGlobalScope.performance. ...
Sending and Receiving Binary Data - Web APIs
the MIME type, forcing the browser to treat it as plain text, using a user-defined character set. This tells the browser not to parse it, and to let the bytes pass through unprocessed. var filestream = load_binary_resource(url); var abyte = filestream.charCodeAt(x) & 0xff; // throw away high-order byte (f7) The example above fetches the byte at offset x within the loaded binary data. The valid
range for x is from 0 to filestream.length-1. See downloading binary streams with XMLHttpRequest for a detailed explanation. See also downloading files. Sending binary data The send method of the XMLHttpRequest has been extended to enable easy transmission of binary data by accepting an ArrayBuffer, Blob, or File object. The following example creates a text file on-the-fly and uses the POST method ...
XPathResult.snapshotItem() - Web APIs
Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated. Syntax var node = result.snapshotItem(i); Return value The Node at the given index within the node set of the XPathResult. Exceptions TYPE_ERR In case XPathResult.resultType is not UNORDERED_NODE_SNAPSHOT_TYPE or ORDERED_NODE_SNAPSHOT_TYPE, an XPathException of type TYPE_ERR is thrown. Example The following example shows the use of the snapshotItem() method. ...
XPathResult - Web APIs
ot. XPathResult.stringValueRead only A string representing the value of the result if resultType is STRING_TYPE. Methods XPathResult.iterateNext() If the result is a node set, this method iterates over it and returns the next node from it or null if there are no more nodes. XPathResult.snapshotItem() Returns an item of the snapshot collection or null in case the index is not within the
range of nodes. Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated. Constants Result Type Defined Constant Value Description ANY_TYPE 0 A result set containing whatever type naturally results from evaluation of the expression. Note that if the result is a node-set then UNORDERED_NODE_ITER...
XRRenderState - Web APIs
The XRRenderState interface of the WebXR Device API contains configurable values which affect how the imagery generated by an XRSession gets composited. These properties include the
range of distances from the viewer within which content should be rendered, the vertical field of view (for inline presentations), and a reference to the XRWebGLLayer being used as the target for rendering the scene prior to it being presented on the XR device's display or displays. When you apply changes using the XRSession method updateRenderState(), the specified changes take effect after the current animation frame has completed, but before the next one begins. Properties The followiing properties are available on XRRenderState objects. baseLayer Read only The XRWebGLLayer from which the br...
msGetRegionContent - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The msGetRegionContent returns an array of
Range instances corresponding to the content from the region flow that is positioned in the region. This proprietary method is specific to Internet Explorer browser. Syntax var retVal = Element.msGetRegionContent(); Parameters retVal [out, reval] Type: MS
RangeCollection The name of the property to enable. Return value Type: Boolean Returned
ranges are sorted by document position and do not overlap. If an element is not a region, this method thro...
Using the aria-valuemax attribute - Accessibility
If the aria-valuenow has a known maximum and minimum, the author SHOULD provide properties for aria-valuemax and aria-valuemin. The value of aria-valuemax MUST be greater than or equal to the value of aria-valuemin. aria-valuemax is a required attribute of role slider, scrollbar and spinbutton. ...
Using the aria-valuemin attribute - Accessibility
If the aria-valuenow has a known maximum and minimum, the author SHOULD provide properties for aria-valuemax and aria-valuemin.The value of aria-valuemin MUST be less than or equal to the value of aria-valuemax. aria-valuemin is a required attribute of role slider, scrollbar and spinbutton. Value String representation of a number Possible effects on user agents and assistive technology If aria-valuemin is not less than or equal to the value of aria-valuemax, this creates an error condition that will be handled by the assistive technology. ...
Using the aria-valuetext attribute - Accessibility
The aria-valuetext attribute is used to define the human readable text alternative of aria-valuenow for a
range widget such as progressbar, spinbutton or slider. Authors SHOULD only set the aria-valuetext attribute when the rendered value cannot be accurately represented as a number. For example, a slider may have rendered values of small, medium, and large. In this case, the values of aria-valuenow could
range from 1 through 3, which indicate the position of each value in the value space, but thearia-valuetext would be one of the strings: small, medium, or large. Value String representation of a number Possible effects on user agents and assistive technology If the aria-valuetext attribute is absent, assistive technologies will rely solely on the aria-valuenow attribute for the c...
Using the progressbar role - Accessibility
the loading progress of a particular region of a page, the author SHOULD use aria-describedby to point to the status, and set the aria-busy attribute to true on the region until it is finished loading. It is not possible for the user to alter the value of a progressbar because it is always readonly. Note: Assistive technologies generally will render the value of aria-valuenow as a percent of the
range between the value of aria-valuemin and aria-valuemax, unless aria-valuetext is specified. It is best to set the values for aria-valuemin, aria-valuemax, and aria-valuenow in a manner that is appropriate for this calculation. Note: Elements with the role progressbar have an implicit aria-readonly value of true. Possible effects on user agents and assistive technology Screen readers should anno...
ARIA: cell role - Accessibility
onal contextual row parent. It establishes a relationship between descendant rows. It is a structural equivalent to the thead, tfoot, and tbody elements in an HTML table element. role="table" One of the three possible contexts (along with grid and treegrid) in which you'll find a row containing cells. Table identifies the cell as being part of a non-interactive table structure containing data ar
ranged in rows and columns, similar to the native HTML <table> element. role="grid" One of the three possible contexts (along with table and treegrid) in which you'll find a row containing cells and gridcells. Grid identifies a cell as being part of a possibly interactive table structure containing data ar
ranged in rows and columns, similar to the native <table> HTML element. role="treegrid" Simil...
ARIA: row role - Accessibility
e="rowgroup" An optional contextual row parent, it establishes a relationship between descendant rows. It is a structural equivalent to the thead, tfoot, and tbody elements in an HTML table element. role="table" One of the three possible contexts (along with grid and treegrid) in which you'll find a row, it identifies the row as being part of a non-interactive table structure containing data ar
ranged in rows and columns, similar to the native <table> HTML element. role="grid" One of the three possible contexts (along with table and treegrid) in which you'll find a row, it identifies the row as being part of a non-interactive table structure containing data ar
ranged in rows and columns, similar to the native <table> HTML element. role="treegrid" Similar to a grid, but with rows that can ...
ARIA: rowgroup role - Accessibility
) along with the table header (<thead>), footer (<tfoot>), and body (<tbody>) elements whenever possible is strongly encouraged. Associated WAI-ARIA roles, states, and properties Context roles role="table" One of the three possible contexts (along with grid and treegrid) in which you'll find a row. It identifies the row as being part of a non-interactive table structure containing data ar
ranged in rows and columns, similar to the native <table> HTML element. role="grid" One of the three possible contexts (along with table and treegrid) in which you'll find a row. It identifies the row as being part of a non-interactive table structure containing data ar
ranged in rows and columns, similar to the native <table> HTML element. role="treegrid" Similar to a grid, but with rows that can ...
:checked - CSS: Cascading Style Sheets
="opt-in">Check me!</label> </div> <select name="my-select" id="fruit"> <option value="opt1">Apples</option> <option value="opt2">Grapes</option> <option value="opt3">Pears</option> </select> CSS div, select { margin: 8px; } /* Labels for checked inputs */ input:checked + label { color: red; } /* Radio element, when checked */ input[type="radio"]:checked { box-shadow: 0 0 0 3px o
range; } /* Checkbox element, when checked */ input[type="checkbox"]:checked { box-shadow: 0 0 0 3px hotpink; } /* Option elements, when selected */ option:checked { box-shadow: 0 0 0 3px lime; color: red; } Result Toggling elements with a hidden checkbox This example utilizes the :checked pseudo-class to let the user toggle content based on the state of a checkbox, all without using Java...
:hover - CSS: Cascading Style Sheets
The :hover CSS pseudo-class matches when the user interacts with an element with a pointing device, but does not necessarily activate it. It is generally triggered when the user hovers over an element with the cursor (mouse pointer). /* Selects any <a> element when "hovered" */ a:hover { color: o
range; } Styles defined by the :active pseudo-class will be overridden by any subsequent link-related pseudo-class (:link, :visited, or :active) that has at least equal specificity. To style links appropriately, put the :hover rule after the :link and :visited rules but before the :active one, as defined by the LVHA-order: :link -- :visited -- :hover -- :active. Note: The :hover pseudo-class is problematic on touchscreens. Depending on the browser, the :hover pseudo-class might never match, match ...
:where() - CSS: Cascading Style Sheets
y the classes used to mark the child elements. To make selecting the links inside them simpler, but still distinct, we could use :is() or :where(), in the following manner: html { font-family: sans-serif; font-size: 150%; } :is(section.is-styling, aside.is-styling, footer.is-styling) a { color: red; } :where(section.where-styling, aside.where-styling, footer.where-styling) a { color: o
range; } However, what if we later want to override the color of links in the footers using a simple selector? footer a { color: blue; } This won't work for the red links, because the selectors inside :is() count towards the specificity of the overall selector, and class selectors have a higher specificity than element selectors. However, selectors inside :where() have specificity 0, so the orang...
fallback - CSS: Cascading Style Sheets
tion for a particular counter value. Syntax /* Keyword values */ fallback: lower-alpha; fallback: custom-gangnam-style; Description If the specified fallback style is also unable to construct a representation, then its fallback style will be used. If a valid fallback style is not specified, it defaults to decimal. A couple of scenarios where a fallback style will be used are: When the
range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the
range. When the fixed system is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items. Formal definition Related at-rule@counter-styleInitial valuedecimalComputed valueas specified Formal syntax <co...
font-style - CSS: Cascading Style Sheets
ue 30deg 50deg; Values normal Selects the normal version of the font-family. italic Specifies that font-face is an italicized version of the normal font. oblique Specifies that the font-face is an artificially sloped version of the normal font. oblique with angle Selects a font classified as oblique, and additionally specifies an angle for the slant of the text. oblique with angle
range Selects a font classified as oblique, and additionally specifies a
range of allowable angle for the slant of the text. Note that a
range is only supported when the font-style is oblique; for font-style: normal or italic, no second value is allowed. Formal definition Related at-rule@font-faceInitial valuenormalComputed valueas specified Formal syntax normal | italic | oblique <angle>{0,2} E...
font-variation-settings - CSS: Cascading Style Sheets
mal Text is laid out using default settings. <string> <number> When rendering text, the list of OpenType axis names is passed to the text layout engine to enable or disable font features. Each setting is always a <string> of 4 ASCII characters, followed by a <number> indicating the axis value. If the <string> has more or fewer characters or contains characters outside the U+20 - U+7E codepoint
range, the whole property is invalid. The <number> can be fractional or negative. Formal definition Related at-rule@font-faceInitial valuenormalComputed valueas specified Formal syntax normal | [ <string> <number> ]# Examples Setting font weight and stretch in a @font-face rule @font-face { font-family: 'OpenTypeFont'; src: url('open_type_font.woff2') format('woff2'); font-weight: normal;...
-webkit-device-pixel-ratio - CSS: Cascading Style Sheets
The -webkit-device-pixel-ratio is a non-standard Boolean CSS media feature which is an alternative to the standard resolution media feature. Note: This media feature is a WebKit feature. If possible, use the resolution media feature query instead. Syntax The -webkit-device-pixel-ratio feature is specified as a <number> value. It is a
range feature, meaning that you can also use the prefixed -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio variants to query minimum and maximum values, respectively. Values <number> The number of device pixels used to represent each CSS px. Although the value is a <number>, and thus doesn't syntactically allow units, its implicit unit is dppx. Implementation /* A unit of "dppx" is implied: */ @media (-webkit-min-device-pixe...
color-gamut - CSS: Cascading Style Sheets
Syntax The color-gamut feature is specified as a keyword value chosen from the list below. srgb The output device can support approximately the sRGB gamut or more. This includes the vast majority of color displays. p3 The output device can support approximately the gamut specified by the DCI P3 Color Space or more. The p3 gamut is larger than and includes the srgb gamut. rec2020 The output device can support approximately the gamut specified by the ITU-R Recommendation BT.2020 Color Space or more. The rec2020 gamut is larger than and includes the p3 gamut. ...
color-index - CSS: Cascading Style Sheets
The color-index CSS media feature can be used to test the number of entries in the output device's color lookup table. Syntax The color-index feature is specified as an <integer> value representing the number of entries in the output device's color lookup table. (This value is zero if the device does not use such a table.) It is a
range feature, meaning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. Examples Basic example HTML <p>This is a test.</p> CSS p { color: black; } @media (color-index) { p { color: red; } } @media (min-color-index: 15000) { p { color: #1475ef; } } Result Custom stylesheet This HTML will apply a special stylesheet for devices that have at least 256 color...
color - CSS: Cascading Style Sheets
The color CSS media feature can be used to test the number of bits per color component (red, green, blue) of the output device. Syntax The color feature is specified as an <integer> value that represents the number of bits per color component (red, green, blue) of the output device. If the device is not a color device, the value is zero. It is a
range feature, meaning that you can also use the prefixed min-color and max-color variants to query minimum and maximum values, respectively. Note: If the various color components are represented by different numbers of bits, the smallest number is used. For example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. If the device uses indexed colors, the minimum number o...
device-aspect-ratio - CSS: Cascading Style Sheets
The device-aspect-ratio CSS media feature can be used to test the width-to-height aspect ratio of an output device. Syntax The device-aspect-ratio feature is specified as a <ratio>. It is a
range feature, meaning that you can also use the prefixed min-device-aspect-ratio and max-device-aspect-ratio variants to query minimum and maximum values, respectively. Examples article { padding: 1rem; } @media screen and (min-device-aspect-ratio: 16/9) { article { padding: 1rem 5vw; } } Specifications Specification Status Comment Media Queries Level 4The definition of 'device-aspect-ratio' in that specification. Candidate Recommendation Deprecated in Media Queries Level 4. Media QueriesThe definition of 'device-aspect-ratio' in that specificat...
height - CSS: Cascading Style Sheets
The height CSS media feature can be used to apply styles based on the height of the viewport (or the page box, for paged media). Syntax The height feature is specified as a <length> value representing the viewport height. It is a
range feature, meaning that you can also use the prefixed min-height and max-height variants to query minimum and maximum values, respectively. Examples HTML <div>Watch this element as you resize your viewport's height.</div> CSS /* Exact height */ @media (height: 360px) { div { color: red; } } /* Minimum height */ @media (min-height: 25rem) { div { background: yellow; } } /* Maximum height */ @media (max-height: 40rem) { div { border: 2px solid blue; } } Result Specifications Specification Status Comment ...
light-level - CSS: Cascading Style Sheets
The light-level CSS media feature can be used to test the ambient light level. Syntax dim The device is used in a dim environment, where excessive contrast and brightness would be distracting or uncomfortable to the reader. For example: night time, or a dimly illuminated indoor environment. normal The device is used in a environment with a light level in the ideal
range for the screen, and which does not necessitate any particular adjustment. washed The device is used in an exceptionally bright environment, causing the screen to be washed out and difficult to read. For example: bright daylight. Examples This code will likely not work on any devices (device compatibility is low). @media (light-level: normal) { p { background: url("texture.jpg"); color: #333; } } @med...
monochrome - CSS: Cascading Style Sheets
The monochrome CSS media feature can be used to test the number of bits per pixel in the monochrome frame buffer of the output device. Syntax The monochrome feature is specified as an <integer> representing the number of bits per pixel in the monochrome frame buffer. If the device is not a monochrome device, the value is zero. It is a
range feature, meaning that you can also use the prefixed min-monochrome and max-monochrome variants to query minimum and maximum values, respectively. Examples HTML <p class="mono">Your device supports monochrome pixels!</p> <p class="no-mono">Your device doesn't support monochrome pixels.</p> CSS p { display: none; } /* Any monochrome device */ @media (monochrome) { p.mono { display: block; color: #333; } } /* Any non-monochrome device */...
prefers-reduced-data - CSS: Cascading Style Sheets
<link rel="stylesheet" href="style.css"> </head> CSS @media (prefers-reduced-data: no-preference) { @font-face { font-family: Montserrat; font-style: normal; font-weight: 400; font-display: swap; /* latin */ src: local('Montserrat Regular'), local('Montserrat-Regular'), url('fonts/montserrat-regular.woff2') format('woff2'); unicode-
range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } } body { font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Microsoft YaHei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; } Result Specifications ...
resolution - CSS: Cascading Style Sheets
The resolution CSS media feature can be used to test the pixel density of the output device. Syntax The resolution feature is specified as a <resolution> value representing the pixel density of the output device. It is a
range feature, meaning that you can also use the prefixed min-resolution and max-resolution variants to query minimum and maximum values, respectively. Examples HTML <p>This is a test of your device's pixel density.</p> CSS /* Exact resolution */ @media (resolution: 150dpi) { p { color: red; } } /* Minimum resolution */ @media (min-resolution: 72dpi) { p { text-decoration: underline; } } /* Maximum resolution */ @media (max-resolution: 300dpi) { p { background: yellow; } } Result Specifications Specification Status Comment ...
width - CSS: Cascading Style Sheets
The width CSS media feature can be used to test the width of the viewport (or the page box, for paged media). Syntax The width feature is specified as a <length> value representing the viewport width. It is a
range feature, meaning that you can also use the prefixed min-width and max-width variants to query minimum and maximum values, respectively. Examples HTML <div>Watch this element as you resize your viewport's width.</div> CSS /* Exact width */ @media (width: 360px) { div { color: red; } } /* Minimum width */ @media (min-width: 35rem) { div { background: yellow; } } /* Maximum width */ @media (max-width: 50rem) { div { border: 2px solid blue; } } Result Specifications Specification Status Comment Media Queries Level 4The d...
Attribute selectors - CSS: Cascading Style Sheets
value] Represents elements with an attribute name of attr whose value is suffixed (followed) by value. [attr*=value] Represents elements with an attribute name of attr whose value contains at least one occurrence of value within the string. [attr operator value i] Adding an i (or I) before the closing bracket causes the value to be compared case-insensitively (for characters within the ASCII
range). [attr operator value s] Adding an s (or S) before the closing bracket causes the value to be compared case-sensitively (for characters within the ASCII
range). Examples Links CSS a { color: blue; } /* Internal links, beginning with "#" */ a[href^="#"] { background-color: gold; } /* Links with "example" anywhere in the URL */ a[href*="example"] { background-color: silver; } /* ...
CSS Box Alignment - CSS: Cascading Style Sheets
ndaries of the alignment container and can't be scrolled to. If you specify unsafe then the alignment will be honoured even if it would cause such data loss. Gaps between boxes The box alignment specification also includes the gap, row-gap, and column-gap properties. These properties enable the setting of a consistent gap between items in a row or column, in any layout method which has items ar
ranged in this way. The gap property is a shorthand for row-gap and column-gap, which allows us to set these properties at once: row-gap column-gap gap In the below example, a grid layout uses the gap shorthand to set a 10px gap between row tracks, and a 2em gap between column tracks. In this example I am using the grid-gap property in addition to gap. The gap properties were originally pref...
Handling content breaks in multicol - CSS: Cascading Style Sheets
tent breaks between the fragmentation containers, or fragmentainers. In multicol, the fragmentainer is the column box. A column box can contain other markup and there are many places where a break would not be ideal. For example, we would generally prefer that the figcaption of an image not be separated into a new column away from the image it refers to and ending a column with a heading looks st
range. The fragmentation properties give us ways to exercise some control over this. There are various places we might want to control our breaks: Breaks inside boxes, for example inside a figure element. Breaks before and after boxes, which would include our heading example above. Breaks between lines. Breaks inside boxes To control breaks inside boxes use the break-inside property. This prop...
CSS Multi-column Layout - CSS: Cascading Style Sheets
luded for establishing the number of columns in a layout, as well as how content should flow from column to column, gap sizes between columns, and column dividing lines (known as column rules) along with their appearance. Basic example In the following example the column-count property has been applied to the element with a class of container. As the value of column-count is 3, the content is ar
ranged into 3 columns of equal size. Relationship to Fragmentation Multiple-column Layout is closely related to Paged Media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. Therefore the properties now defined in the CSS Fragmentation specification are required in order to control how content breaks between columns. Reference Multip...
CSS Counter Styles - CSS: Cascading Style Sheets
CSS Counter Styles is a module of CSS that lets you define your own counter styles. Reference Properties counter-increment counter-reset At-rules @counter-style system additive-symbols negative prefix suffix
range pad speak-as fallback Guides Using CSS counters Describes how to use counters to number any HTML element or to perform complex counting. Specifications Specification Status Comment CSS Counter Styles Level 3 Candidate Recommendation Initial definition. ...
Basic concepts of flexbox - CSS: Cascading Style Sheets
start to look at aligning and justifying flex items; flexbox features properties that align and justify content along one axis or the other. Start and end lines Another vital area of understanding is how flexbox makes no assumption about the writing mode of the document. In the past, CSS was heavily weighted towards horizontal and left-to-right writing modes. Modern layout methods encompass the
range of writing modes and so we no longer assume that a line of text will start at the top left of a document and run towards the right hand side, with new lines appearing one under the other. You can read more about the relationship between flexbox and the Writing Modes specification in a later article; however, the following description should help explain why we do not talk about left and right an...
Ordering Flex Items - CSS: Cascading Style Sheets
order changes the order in which items are painted, and the order in which they appear visually. It does not change the sequential navigation order of the items. Therefore if a user is tabbing between the items, they could find themselves jumping around your layout in a very confusing way. By tabbing around any of the live examples on this page, you can see how order is potentially creating a st
range experience for anyone not using a pointing device of some kind. To read more about this disconnect of visual order and logical order and some of the potential problems it raises for accessibility, see the following resources. Flexbox and the keyboard navigation disconnect HTML Source Order vs CSS Display Order The Responsive Order Conflict for Keyboard Focus Use cases for order There are ...
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
the element itself to no longer be announced by screen reading technology. This is incorrect behavior according to the specification, see display: contents. Also, having removed the box you cannot then use it to -- for example -- add a background colour behind the nested sub children. If you remove display: contents in this live example you will see that the direct child we are removing has an o
range background colour. This also disappears when the box disappears. Browser support for display:contents is limited and required for this demo to work. Firefox supports display: contents already, and the value is being implemented in Chrome. Once there is better browser support this feature will be very useful in circumstances where you need the markup for semantic reasons but do not want to dis...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
s. This will give you the actual size of the margin which can help you to identify what is happening. Elements participating in an inline formatting context Inline elements display one after the other in the direction that sentences run in that particular writing mode. While we don't tend to think of inline elements as having a box, as with everything in CSS they do. These inline boxes are ar
ranged one after the other. If there is not enough space in the containing block for all of the boxes a box can break onto a new line. The lines created are known as line boxes. In the following example, we have three inline boxes created by a paragraph with a <strong> element inside it. The boxes around the words before the <strong> element and after the <strong> element are referred to as anonymo...
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
ced elements such as images will not change their orientation based on the writing-mode property. However, replaced elements such as form controls which include text, should match the writing mode in use. Logical Properties and Values Once you are working in writing modes other than horizontal-tb many of the properties and values that are mapped to the physical dimensions of the screen seem st
range. For example, if you give a box a width of 100px, in horizontal-tb that would control the size in the inline direction. In vertical-lr it controls the size in the block direction because it does not rotate with the text. Therefore, we have new properties of block-size and inline-size. If we give our block an inline-size of 100px, it doesn't matter whether we are in a horizontal or a vertical w...
In Flow and Out of Flow - CSS: Cascading Style Sheets
In the previous guide I explained block and inline layout in normal flow. All elements that are in flow, will be laid out using this method. In the following example I have a heading, paragraph, a list and a final paragraph which contains a strong element. The heading and paragraphs are block level, the strong element inline. The list is displayed using flexbox to ar
range the items into a row, however it too is participating in block and inline layout - the container has an outside display type of block. All of the elements can be said to be in flow. Appearing on the page in the order that they are in the source. Taking an item out of flow All elements are in-flow apart from: floated items items with position: absolute (including position: fixed which acts in the same way) the root ...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
.wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; } <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> Default rules for auto-placement As you can see with the above example, if you create a grid all child items will lay themselves out one into each grid cell. The default flow is to ar
range items by row. Grid will lay an item out into each cell of row 1. If you have created additional rows using the grid-template-rows property then grid will continue placing items in these rows. If the grid does not have enough rows in the explicit grid to place all of the items new implicit rows will be created. Sizing rows in the implicit grid The default for automatically created rows in the im...
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
div> What this demonstrates, is that if you are switching the direction of your text, either for entire pages or for parts of pages, and are using lines: you may want to name your lines, if you do not want the layout to completely switch direction. For some things, for example, where a grid contains text content, this switching may be exactly what you want. For other usage it may not. The st
range order of values in the grid-area property You can use the grid-area property to specify all four lines of a grid area as one value. When people first encounter this, they are often surprised that the values do not follow the same order as the shorthand for margin - which runs clockwise: top, right, bottom, left. The order of grid-area values is: grid-row-start grid-column-start grid-row-en...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
position items using line-based placement of grid template areas, without considering their location in the source. The specification includes a section that covers Reordering and Accessibility. In the introduction to that section are details of what the specification expects browsers to do when the content is visually reordered using Grid Layout. Grid layout gives authors great powers of rear
rangement over the document. However, these are not a substitute for correct ordering of the document source. The order property and grid placement do not affect ordering in non-visual media (such as speech). Likewise, rearranging grid items visually does not affect the default traversal order of sequential navigation modes (such as cycling through links, see e.g. tabindex HTML5). If you reorder thin...
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
It may help to realize that this is due to grid using the flow-relative directions defined in the CSS Writing Modes specification. We will explore how grids work with writing modes in a later article however we have the concept of four flow-relative directions: block-start block-end inlin...
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
of space all five items can fit on one row. If we have a very narrow container we may only have space for one. In comparison, the grid version always has three column tracks. The tracks themselves will grow and shrink, but there are always three since we asked for three when defining our grid. Auto-filling grid tracks We can create a similar effect to flexbox, while still keeping the content ar
ranged in strict rows and columns, by creating our track listing using repeat notation and the auto-fill and auto-fit properties. In this next example, I have used the auto-fill keyword in place of an integer in the repeat notation and set the track listing to 200 pixels. This means that grid will create as many 200 pixels column tracks as will fit in the container. * {box-sizing: border-box;} .wra...
Stacking with floated blocks - CSS: Cascading Style Sheets
This is due to a peculiar part of the specification: applying a opacity value creates a new stacking context (see What No One Told You About Z-Index). Source code for the example HTML <div id="abs1"> <b>DIV #1</b><br />position: absolute;</div> <div id="flo1"> <b>DIV #2</b><br />...
Stacking context example 2 - CSS: Cascading Style Sheets
he key for understanding the concept of stacking context. There are the same four DIVs of the previous example, but now z-index properties are assigned on both levels of the hierarchy. You can see that DIV #2 (z-index: 2) is above DIV #3 (z-index: 1), because they both belong to the same stacking context (the root one), so z-index values rule how elements are stacked. What can be considered st
range is that DIV #2 (z-index: 2) is above DIV #4 (z-index: 10), despite their z-index values. The reason is that they do not belong to the same stacking context. DIV #4 belongs to the stacking context created by DIV #3, and as explained previously DIV #3 (and all its content) is under DIV #2. To better understand the situation, this is the stacking context hierarchy: root stacking context DI...
Understanding CSS z-index - CSS: Cascading Style Sheets
In this case, there is a single rendering flow, and all elements are aware of the space taken by others. The z-index attribute lets you adjust the order of the layering of objects when rendering content. In CSS 2.1, each box has a position in three dimensions. In addition to their horizontal and vertical positions, boxes lie along a "z-axis" and are formatted one on top of the other. Z-axis positions are particularly relevant when boxes overlap visually. ...
Basic Shapes - CSS: Cascading Style Sheets
Before looking at the shapes, it is worth understanding two pieces of information that go together to make these shapes possible: The <basic-shape> type The reference box The <basic-shape> type The <basic-shape> type is used as the value for all of our Basic Shapes. This type uses Functional Notation: the type of shape is followed by brackets, inside of which are additional values used to describe the shape. ...
Column layouts - CSS: Cascading Style Sheets
r of columns, and CSS provides several ways to do this. Whether you use Grid, Flexbox or Multi-column layout will depend on what you are trying to achieve, and in this recipe we explore these options. Requirements There are a number of design patterns you might want to achieve with your columns: A continuous thread of content broken up into newspaper-style columns. A single row of items ar
ranged as columns, with all heights being equal. Multiple rows of columns lined up by row and column. The recipes You need to choose different layout methods in order to achieve your requirements. A continuous thread of content -- multi-column layout If you create columns using multi-column layout your text will remain as a continuous stream filling each column in turn. The columns must all be th...
Cookbook template - CSS: Cascading Style Sheets
parameter is the live example height, which you can change as needed. Change the link to point to your merged download version. Download the example Choices made Explain your decisions when creating the pattern. Why did you choose a certain method? If you want to add an additional example here -- for example a version with fallbacks, please do. This section is deliberately loose as patterns
range from the very simple to more complex. Useful fallbacks or alternative methods If there are useful alternative methods for building the recipe, or fallback recipes to use if you have to support non-supporting browsers, include them in separate sections down here. Accessibility concerns Include this is there are any specific things to watch out for in regard to accessibility. If not relevant fo...
Microsoft CSS extensions - CSS: Cascading Style Sheets
wrap-margin -ms-wrap-through zoom Pseudo-elements ::-ms-browse ::-ms-check ::-ms-clear ::-ms-expand ::-ms-fill ::-ms-fill-lower ::-ms-fill-upper ::-ms-reveal ::-ms-thumb ::-ms-ticks-after ::-ms-ticks-before ::-ms-tooltip ::-ms-track ::-ms-value Media features -ms-high-contrast CSS-related DOM APIs msContentZoomFactor msGetPropertyEnabled msGetRegionContent MS
RangeCollection msRegionOverflow ...
Mozilla CSS extensions - CSS: Cascading Style Sheets
bullet :-moz-list-number :-moz-loading :-moz-locale-dir(ltr) :-moz-locale-dir(rtl) :-moz-lwtheme :-moz-lwtheme-brighttext :-moz-lwtheme-darktext N - R :-moz-native-anonymous :-moz-only-whitespace ::-moz-page ::-moz-page-sequence ::-moz-pagebreak ::-moz-pagecontent :-moz-placeholderObsolete since Gecko 51 ::-moz-placeholderDeprecated since Gecko 51 ::-moz-progress-bar ::-moz-
range-progress ::-moz-
range-thumb ::-moz-
range-track :-moz-read-only :-moz-read-write S ::-moz-scrolled-canvas ::-moz-scrolled-content ::-moz-scrolled-page-sequence ::-moz-selectionDeprecated since Gecko 62 :-moz-submit-invalid :-moz-suppressed ::-moz-svg-foreign-content T ::-moz-table ::-moz-table-cell ::-moz-table-column ::-moz-table-column-group ::-moz-table-outer ::-moz...
Privacy and the :visited selector - CSS: Cascading Style Sheets
erwise would be able to using rgba(), hsla(), or the transparent keyword. Here is an example of how to use styles with the aforementioned restrictions: :link { outline: 1px dotted blue; background-color: white; /* The default value of background-color is `transparent`. You need to specify a different value, otherwise changes on :visited won't apply. */ } :visited { outline-color: o
range; /* Visited links have an o
range outline */ background-color: green; /* Visited links have a green background */ color: yellow; /* Visited links have yellow colored text */ } Impact on web developers Overall, these restrictions shouldn't affect web developers too significantly. They may, however, require the following changes to existing sites: Using background images to ...
<alpha-value> - CSS: Cascading Style Sheets
The <alpha-value> CSS data type represents a value that can be either a <number> or a <percentage>, specifying the alpha channel or transparency of a color. Syntax The value of an <alpha-value> is given as either a <number> or a <percentage>. If given as a number, the useful
range is 0 (fully transparent) to 1.0 (fully opaque), with decimal values in between; that is, 0.5 indicates that half of the foreground color is used and half of the background color is used. Values outside the
range of 0 to 1 are permitted, but are clamped to like within the
range 0 to 1. If the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. Interpolation When animated, values of the <alpha-value> CSS data type are interpolated as real, floating-point nu...
<basic-shape> - CSS: Cascading Style Sheets
numbers. In all other cases no interpolation occurs. Examples Animated polygon In this example, we use the @keyframes at-rule to animate a clip path between two polygons. Note that both polygons have the same number of vertices, which is necessary for this type of animation to work. ...
border-collapse - CSS: Cascading Style Sheets
ebkit</td></tr> <tr><td class="ch">Chrome</td> <td class="bk">Blink</td></tr> <tr><td class="op">Opera</td> <td class="bk">Blink</td></tr> </tbody> </table> CSS .collapse { border-collapse: collapse; } .separate { border-collapse: separate; } table { display: inline-table; margin: 1em; border: dashed 5px; } table th, table td { border: solid 3px; } .fx { border-color: o
range blue; } .gk { border-color: black red; } .ed { border-color: blue gold; } .tr { border-color: aqua; } .sa { border-color: silver blue; } .wk { border-color: gold blue; } .ch { border-color: red yellow green blue; } .bk { border-color: navy blue teal aqua; } .op { border-color: red; } Result Specifications Specification Status Comment CSS Level 2 (Revision 1)The de...
border-image - CSS: Cascading Style Sheets
value of 81 divided by 3, or 27, for slicing the image into corner and edge regions. To center the border image on the edge of the element's background, we will make the outset values equal to half of the width values. Finally, a repeat value of round will make the border slices fit evenly, i.e., without clipping or gaps. ...
border-spacing - CSS: Cascading Style Sheets
rizontally between a table's cells. Note how, along its outside edges, the table's padding values are added to its border-spacing values. HTML <table> <tr> <td>1</td><td>2</td><td>3</td> </tr> <tr> <td>4</td><td>5</td><td>6</td> </tr> <tr> <td>7</td><td>8</td><td>9</td> </tr> </table> CSS table { border-spacing: 1em .5em; padding: 0 2em 1em 0; border: 1px solid o
range; } td { width: 1.5em; height: 1.5em; background: #d2d2d2; text-align: center; vertical-align: middle; } Result Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of 'border-spacing' in that specification. Recommendation Initial definition. ...
box-decoration-break - CSS: Cascading Style Sheets
element that contains line breaks styled with: .example { background: linear-gradient(to bottom right, yellow, green); box-shadow: 8px 8px 10px 0px deeppink, -5px -5px 5px 0px blue, 5px 5px 15px 0px yellow; padding: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ... <span class="example">The<br>quick<br>o
range fox</span> ... results in: Adding box-decoration-break: clone to the above styles: -webkit-box-decoration-break: clone; box-decoration-break: clone; ... results in: You can try the two inline examples above in your browser. Here's an example of an inline element using a large border-radius value. The second "iM" has a line-break between the "i" and the "M". For comparison, the first "i...
box-shadow - CSS: Cascading Style Sheets
ues are not allowed. If not specified, it will be 0 (the shadow's edge is sharp). The specification does not include an exact algorithm for how the blur radius should be calculated, however, it does elaborate as follows: ...for a long, straight shadow edge, this should create a color transition the length of the blur distance that is perpendicular to and centered on the shadow's edge, and that
ranges from the full shadow color at the radius endpoint inside the shadow to fully transparent at the endpoint outside it. <spread-radius> This is a fourth <length> value. Positive values will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink. If not specified, it will be 0 (the shadow will be the same size as the element). <color> See <color> values for...
cursor - CSS: Cascading Style Sheets
ns-resize nesw-resize nwse-resize Zooming zoom-in Something can be zoomed (magnified) in or out. zoom-out Usage notes Although the specification does not define any size limitations for cursor, individual user agents may choose to do so. Cursor changes using images which are outside the size
range supported by the browser will generally just be ignored. Check the Browser compatibility table for any notes on cursor size limits. Formal definition Initial valueautoApplies toall elementsInheritedyesComputed valueas specified, but with <url> values made absoluteAnimation typediscrete Formal syntax [ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progres...
element() - CSS: Cascading Style Sheets
t also includes text that is rendered as part of the background. <div style="width:400px; height:400px; background:-moz-element(#myBackground1) no-repeat;"> <p>This box uses the element with the #myBackground1 ID as its background!</p> </div> <div style="overflow:hidden; height:0;"> <div id="myBackground1" style="width:1024px; height:1024px; background-image: linear-gradient(to right, red, o
range, yellow, white);"> <p style="transform-origin:0 0; transform: rotate(45deg); color:white;">This text is part of the background. Cool, huh?</p> </div> </div> The <div> element with the ID "myBackground1" is used as the background for the content including the paragraph "This box uses the element with the #myBackground1 ID as its background!". A somewhat more bizarre example This example u...
<filter-function> - CSS: Cascading Style Sheets
select id="filter-select"> <option selected>blur</option> <option>brightness</option> <option>contrast</option> <option>drop-shadow</option> <option>grayscale</option> <option>hue-rotate</option> <option>invert</option> <option>opacity</option> <option>saturate</option> <option>sepia</option> </select> </li> <li> <input type="
range"><output></output> </li> <li> <p>Current value: <code></code></p> </li> </ul> CSS div { width: 300px; height: 300px; background: url(https://media.prod.mdn.mozit.cloud/attachments/2020/07/29/17350/3b4892b7e820122ac6dd7678891d4507/firefox.png) no-repeat center; } li { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; } input { width: 60...
flex-wrap - CSS: Cascading Style Sheets
:wrap-reverse </h4> <div class="content2"> <div class="red">1</div> <div class="green">2</div> <div class="blue">3</div> </div> CSS /* Common Styles */ .content, .content1, .content2 { color: #fff; font: 100 24px/100px sans-serif; height: 150px; text-align: center; } .content div, .content1 div, .content2 div { height: 50%; width: 300px; } .red { background: o
rangered; } .green { background: yellowgreen; } .blue { background: steelblue; } /* Flexbox Styles */ .content { display: flex; flex-wrap: wrap; } .content1 { display: flex; flex-wrap: nowrap; } .content2 { display: flex; flex-wrap: wrap-reverse; } Results Specifications Specification Status Comment CSS Flexible Box Layout ModuleThe d...
font-feature-settings - CSS: Cascading Style Sheets
ldn't be used to enable small caps. Values normal Text is laid out using default settings. <feature-tag-value> When rendering text, the list of OpenType feature tag value is passed to the text layout engine to enable or disable font features. The tag is always a <string> of 4 ASCII characters. If it has more or less characters, or if it contains characters outside the U+20 - U+7E codepoint
range, the whole property is invalid. The value is a positive integer. The two keywords on and off are synonyms for 1 and 0 respectively. If no value is set, the default is 1. For non-Boolean OpenType features (e.g. stylistic alternates), the value implies a particular glyph to be selected; for Boolean values, it is a switch. Formal definition Initial valuenormalApplies toall elements. It also appl...
font-stretch - CSS: Cascading Style Sheets
League Mono Variable Helvetica Neue, which is installed by default on macOS, has a single condensed face in addition to the normal face. All values of font-stretch less than 100% select the condensed face, while all other values select the normal face. League Mono Variable is a variable font that offers something like a continuous
range of widths for different percentage values of font-stretch. Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typea font stretch Formal syntax <font-stretch-absolute>where <font-stretch-absolute> = normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded...
font-style - CSS: Cascading Style Sheets
pe or OpenType variable fonts, the "slnt" variation is used to implement varying slant angles for oblique, and the "ital" variation with a value of 1 is used to implement italic values. See font-variation-settings. For the example below to work, you'll need a browser that supports the CSS Fonts Level 4 syntax in which font-style: oblique can accept an <angle>. ...
<gradient> - CSS: Cascading Style Sheets
des of gray from appearing when both the color and the opacity are changing. (Be aware that older browsers may not use this behavior when using the transparent keyword.) Examples Linear gradient example A simple linear gradient. <div class="linear-gradient">Linear gradient</div> div { width: 240px; height: 80px; } .linear-gradient { background: linear-gradient(to right, red, o
range, yellow, green, blue, indigo, violet); } Radial gradient example A simple radial gradient. <div class="radial-gradient">Radial gradient</div> div { width: 240px; height: 80px; } .radial-gradient { background: radial-gradient(red, yellow, rgb(30, 144, 255)); } Repeating gradient examples Simple repeating linear and radial gradient examples. <div class="linear-repeat">Repeati...
grid-template-columns - CSS: Cascading Style Sheets
e a minmax() notation, it implies an automatic minimum (i.e. minmax(auto, <flex>)). max-content Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track. min-content Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) Is a functional notation that defines a size
range greater than or equal to min and less than or equal to max. If max is smaller than min, then max is ignored and the function is treated as min. As a maximum, a <flex> value sets the track's flex factor. It is invalid as a minimum. auto Is a keyword that is identical to maximal content if it's a maximum. As a minimum it represents the largest minimum size (as specified by min-width/min-height) o...
grid-template-rows - CSS: Cascading Style Sheets
ide a minmax() notation, it implies an automatic minimum (i.e. minmax(auto, <flex>)). max-content Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track. min-content Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) Is a functional notation that defines a size
range, greater than or equal to min, and less than or equal to max. If max is smaller than min, then max is ignored and the function is treated as min. As a maximum, a <flex> value sets the track's flex factor. It is invalid as a minimum. auto Is a keyword that is identical to maximal content if it's a maximum. As a minimum it represents the largest minimum size (as specified by min-width/min-height)...
<length> - CSS: Cascading Style Sheets
ht: 50px; background-color: #eee; position: relative; } .inner { height: 50px; background-color: #999; box-shadow: inset 3px 3px 5px rgba(255,255,255,0.5), inset -3px -3px 5px rgba(0,0,0,0.5); } .result { height: 20px; background-color: #999; box-shadow: inset 3px 3px 5px rgba(255,255,255,0.5), inset -3px -3px 5px rgba(0,0,0,0.5); background-color: o
range; display: flex; align-items: center; margin-top: 10px; } .result code { position: absolute; margin-left: 20px; } .results { margin-top: 10px; } .input-container { position: absolute; display: flex; justify-content: flex-start; align-items: center; height: 50px; } label { margin: 0 10px 0 20px; } JavaScript const inputDiv = document.querySelector('.inner'); const inpu...
minmax() - CSS: Cascading Style Sheets
It is used with CSS Grids. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
page-break-inside - CSS: Cascading Style Sheets
graph, it contains more text.</p> <p>This is the fourth paragraph. It has a little bit more text than the third one.</p> </div> CSS .page { background-color: #8cffa0; height: 90px; width: 200px; columns: 1; column-width: 100px; } .list, ol, ul, p { break-inside: avoid; } p { background-color: #8ca0ff; } ol, ul, .list { margin: 0.5em 0; display: block; background-color: o
range; } p:first-child { margin-top: 0; } Result Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of 'page-break-inside' in that specification. Working Draft Allows this property on more elements. CSS Level 2 (Revision 1)The definition of 'page-break-inside' in that specification. Recommendation Initial def...
repeating-conic-gradient() - CSS: Cascading Style Sheets
last respectively, the gradient will repeat based on that value. For example, if you don't declare an angle for the first color, and declare 10% on the last color stop, the arc will repeat 10 times. Rather, the starting point is the first color stop declared, and the last color stop is the last color stop angle declared.. The following two gradients are equivalent repeating-conic-gradient(red, o
range, yellow, green, blue 50%); repeating-conic-gradient(from -45deg, red 45deg, o
range, yellow, green, blue 225deg) By default, colors transition smoothly from the color at one color stop to the color at the subsequent color stop, with the midpoint between the colors being the half way point between the color transition. You can move this color transition midpoint to any point between two color stop...
text-combine-upright - CSS: Cascading Style Sheets
ch that they take up the space of a single character within the vertical line of the box. digits <integer>? Attempts to display a sequence of consecutive ASCII digits (U+0030-U+0039) that has as many or fewer characters than the specified integer, such that it takes up the space of a single character within the vertical line box. If the integer is omitted, it computes to 2. Integers outside the
range of 2-4 are invalid. Formal definition Initial valuenoneApplies tonon-replaced inline elementsInheritedyesComputed valuespecified keyword, plus integer if 'digits'Animation typediscrete Formal syntax none | all | [ digits <integer>? ] Examples Digits The digits value requires less markup than the all value when digits are being combined, but it is currently not very widely supported by bro...
scale() - CSS: Cascading Style Sheets
ales. Its result is a <transform-function> data type. This scaling transformation is characterized by a two-dimensional vector. Its coordinates define how much scaling is done in each direction. If both coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). When a coordinate value is outside the [-1, 1]
range, the element grows along that dimension; when inside, it shrinks. If it is negative, the result a point reflection in that dimension. A value of 1 has no effect. Note: The scale() function only scales in 2D. To scale in 3D, use scale3d() instead. Syntax The scale() function is specified with either one or two values, which represent the amount of scaling to be applied in each direction. scale...
scale3d() - CSS: Cascading Style Sheets
interactive-examples and send us a pull request. This scaling transformation is characterized by a three-dimensional vector. Its coordinates define how much scaling is done in each direction. If all three coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). When a coordinate value is outside the [-1, 1]
range, the element grows along that dimension; when inside, it shrinks. If it is negative, the result a point reflection in that dimension. A value of 1 has no effect. Syntax The scale3d() function is specified with three values, which represent the amount of scaling to be applied in each direction. scale3d(sx, sy, sz) Values sx Is a <number> representing the abscissa of the scaling vector. s...
Event reference
d or released. pointerlockerror Event Pointer Lock It was impossible to lock the pointer for technical reasons or because the permission was denied. pointermove PointerEvent Pointer Events The pointer changed coordinates. pointerout PointerEvent Pointer Events The pointing device moves out of the hit-testing boundary or leaves detectable hover
range. pointerover PointerEvent Pointer Events The pointing device is moved into the hit-testing boundary. pointerup PointerEvent Pointer Events The pointer leaves the active button state. play Event HTML5 media Playback has begun. playing Event HTML5 media Playback is ready to start after having been paused or delayed due to lack ...
Rich-Text Editing in Mozilla - Developer guides
oContent = document.createTextNode(oDoc.innerHTML); oDoc.innerHTML = ""; var oPre = document.createElement("pre"); oDoc.contentEditable = false; oPre.id = "sourceText"; oPre.contentEditable = true; oPre.appendChild(oContent); oDoc.appendChild(oPre); } else { if (document.all) { oDoc.innerHTML = oDoc.innerText; } else { oContent = document.create
Range(); oContent.selectNodeContents(oDoc.firstChild); oDoc.innerHTML = oContent.toString(); } oDoc.contentEditable = true; } oDoc.focus(); } function printDoc() { if (!validateMode()) { return; } var oPrntWin = window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes"); oPrntWin.document.open(); oPrntWin.document.
Making content editable - Developer guides
HTML = ""; var oPre = document.createElement("pre"); oDoc.contentEditable = false; oPre.id = "sourceText"; oPre.contentEditable = true; oPre.appendChild(oContent); oDoc.appendChild(oPre); document.execCommand("defaultParagraphSeparator", false, "div"); } else { if (document.all) { oDoc.innerHTML = oDoc.innerText; } else { oContent = document.create
Range(); oContent.selectNodeContents(oDoc.firstChild); oDoc.innerHTML = oContent.toString(); } oDoc.contentEditable = true; } oDoc.focus(); } function printDoc() { if (!validateMode()) { return; } var oPrntWin = window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes"); oPrntWin.document.open(); oPrntWin.document.
HTML5 - Developer guides
allowing you to describe more precisely what your content is. Connectivity: allowing you to communicate with the server in new and innovative ways. Offline and storage: allowing webpages to store data on the client-side locally and operate offline more efficiently. Multimedia: making video and audio first-class citizens in the Open Web. 2D/3D graphics and effects: allowing a much more diverse
range of presentation options. Performance and integration: providing greater speed optimization and better usage of computer hardware. Device access: allowing for the usage of various input and output devices. Styling: letting authors write more sophisticated themes. Semantics Sections and outlines in HTML5 A look at the new outlining and sectioning elements in HTML5: <section>, <article>, ...
Index - Developer guides
d more generally TV and Radio programmes that are output live. Often shortened to just streaming, live streaming is the process of transmitting media 'live' to computers and devices. This is a fairly complex and nascent subject with a lot of variables, so in this article, we'll introduce you to the subject and let you know how you can get started. 11 Media buffering, seeking, and time
ranges Apps, Buffer, HTML5, Time
Ranges, Video, buffering, seeking Sometimes it's useful to know how much <audio> or <video> has downloaded or is playable without delay -- a good example of this is the buffered progress bar of an audio or video player. This article discusses how to build a buffer/seek bar using Time
Ranges, and other features of the media API. 12 Setting up adaptive ...
Introduction to Web development - Developer guides
feature support across different browsers and known browser bugs. HTMLDog An excellent and comprehensive reference site on HTML and CSS for beginners. Google's HTML, CSS, and Javascript from the Ground Up These easily digestible video tutorials from Google's expert web developers cover the basics of HTML, CSS and JavaScript. CSSTutorial.net Beginner Tutorials A broad
range of useful text and video tutorials that cover the basics through to intermediate aspects of CSS. Tizag CSS Tutorials An easy-to-follow reference for those wishing to learn CSS through short, concise tutorials. jQuery Fundamentals An open-source reference book featuring detailed introductions to both JavaScript and JQuery for beginners. JavaScript From Null: A Video Series...
A hybrid approach - Developer guides
rating server-side techniques. For example, an often-criticized point about responsive web design is that full-resolution images are sent to all devices, including phones that show the images scaled down anyway. One such technique for dealing with this issue uses server-side user-agent detection along with the WURFL device capability library to send a properly sized image for the user's device. A
range of products are also emerging which provide this as a service. Of course, this technique suffers from all the downsides associated with user-agent detection. But even if it does not work, it is no worse with respect to performance than only using fluid images. By combining the techniques listed above, we can get a mobile web development strategy that is both more flexible than pure separate site...
Mobile-friendliness - Developer guides
What is Mobile Friendliness? Mobile friendliness can mean a multitude of things, depending on who you're talking to. It can be helpful to think of it in terms of three goals for improving your site's user experience: Presentation, Content, and Performance. Goal #1 (Presentation) "Make websites that work well on a variety of screen sizes." These days, users can access the web on devices in a wide
range of form factors, including phones, tablets, and eReaders. Needless to say, a fixed-width, three-column layout filled with complex JavaScript animations and mouse-over effects is not going to look or feel quite right on a phone with a 2-inch-wide screen and a diminutive processor. A slimmed-down, linearized page layout with elements sized for a touchscreen would be much more appropriate. That's wh...
Separate sites for mobile and desktop - Developer guides
options presented here. Finally, it also allows for completely different user experiences on desktop and mobile -- they're two different sites, after all! The bad Unfortunately, this approach is not without its drawbacks. For starters, you are now maintaining two different pages for every page on your site that you would like to expose to mobile users. If you are using a CMS, it is possible to ar
range your site templates in a way that minimizes this duplication. However any time that there is a difference between the mobile and desktop templates, there is a potential source of complication in your code. Similarly, this increases the implementation time of any new site features, since you must now code two sets of front-end logic. Even more important than that, though, is the fact that user-age...
The Unicode Bidirectional Text Algorithm - Developer guides
determining the order and directionality of text during rendering. Fundamentals (base direction, character types, etc) The algorithm Character level directionality Directional runs (what they are, how base direction applies) Handling neutral characters Overriding the algorithm Content about using HTML and CSS to override the default behavior of the algorithm; include info about isolating
ranges etc. Overiding BiDi using Unicode control characters Unicode provides a number of special control characters that make it possible to control directionality of
ranges of text. There are two sets of control characters; one set opens the override, and another restores the original directionality. You must always follow each opening character with an appropriate closing character. Initial Unic...
The HTML autocomplete attribute - HTML: Hypertext Markup Language
r your credit card number</label> <input name="cc-number" id="cc-number" autocomplete="off"> </div> Administrative levels in addresses The four administrative level fields (address-level1 through address-level4) describe the address in terms of increasing levels of precision within the country in which the address is located. Each country has its own system of administrative levels, and may ar
range the levels in different orders when addresses are written. address-level1 always represents the broadest administrative division; it is the least-specific portion of the address short of the country name. Form layout flexibility Given that different countries write their address in different ways, with each field in different places within the address, and even different sets and numbers of fi...
HTML attribute: multiple - HTML: Hypertext Markup Language
height: auto; } */ There are a few ways to select multiple options in a <select> element with a multiple attribute. Depending on the operating system, mouse users can hold the Ctrl, Command, or Shift keys and then click multiple options to select/deselect them. Keyboard users can select multiple contiguous items by focusing on the <select> element, selecting an item at the top or bottom of the
range they want to select using the Up and Down cursor keys to go up and down the options. The selection of non-contiguous is not as well supported: items should be able to be selected and deselected by pressing Space , but support varies between browsers. Specifications Specification Status Comment HTML Living StandardThe definition of 'multiple attribute' in that specifi...
HTML attribute: readonly - HTML: Hypertext Markup Language
rea> form control elements. If present on any of these input types and elements, the :read-only pseudo class will match. If the attribute is not included, the :read-write pseudo class will match. The attribute is not supported or relevant to <select> or input types that are already not mutable, such as checkbox and radio or cannot, by definition, start with a value, such as the file input type.
range and color, as both have default values. It is also not supported on hidden as it can not be expected that a user to fill out a form that is hidden. Nor is it supported on any of the button types, including image. Note: Only text controls can be made read-only, since for other controls (such as checkboxes and buttons) there is no useful distinction between being read-only and being disabled, so ...
DASH Adaptive Streaming for HTML 5 Video - HTML: Hypertext Markup Language
ou should have one for each file. The -adaptation_sets argument assigns them into adaptation sets; for example, this creates one set (0) that contains the streams 0, 1, 2 and 3 (the videos), and another set (1) that contains only stream 4, the audio stream. Put the manifest and the associated video files on your web server or CDN. DASH works via HTTP, so as long as your HTTP server supports byte
range requests, and it's set up to serve .mpd files with mimetype="application/dash+xml", then you're all set. Using DASH - Client Side You'll want to modify your web page to point to the DASH manifest first, instead of directly to a particular video file: <video> <source src="movie.mpd"> <source src="movie.webm"> Your browser does not support the video tag. </video> That's it! If DASH is sup...
<basefont> - HTML: Hypertext Markup Language
ribute contains a list of one or more font names. The document text in the default style is rendered in the first font face that the client's browser supports. If no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size This attribute specifies the font size as either a numeric or relative value. Numeric values
range from 1 to 7 with 1 being the smallest and 3 the default. Usage notes Do not use this element! Though once (imprecisely) normalized in HTML 3.2, it wasn't supported in all major browsers. Further, browsers, and even successive versions of browsers, never implemented it in the same way: practically, using it has always brought indeterminate results. The <basefont> element was deprecated in the ...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
cally inserts some text and doesn't know the directionality of the text being inserted. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Bidirectional text is text that may contain both sequences of characters that are ar
ranged left-to-right (LTR) and sequences of characters that are ar
ranged right-to-left (RTL), such as an Arabic quotation embedded in an English string. Browsers implement the Unicode Bidirectional Algorithm to handle this. In this algorithm, characters are given an implicit directionality: for example, Latin characters are treated as LTR while Arabic characters are treated as RTL. Some other character...
<del>: The Deleted Text element - HTML: Hypertext Markup Language
This can be used when rendering "track changes" or source code diff information, for example. The <ins> element can be used for the opposite purpose: to indicate text that has been added to the document. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This element is often (but need not be) rendered by applying a strike-through style to the text. Content categories Phrasing content or flow content. Permitted content Transparent. ...
<font> - HTML: Hypertext Markup Language
a comma-separated list of one or more font names. The document text in the default style is rendered in the first font face that the client's browser supports. If no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size This attribute specifies the font size as either a numeric or relative value. Numeric values
range from 1 to 7 with 1 being the smallest and 3 the default. It can be defined using a relative value, like +2 or -3, which set it relative to the value of the size attribute of the <basefont> element, or relative to 3, the default value, if none does exist. DOM interface This element implements the HTMLFontElement interface. ...
<input type="search"> - HTML: Hypertext Markup Language
roject, please clone https://github.com/mdn/interactive-examples and send us a pull request. Value A DOMString representing the value contained in the search field. Events change and input Supported Common Attributes autocomplete, list, maxlength, minlength, pattern, placeholder, required, size. IDL attributes value Methods select(), set
RangeText(), setSelection
Range(). Value The value attribute contains a DOMString representing the value contained in the search field. You can retrieve this using the HTMLInputElement.value property in JavaScript. searchTerms = mySearch.value; If no validation constraints are in place for the input (see Validation for more details), the value can be any text string or an empty string (""). ...
<input type="tel"> - HTML: Hypertext Markup Language
all back to being a standard text input. Value A DOMString representing a telephone number, or empty Events change and input Supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, and size IDL attributes list, selectionStart, selectionEnd, selectionDirection, and value Methods select(), set
RangeText(), setSelection
Range() Value The <input> element's value attribute contains a DOMString that either represents a telephone number or is an empty string (""). Additional attributes In addition to the attributes that operate on all <input> elements regardless of their type, telephone number inputs support the following attributes: Attribute Description list ...
<input type="text"> - HTML: Hypertext Markup Language
clone https://github.com/mdn/interactive-examples and send us a pull request. Value A DOMString representing the text contained in the text field. Events change and input Supported Common Attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size IDL attributes list, value Methods select(), set
RangeText() and setSelection
Range(). Value The value attribute is a DOMString that contains the current value of the text entered into the text field. You can retrieve this using the value property in JavaScript. let theText = myTextInput.value; If no validation constraints are in place for the input (see Validation for more details), the value may be an empty string (""). Additional attrib...
<input type="url"> - HTML: Hypertext Markup Language
type url, a url input falls back to being a standard text input. Value A DOMString representing a URL, or empty Events change and input Supported Common Attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size IDL attributes list, value, selectionEnd, selectionDirection Methods select(), set
RangeText() and setSelection
Range(). Value The <input> element's value attribute contains a DOMString which is automatically validated as conforming to URL syntax. More specifically, there are two possible value formats that will pass validation: An empty string ("") indicating that the user did not enter a value or that the value was removed. A single properly-formed absolute URL. This doe...
<input type="week"> - HTML: Hypertext Markup Language
hey are incremented or decremented, however it doesn't seem to have any effect on supporting browsers. Validation By default, <input type="week"> does not apply any validation to entered values. The UI implementations generally don't let you specify anything that isn't a valid week/year, which is helpful, but it's still possible to submit with the field empty, and you might want to restrict the
range of choosable weeks. Setting maximum and minimum weeks You can use the min and max attributes to restrict the valid weeks that can be chosen by the user. In the following example we are setting a minimum value of Week 01, 2017 and a maximum value of Week 52, 2017: <form> <label for="week">What week would you like to start?</label> <input id="week" type="week" name="week" min="2017-...
<ins> - HTML: Hypertext Markup Language
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Phrasing content or flow content. Permitted content Transparent. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. ...
<select>: The HTML Select element - HTML: Hypertext Markup Language
currently only seems to work in Firefox. Also note: On macOS, the Ctrl + Up and Ctrl + Down shortcuts conflict with the OS default shortcuts for Mission Control and Application windows, so you'll have to turn these off before it will work. Keyboard users can select multiple contiguous items by: Focusing on the <select> element (e.g. using Tab). Selecting an item at the top or bottom of the
range they want to select using the Up and Down cursor keys to go up and down the options. Holding down the Shift key and then using the Up and Down cursor keys to increase or decrease the
range of items selected. Keyboard users can select multiple non-contiguous items by: Focusing on the <select> element (e.g. using Tab). Holding down the Ctrl key then using the Up and Down cursor keys to chang...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element. It is an empty element, meaning that it has no content and does not have a closing tag. It is commonly used to offer the same media content in multiple file formats in order to provide compatibility with a broad
range of browsers given their differing support for image file formats and media file formats. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None. Permitted content None, it is an empty element. Tag omission It must have a start ...
<table>: The Table element - HTML: Hypertext Markup Language
tr> <td>USA</td> <td>Washington, D.C.</td> <td>309 million</td> <td>English</td> </tr> <tr> <td>Sweden</td> <td>Stockholm</td> <td>9 million</td> <td>Swedish</td> </tr> </table> <p>Table with colgroup and col</p> <table> <colgroup> <col style="background-color: #0f0"> <col span="2"> </colgroup> <tr> <th>Lime</th> <th>Lemon</th> <th>O
range</th> </tr> <tr> <td>Green</td> <td>Yellow</td> <td>O
range</td> </tr> </table> <p>Simple table with caption</p> <table> <caption>Awesome caption</caption> <tr> <td>Awesome data</td> </tr> </table> table { border-collapse: collapse; border-spacing: 0px; } table, th, td { padding: 5px; border: 1px solid black; } Accessibility concerns Captions By supplying a <ca...
Connection management in HTTP/1.x - HTTP
g Connection to anything other than close, usually retry-after, will make them persistent. In HTTP/1.1, persistence is the default, and the header is no longer needed (but it is often added as a defensive measure against cases requiring a fallback to HTTP/1.0). HTTP pipelining HTTP pipelining is not activated by default in modern browsers: Buggy proxies are still common and these lead to st
range and erratic behaviors that Web developers cannot foresee and diagnose easily. Pipelining is complex to implement correctly: the size of the resource being transferred, the effective RTT that will be used, as well as the effective bandwidth, have a direct incidence on the improvement provided by the pipeline. Without knowing these, important messages may be delayed behind unimportant ones. The no...
Cache-Control - HTTP
fied-Since) to check for updates, even when the user explicitly refreshes the page. Clients that aren't aware of this extension must ignore them as per the HTTP specification. In Firefox, immutable is only honored on https:// transactions. For more information, see also this blog post. Other no-transform An intermediate cache or proxy cannot edit the response body, Content-Encoding, Content-
Range, or Content-Type. It therefore forbids a proxy or browser feature, such as Google's Web Light, from converting images to minimize data for a cache store or slow connection. only-if-cached Set by the client to indicate "do not use the network" for the response. The cache should either respond using a stored response, or respond with a 504 status code. Conditional headers such as If-None-Match sh...
Content-Language - HTTP
iple language tags are separated by comma. Each language tag is a sequence of one or more case-insensitive subtags, each separated by a hyphen character ("-", %x2D). In most cases, a language tag consists of a primary language subtag that identifies a broad family of related languages (e.g., "en" = English), which is optionally followed by a series of subtags that refine or narrow that language's
range (e.g., "en-CA" = the variety of English as communicated in Canada). Note: Language tags are formaly defined in RFC 5646, which rely on the ISO 639 standard (quite often the ISO 639-1 code list) for language codes to be used. Examples Indicating the language a document is written in The global lang attribute is used on HTML elements to indicate the language of an entire HTML document or par...
Content-Type - HTTP
---------------------------974767299852498929531610575 Content-Disposition: form-data; name="myFile"; filename="foo.txt" Content-Type: text/plain (content of the uploaded file foo.txt) -----------------------------974767299852498929531610575-- Specifications Specification Title RFC 7233, section 4.1: Content-Type in multipart Hypertext Transfer Protocol (HTTP/1.1):
Range Requests RFC 7231, section 3.1.1.5: Content-Type Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content ...
Digest - HTTP
Content-Encoding header values: so a single resource may have multiple different digest values. The digest is calculated over the entire representation. The representation itself may be: fully contained in the response message body not at all contained in the message body (for example, in a response to a HEAD request) partially contained in the message body (for example, in a response to a
range request). Header type Response header Forbidden header name no Syntax Digest: <digest-algorithm>=<digest-value> Digest: <digest-algorithm>=<digest-value>,<digest-algorithm>=<digest-value> Directives <digest-algorithm> Supported digest algorithms are defined in RFC 3230 and RFC 5843, and include SHA-256 and SHA-512. Some of the supported algorithms, includi...
ETag - HTTP
e-sensitive) indicates that a weak validator is used. Weak etags are easy to generate, but are far less useful for comparisons. Strong validators are ideal for comparisons but can be very difficult to generate efficiently. Weak ETag values of two representations of the same resources might be semantically equivalent, but not byte-for-byte identical. This means weak etags prevent caching when byte
range requests are used, but strong etags mean
range requests can still be cached. "<etag_value>" Entity tag uniquely representing the requested resource. They are a string of ASCII characters placed between double quotes, like "675af34563dc-tr34". The method by which ETag values are generated is not specified. Often, a hash of the content, a hash of the last modification timestamp, or just a revisio...
If-Match - HTTP
methods, it will only upload the resource in this case. The comparison with the stored ETag uses the strong comparison algorithm, meaning two files are considered identical byte to byte only. If a listed ETag has the W/ prefix indicating a weak entity tag, it will never match under this comparison algorithm. There are two common use cases: For GET and HEAD methods, used in combination with a
Range header, it can guarantee that the new
ranges requested comes from the same resource than the previous one. If it doesn't match, then a 416 (
Range Not Satisfiable) response is returned. For other methods, and in particular for PUT, If-Match can be used to prevent the lost update problem. It can check if the modification of a resource that the user wants to upload will not override another change ...
If-Unmodified-Since - HTTP
ource has been modified after the given date, the response will be a 412 (Precondition Failed) error. There are two common use cases: In conjunction with non-safe methods, like POST, it can be used to implement an optimistic concurrency control, like done by some wikis: editions are rejected if the stored document has been modified since the original has been retrieved. In conjunction with a
range request with a If-
Range header, it can be used to ensure that the new fragment requested comes from an unmodified document. Header type Request header Forbidden header name no Syntax If-Unmodified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT Directives <day-name> One of "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", or "Sun" (case-sensiti...
Server - HTTP
of the software or product that handled the request. Usually in a format similar to User-Agent. How much detail to include is an interesting balance to strike; exposing the OS version is probably a bad idea, as mentioned in the earlier warning about overly-detailed values. However, exposed Apache versions helped browsers work around a bug those versions had with Content-Encoding combined with
Range. Examples Server: Apache/2.4.1 (Unix) Specifications Specification Title RFC 7231, section 7.4.2: Server Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content ...
Trailer - HTTP
l be present in the trailer part of chunked messages. These header fields are disallowed: message framing headers (e.g., Transfer-Encoding and Content-Length), routing headers (e.g., Host), request modifiers (e.g., controls and conditionals, like Cache-Control, Max-Forwards, or TE), authentication headers (e.g., Authorization or Set-Cookie), or Content-Encoding, Content-Type, Content-
Range, and Trailer itself. Examples Chunked transfer encoding using a trailing header In this example, the Expires header is used at the end of the chunked message and serves as a trailing header. HTTP/1.1 200 OK Content-Type: text/plain Transfer-Encoding: chunked Trailer: Expires 7\r\n Mozilla\r\n 9\r\n Developer\r\n 7\r\n Network\r\n 0\r\n Expires: Wed, 21 Oct 2015 07:28:00 GMT\r\n \r\n S...
Link prefetching FAQ - HTTP
and all its "child" frames finish loading. What happens if I click on a link while something is being prefetched? When the user clicks on a link, or initiates any kind of page load, link prefetching will stop and any prefetch hints will be discarded. If a prefetched document is partially downloaded, then the partial document will still be stored in the cache provided the server sent an "Accept-
Ranges: bytes" response header. This header is typically generated by webservers when serving up static content. When the user visits a prefetched document for real, the remaining portion of the document will be fetched using a HTTP byte-
range request. What if I'm downloading something in the background? Will link prefetching compete for bandwidth? Yes and no. If you are downloading something using M...
HTTP Messages - HTTP
ructure as any other header: a case-insensitive string followed by a colon (':') and a value whose structure depends upon the type of the header. The whole header, including its value, presents as a single line. There are numerous response headers available. These can be divided into several groups: General headers, like Via, apply to the whole message. Response headers, like Vary and Accept-
Ranges, give additional information about the server which doesn't fit in the status line. Entity headers, like Content-Length, apply to the body of the response. Typically, no such headers are transmitted when there is no body in the response. Body The last part of a response is the body. Not all responses have one: responses with a status code that sufficiently answers the request without the n...
An overview of HTTP - HTTP
messages are encapsulated in frames, making them impossible to read directly, but the principle remains the same. For example: GET / HTTP/1.1 Host: developer.mozilla.org Accept-Language: fr Read the response sent by the server, such as: HTTP/1.1 200 OK Date: Sat, 09 Oct 2010 14:28:02 GMT Server: Apache Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT ETag: "51142bc1-7449-479b075b2891b" Accept-
Ranges: bytes Content-Length: 29769 Content-Type: text/html <!DOCTYPE html... (here comes the 29769 bytes of the requested web page) Close or reuse the connection for further requests. If HTTP pipelining is activated, several requests can be sent without waiting for the first response to be fully received. HTTP pipelining has proven difficult to implement in existing networks, where old pieces of...
HTTP resources and specifications - HTTP
Title Status RFC 7230 Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing Proposed Standard RFC 7231 Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content Proposed Standard RFC 7232 Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests Proposed Standard RFC 7233 Hypertext Transfer Protocol (HTTP/1.1):
Range Requests Proposed Standard RFC 7234 Hypertext Transfer Protocol (HTTP/1.1): Caching Proposed Standard RFC 5861 HTTP Cache-Control Extensions for Stale Content Informational RFC 8246 HTTP Immutable Responses Proposed Standard RFC 7235 Hypertext Transfer Protocol (HTTP/1.1): Authentication Proposed Standard RFC 6265 HTTP Sta...
A typical HTTP session - HTTP
(contains a site-customized page helping the user to find the missing resource) Notification that the requested resource doesn't exist: HTTP/1.1 404 Not Found Content-Type: text/html; charset=utf-8 Content-...
Expressions and operators - JavaScript
lowing ways: typeof operand typeof (operand) The typeof operator returns a string indicating the type of the unevaluated operand. operand is the string, variable, keyword, or object for which the type is to be returned. The parentheses are optional. ...
Functions - JavaScript
tenate. The function is defined as follows: function myConcat(separator) { var result = ''; // initialize list var i; // iterate through arguments for (i = 1; i < arguments.length; i++) { result += arguments[i] + separator; } return result; } You can pass any number of arguments to this function, and it concatenates each argument into a string "list": // returns "red, o
range, blue, " myConcat(', ', 'red', 'o
range', 'blue'); // returns "elephant; giraffe; lion; cheetah; " myConcat('; ', 'elephant', 'giraffe', 'lion', 'cheetah'); // returns "sage. basil. oregano. pepper. parsley. " myConcat('. ', 'sage', 'basil', 'oregano', 'pepper', 'parsley'); Note: The arguments variable is "array-like", but not an array. It is array-like in that it has a numbered index and a l...
Character classes - JavaScript
rtingWithA = /\b[aA]\w+/g; // \b indicates a boundary (i.e. do not start matching in the middle of a word) // [aA] indicates the letter a or A // \w+ indicates any character *from the latin alphabet*, multiple times console.table(aliceExcerpt.match(regexpWordStartingWithA)); // ['Ada', 'and', 'at', 'all'] Looking for a word (from Unicode characters) Instead of the Latin alphabet, we can use a
range of Unicode characters to identify a word (thus being able to deal with text in other languages like Russian or Arabic). The "Basic Multilingual Plane" of Unicode contains most of the characters used around the world and we can use character classes and
ranges to match words written with those characters. var nonEnglishText = "??????????? ????? ? ?????? ?????"; var regexpBMPWord = /([\u0000-\u001...
Unicode property escapes - JavaScript
and especially \w or \d to match letters or digits. However, such forms only match characters from the Latin script (in other words, a to z and A to Z for \w and 0 to 9 for \d). As shown in this example, it might be a bit clumsy to work with non Latin texts. Unicode property escapes categories encompass much more characters and \p{Letter} or \p{Number} will work for any script. ...
JavaScript technologies overview - JavaScript
s to manipulate this abstraction. Among the things defined by the DOM, we can find: The document structure, a tree model, and the DOM Event architecture in DOM core: Node, Element, DocumentFragment, Document, DOMImplementation, Event, EventTarget, ... A less rigorous definition of the DOM Event Architecture, as well as specific events in DOM events. Other things such as DOM Traversal and DOM
Range. From the ECMAScript point of view, objects defined in the DOM specification are called "host objects". HTML DOM HTML, the Web's markup language, is specified in terms of the DOM. Layered above the abstract concepts defined in DOM Core, HTML also defines the meaning of elements. The HTML DOM includes such things as the className property on HTML elements, or APIs such as document.body. The H...
Memory Management - JavaScript
calls Some function calls result in object allocation. var d = new Date(); // allocates a Date object var e = document.createElement('div'); // allocates a DOM element Some methods allocate new values or objects: var s = 'azerty'; var s2 = s.substr(0, 3); // s2 is a new string // Since strings are immutable values, // JavaScript may decide to not allocate memory, // but just store the [0, 3]
range. var a = ['ouais ouais', 'nan nan']; var a2 = ['generation', 'nan nan']; var a3 = a.concat(a2); // new array with 4 elements being // the concatenation of a and a2 elements. Using values Using values basically means reading and writing in allocated memory. This can be done by reading or writing the value of a variable or an object property or even passing an argument to a function. Release w...
SyntaxError: Malformed formal parameter - JavaScript
list. The argument list is invalid somehow. Perhaps you accidentally picked a keyword like if or var as an argument name, or perhaps there's some stray punctuation in your argument list. Or maybe you accidentally passed an invalid value, like a number or object. OK, that fixed my problem. But why didn't you say that in the first place? Admittedly the wording in the error message is slightly st
range. "Formal parameter" is a fancy way of saying "function argument". And we use the word "malformed" because all Firefox engineers are huge fans of 19th-century Gothic horror novels. Examples Invalid cases var f = Function('x y', 'return x + y;'); // SyntaxError (missing a comma) var f = Function('x,', 'return x;'); // SyntaxError (extraneous comma) var f = Function(37, "alert('OK')"); // Synta...
arguments.callee - JavaScript
ates a large number of guards: function f(a, b, c, d, e) { return a ? b * c : d * e; } If the JavaScript interpreter cannot guarantee that all the provided arguments are numbers at the point that the call is made, it needs to either insert checks for all the arguments before the inlined code, or it cannot inline the function. Now in this particular case a smart interpreter should be able to rear
range the checks to be more optimal and not check any values that would not be used. However in many cases that's just not possible and therefore it becomes impossible to inline. Examples Using arguments.callee in an anonymous recursive function A recursive function must be able to refer to itself. Typically, a function refers to itself by its name. However, an anonymous function (which can be creat...
The arguments object - JavaScript
catenates several strings. The function's only formal argument is a string containing the characters that separate the items to concatenate. function myConcat(separator) { let args = Array.prototype.slice.call(arguments, 1); return args.join(separator); } You can pass as many arguments as you like to this function. It returns a string list using each argument in the list: // returns "red, o
range, blue" myConcat(', ', 'red', 'o
range', 'blue'); // returns "elephant; giraffe; lion; cheetah" myConcat('; ', 'elephant', 'giraffe', 'lion', 'cheetah'); // returns "sage. basil. oregano. pepper. parsley" myConcat('. ', 'sage', 'basil', 'oregano', 'pepper', 'parsley'); Defining a function that creates HTML lists This example defines a function that creates a string containing HTML for a list. T...
Functions - JavaScript
h ES2015, functions inside blocks are now scoped to that block. Prior to ES2015, block-level functions were forbidden in strict mode. 'use strict'; function f() { return 1; } { function f() { return 2; } } f() === 1; // true // f() === 2 in non-strict mode Block-level functions in non-strict code In a word: Don't. In non-strict code, function declarations inside blocks behave st
rangely. For example: if (shouldDefineZero) { function zero() { // DANGER: compatibility risk console.log("This is zero."); } } ES2015 says that if shouldDefineZero is false, then zero should never be defined, since the block never executes. However, it's a new part of the standard. Historically, this was left unspecified, and some browsers would define zero whether the block execute...
Array() constructor - JavaScript
ray constructor, not array literals created with the bracket syntax. arrayLength If the only argument passed to the Array constructor is an integer between 0 and 232-1 (inclusive), this returns a new JavaScript array with its length property set to that number (Note: this implies an array of arrayLength empty slots, not slots with actual undefined values). If the argument is any other number, a
RangeError exception is thrown. Examples Array literal notation Arrays can be created using the literal notation: let fruits = ['Apple', 'Banana']; console.log(fruits.length); // 2 console.log(fruits[0]); // "Apple" Array constructor with a single parameter Arrays can be created using a constructor with a single number parameter. An array with its length property set to that number and the...
Array.prototype.every() - JavaScript
he element, and the Array object being traversed. If a thisArg parameter is provided to every, it will be used as callback's this value. Otherwise, the value undefined will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. every does not mutate the array on which it is called. The
range of elements processed by every is set before the first invocation of callback. Therefore, callback will not run on elements that are appended to the array after the call to every begins. If existing elements of the array are changed, their value as passed to callback will be the value at the time every visits them. Elements that are deleted are not visited. every acts like the "for all" quantifi...
Array.prototype.findIndex() - JavaScript
her array methods such as Array.some(), callback is run even for indexes with unassigned values. callback is invoked with three arguments: The value of the element The index of the element The Array object being traversed If a thisArg parameter is passed to findIndex(), it will be used as the this inside each invocation of the callback. If it is not provided, then undefined is used. The
range of elements processed by findIndex() is set before the first invocation of callback. callback will not process the elements appended to the array after the call to findIndex() begins. If an existing, unvisited element of the array is changed by callback, its value passed to the callback will be the value at the time findIndex() visits the element's index. Elements that are deleted are still visi...
Array.prototype.forEach() - JavaScript
se arrays, see example below.) callback is invoked with three arguments: the value of the element the index of the element the Array object being traversed If a thisArg parameter is provided to forEach(), it will be used as callback's this value. The thisArg value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. The
range of elements processed by forEach() is set before the first invocation of callback. Elements which are appended to the array after the call to forEach() begins will not be visited by callback. If existing elements of the array are changed or deleted, their value as passed to callback will be the value at the time forEach() visits them; elements that are deleted before being visited are not visited...
Array.prototype.length - JavaScript
eractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Description The value of the length property is an integer with a positive sign and a value less than 2 to the 32nd power (232). var namelistA = new Array(4294967296); //2 to the 32nd power = 4294967296 var namelistC = new Array(-100) //negative sign console.log(namelistA.length); //
RangeError: Invalid array length console.log(namelistC.length); //
RangeError: Invalid array length var namelistB = []; namelistB.length = Math.pow(2,32)-1; //set array length less than 2 to the 32nd power console.log(namelistB.length); //4294967295 You can set the length property to truncate an array at any time. When you extend an array by changing its length property, the number of actual eleme...
Array.prototype.map() - JavaScript
ject being mapped. If a thisArg parameter is provided, it will be used as callback's this value. Otherwise, the value undefined will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. map does not mutate the array on which it is called (although callback, if invoked, may do so). The
range of elements processed by map is set before the first invocation of callback. Elements which are appended to the array after the call to map begins will not be visited by callback. If existing elements of the array are changed, their value as passed to callback will be the value at the time map visits them. Elements that are deleted after the call to map begins and before being visited are not vis...
Array.prototype.some() - JavaScript
ement, and the Array object being traversed. If a thisArg parameter is provided to some(), it will be used as the callback's this value. Otherwise, the value undefined will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. some() does not mutate the array on which it is called. The
range of elements processed by some() is set before the first invocation of callback. Elements appended to the array after the call to some() begins will not be visited by callback. If an existing, unvisited element of the array is changed by callback, its value passed to the visiting callback will be the value at the time that some() visits that element's index. Elements that are deleted are not visit...
Array.prototype.sort() - JavaScript
g them to strings and comparing strings in UTF-16 code units order. For example, "banana" comes before "cherry". In a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in the Unicode order. All undefined elements are sorted to the end of the array. Note : In UTF-16, Unicode characters above \uFFFF are encoded as two surrogate code units, of the
range \uD800-\uDFFF. The value of each code unit is taken separately into account for the comparison. Thus the character formed by the surrogate pair \uD655\uDE55 will be sorted before the character \uFF3A. If compareFunction is supplied, all non-undefined array elements are sorted according to the return value of the compare function (all undefined elements are sorted to the end of the array, with n...
Array - JavaScript
Create an Array let fruits = ['Apple', 'Banana'] console.log(fruits.length) // 2 Access an Array item using the index position let first = fruits[0] // Apple let last = fruits[fruits.length - 1] // Banana Loop over an Array fruits.forEach(function(item, index, array) { console.log(item, index) }) // Apple 0 // Banana 1 Add an item to the end of an Array let newLength = fruits.push('O
range') // ["Apple", "Banana", "O
range"] Remove an item from the end of an Array let last = fruits.pop() // remove O
range (from the end) // ["Apple", "Banana"] Remove an item from the beginning of an Array let first = fruits.shift() // remove Apple from the front // ["Banana"] Add an item to the beginning of an Array let newLength = fruits.unshift('Strawberry') // add to the front // ["Strawbe...
ArrayBuffer() constructor - JavaScript
red in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax new ArrayBuffer(length) Parameters length The size, in bytes, of the array buffer to create. Return value A new ArrayBuffer object of the specified size. Its contents are initialized to 0. Exceptions A
RangeError is thrown if the length is larger than Number.MAX_SAFE_INTEGER (>= 2 ** 53) or negative. Compatibility notes Starting with ECMAScript 2015, ArrayBuffer constructors require to be constructed with a new operator. Calling an ArrayBuffer constructor as a function without new, will throw a TypeError from now on. var dv = ArrayBuffer(10); // TypeError: calling a builtin ArrayBuffer constructor...
ArrayBuffer.prototype.slice() - JavaScript
which to end slicing. If end is unspecified, the new ArrayBuffer contains all bytes from begin to the end of this ArrayBuffer. Return value A new ArrayBuffer object. Description The slice() method copies up to, but not including, the byte indicated by the end parameter. If either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. The
range specified by the begin and end parameters is clamped to the valid index
range for the current array. If the computed length of the new ArrayBuffer would be negative, it is clamped to zero. Examples Copying an ArrayBuffer const buf1 = new ArrayBuffer(8); const buf2 = buf1.slice(0); Specifications Specification ECMAScript (ECMA-262)The definition of 'ArrayBuffer.prototype.sl...
Atomics.add() - JavaScript
ay An integer typed array. One of Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to add a value to. value The number to add. Return value The old value at the given position (typedArray[index]). Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Examples Using add() const sab = new SharedArrayBuffer(1024); const ta = new Uint8Array(sab); Atomics.add(ta, 0, 12); // returns 0, the old value Atomics.load(ta, 0); // 12 Specifications Specification ECMAScript (ECMA-262)The definition of 'Atomics.add' in that specification. ...
Atomics.and() - JavaScript
Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to compute the bitwise AND. value The number to compute the bitwise AND with. Return value The old value at the given position (typedArray[index]). Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Description The bitwise AND operation only yields 1, if both a and b are 1. The truth table for the AND operation is: a b a & b 0 0 0 0 1 0 1 0 0 1 1 1 For example, a bitwise AND of 5 & 1 results in 0001 which is 1 in decimal. 5 0101 1 0001 ---- 1 000...
Atomics.compareExchange() - JavaScript
y, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to exchange a value. expectedValue The value to check for equality. replacementValue The number to exchange. Return value The old value at the given position (typedArray[index]). Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Examples Using compareExchange() const sab = new SharedArrayBuffer(1024); const ta = new Uint8Array(sab); ta[0] = 7; Atomics.compareExchange(ta, 0, 7, 12); // returns 7, the old value Atomics.load(ta, 0); // 12 Specifications Specification ECMAScript (ECMA-262)The definition of 'Atomics.compareExchange' in that specif...
Atomics.exchange() - JavaScript
integer typed array. One of Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to exchange a value. value The number to exchange. Return value The old value at the given position (typedArray[index]). Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Examples Using exchange() const sab = new SharedArrayBuffer(1024); const ta = new Uint8Array(sab); Atomics.exchange(ta, 0, 12); // returns 0, the old value Atomics.load(ta, 0); // 12 Specifications Specification ECMAScript (ECMA-262)The definition of 'Atomics.exchange' in that specification. ...
Atomics.load() - JavaScript
ray, index) Parameters typedArray An integer typed array. One of Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to load from. Return value The value at the given position (typedArray[index]). Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Examples Using load const sab = new SharedArrayBuffer(1024); const ta = new Uint8Array(sab); Atomics.add(ta, 0, 12); Atomics.load(ta, 0); // 12 Specifications Specification ECMAScript (ECMA-262)The definition of 'Atomics.load' in that specification. ...
Atomics.notify() - JavaScript
dArray, index, count) Parameters typedArray A shared Int32Array. index The position in the typedArray to wake up on. count Optional The number of sleeping agents to notify. Defaults to +Infinity. Return value Returns the number of woken up agents. Returns 0, if a non-shared ArrayBuffer object is used. Exceptions Throws a TypeError, if typedArray is not a Int32Array. Throws a
RangeError, if index is out of bounds in the typedArray. Examples Using notify Given a shared Int32Array: const sab = new SharedArrayBuffer(1024); const int32 = new Int32Array(sab); A reading thread is sleeping and waiting on location 0 which is expected to be 0. As long as that is true, it will not go on. However, once the writing thread has stored a new value, it will be notified by the writin...
Atomics.or() - JavaScript
of Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to compute the bitwise OR. value The number to compute the bitwise OR with. Return value The old value at the given position (typedArray[index]). Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Description The bitwise OR operation yields 1, if either a or b are 1. The truth table for the OR operation is: a b a | b 0 0 0 0 1 1 1 0 1 1 1 1 For example, a bitwise OR of 5 & 1 results in 0101 which is 5 in decimal. 5 0101 1 0001 ---- 5 0101 Exa...
Atomics.store() - JavaScript
arameters typedArray An integer typed array. One of Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to store a value in. value The number to store. Return value The value that has been stored. Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Examples Using store() var sab = new SharedArrayBuffer(1024); var ta = new Uint8Array(sab); Atomics.store(ta, 0, 12); // 12 Specifications Specification ECMAScript (ECMA-262)The definition of 'Atomics.store' in that specification. ...
Atomics.sub() - JavaScript
er typed array. One of Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to subtract a value from. value The number to subtract. Return value The old value at the given position (typedArray[index]). Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Examples Using sub const sab = new SharedArrayBuffer(1024); const ta = new Uint8Array(sab); ta[0] = 48; Atomics.sub(ta, 0, 12); // returns 48, the old value Atomics.load(ta, 0); // 36 Specifications Specification ECMAScript (ECMA-262)The definition of 'Atomics.sub' in that specification. ...
Atomics.wait() - JavaScript
value[, timeout]) Parameters typedArray A shared Int32Array. index The position in the typedArray to wait on. value The expected value to test. timeout Optional Time to wait in milliseconds. Infinity, if no time is provided. Return value A String which is either "ok", "not-equal", or "timed-out". Exceptions Throws a TypeError, if typedArray is not a shared Int32Array. Throws a
RangeError, if index is out of bounds in the typedArray. Examples Using wait() Given a shared Int32Array: const sab = new SharedArrayBuffer(1024); const int32 = new Int32Array(sab); A reading thread is sleeping and waiting on location 0 which is expected to be 0. As long as that is true, it will not go on. However, once the writing thread has stored a new value, it will be notified by the writin...
Atomics.xor() - JavaScript
Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array. index The position in the typedArray to compute the bitwise XOR. value The number to compute the bitwise XOR with. Return value The old value at the given position (typedArray[index]). Exceptions Throws a TypeError, if typedArray is not one of the allowed integer types. Throws a
RangeError, if index is out of bounds in the typedArray. Description The bitwise XOR operation yields 1, if a and b are different. The truth table for the XOR operation is: a b a ^ b 0 0 0 0 1 1 1 0 1 1 1 0 For example, a bitwise XOR of 5 ^ 1 results in 0100 which is 4 in decimal. 5 0101 1 0001 ---- 4 0100 ...
BigInt.asIntN() - JavaScript
ontribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax BigInt.asIntN(width, bigint); Parameters width The amount of bits available for the integer size. bigint The integer to clamp to fit into the supplied bits. Returns The value of bigint modulo 2width as a signed integer. Examples Staying in 64-bit
ranges The BigInt.asIntN() method can be useful to stay in the
range of 64-bit arithmetic. const max = 2n ** (64n - 1n) - 1n; BigInt.asIntN(64, max); // ? 9223372036854775807n BigInt.asIntN(64, max + 1n); // ? -9223372036854775807n // negative because of overflow Specifications Specification ECMAScript (ECMA-262)The definition of 'BigInt.asIntN()' in that specification. ...
BigInt.asUintN() - JavaScript
ibute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax BigInt.asUintN(width, bigint); Parameters width The amount of bits available for the integer size. bigint The integer to clamp to fit into the supplied bits. Returns The value of bigint modulo 2width as an unsigned integer. Examples Staying in 64-bit
ranges The BigInt.asUintN() method can be useful to stay in the
range of 64-bit arithmetic. const max = 2n ** 64n - 1n; BigInt.asUintN(64, max); // ? 18446744073709551615n BigInt.asUintN(64, max + 1n); // ? 0n // zero because of overflow Specifications Specification ECMAScript (ECMA-262)The definition of 'BigInt.asUintN()' in that specification. ...
BigInt.prototype.toString() - JavaScript
ting the specified BigInt object. The trailing "n" is not part of the string. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax bigIntObj.toString([radix]) Parameters radixOptional Optional. An integer in the
range 2 through 36 specifying the base to use for representing numeric values. Return value A string representing the specified BigInt object. Exceptions
RangeError If toString() is given a radix less than 2 or greater than 36, a
RangeError is thrown. Description The BigInt object overrides the toString() method of the Object object; it does not inherit Object.prototype.toString(). For BigIn...
BigInt64Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create a BigInt64Array // From a length var bigint64 = new BigInt64Array(2); bigint64[0] = 42n; console.log(bigint64[0]); // 42n console.log(bigint64.length); // 2 console.log(bigint64.BYTES_PER_ELEMENT); // 8 // ...
BigUint64Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create a BigUint64Array // From a length var biguint64 = new BigUint64Array(2); biguint64[0] = 42n; console.log(biguint64[0]); // 42n console.log(biguint64.length); // 2 console.log(biguint64.BYTES_PER_ELEMENT); //...
DataView() constructor - JavaScript
ified data buffer. (That probably wasn't a very helpful description.) You can think of the returned object as an "interpreter" of the array buffer of bytes -- it knows how to convert numbers to fit within the buffer correctly, both when reading and writing to it. This means handling integer and float conversion, endianness, and other details of representing numbers in binary form. Exceptions
RangeError Thrown if the byteOffset or byteLength parameter values result in the view extending past the end of the buffer. For example, if the buffer is 16 bytes long, the byteOffset is 8, and the byteLength is 10, this error is thrown because the resulting view tries to extend 2 bytes past the total length of the buffer. Examples Using DataView var buffer = new ArrayBuffer(16); var view = ...
DataView.prototype.getBigInt64() - JavaScript
teractive-examples and send us a pull request. Syntax dataview.getBigInt64(byteOffset [, littleEndian]) Parameters byteOffset The offset, in bytes, from the start of the view to read the data from. littleEndian Optional Indicates whether the 64-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is read. Return value A BigInt. Errors thrown
RangeError Thrown if the byteOffset is set such that it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getBigInt64 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getBigInt64(0); // 0n Specifications Specification ECMAScript (ECMA-2...
DataView.prototype.getBigUint64() - JavaScript
eractive-examples and send us a pull request. Syntax dataview.getBigUint64(byteOffset [, littleEndian]) Parameters byteOffset The offset, in bytes, from the start of the view to read the data from. littleEndian Optional Indicates whether the 64-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is read. Return value A BigInt. Errors thrown
RangeError Thrown if the byteOffset is set such that it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getBigUint64 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getBigUint64(0); // 0n Specifications Specification ECMAScript (ECMA...
DataView.prototype.getFloat32() - JavaScript
d send us a pull request. Syntax dataview.getFloat32(byteOffset [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to read the data. littleEndian Optional Indicates whether the 32-bit float is stored in little- or big-endian format. If false or undefined, a big-endian value is read. Return value A signed 32-bit float number. Errors thrown
RangeError Thrown if the byteOffset is set such as it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getFloat32 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getFloat32(1); // 0 Specifications Specification ECMAScript (ECMA-262)Th...
DataView.prototype.getFloat64() - JavaScript
d send us a pull request. Syntax dataview.getFloat64(byteOffset [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to read the data. littleEndian Optional Indicates whether the 64-bit float is stored in little- or big-endian format. If false or undefined, a big-endian value is read. Return value A signed 64-bit float number. Errors thrown
RangeError Thrown if the byteOffset is set such as it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getFloat64 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getFloat64(0); // 0 Specifications Specification ECMAScript (ECMA-262)Th...
DataView.prototype.getInt16() - JavaScript
and send us a pull request. Syntax dataview.getInt16(byteOffset [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to read the data. littleEndian Optional Indicates whether the 16-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is read. Return value A signed 16-bit integer number. Errors thrown
RangeError Thrown if the byteOffset is set such as it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getInt16 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getInt16(1); // 0 Specifications Specification ECMAScript (ECMA-262)The de...
DataView.prototype.getInt32() - JavaScript
nd send us a pull request. Syntax dataview.getInt32(byteOffset [, littleEndian]) Parameters byteOffset The offset, in bytes, from the start of the view where to read the data. littleEndian Optional Indicates whether the 32-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is read. Return value A signed 32-bit integer number. Errors thrown
RangeError Thrown if the byteOffset is set such as it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getInt32 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getInt32(1); // 0 Specifications Specification ECMAScript (ECMA-262)The de...
DataView.prototype.getInt8() - JavaScript
ctive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dataview.getInt8(byteOffset) Parameters byteOffset The offset, in byte, from the start of the view where to read the data. Return value A signed 8-bit integer number. Errors thrown
RangeError Thrown if the byteOffset is set such as it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getInt8 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getInt8(1); // 0 Specifications Specification ECMAScript (ECMA-262)The defi...
DataView.prototype.getUint16() - JavaScript
send us a pull request. Syntax dataview.getUint16(byteOffset [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to read the data. littleEndian Optional Indicates whether the 16-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is read. Return value An unsigned 16-bit integer number. Errors thrown
RangeError Thrown if the byteOffset is set such as it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getUint16 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getUint16(1); // 0 Specifications Specification ECMAScript (ECMA-262)The ...
DataView.prototype.getUint32() - JavaScript
send us a pull request. Syntax dataview.getUint32(byteOffset [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to read the data. littleEndian Optional Indicates whether the 32-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is read. Return value An unsigned 32-bit integer number. Errors thrown
RangeError Thrown if the byteOffset is set such as it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getUint32 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getUint32(1); // 0 Specifications Specification ECMAScript (ECMA-262)The ...
DataView.prototype.getUint8() - JavaScript
e example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dataview.getUint8(byteOffset) Parameters byteOffset The offset, in byte, from the start of the view where to read the data. Return value An unsigned 8-bit integer number. Errors thrown
RangeError Thrown if the byteOffset is set such as it would read beyond the end of the view. Description There is no alignment constraint; multi-byte values may be fetched from any offset. Examples Using the getUint8 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getUint8(1); // 0 Specifications Specification ECMAScript (ECMA-262)The de...
DataView.prototype.setBigInt64() - JavaScript
he value to set as a BigInt. The highest possible value that fits in a signed 64-bit integer is 2n ** (64n -1n) - 1n (9223372036854775807n). Upon overflow, it will be negative (-9223372036854775808n). littleEndian Optional Indicates whether the 64-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is written. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such that it would store beyond the end of the view. Examples Using the setBigInt64 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setBigInt64(0, 3n); dataview.getBigInt64(0); // 3n Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setBigInt64()' in that spec...
DataView.prototype.setBigUint64() - JavaScript
the data from. value The value to set as a BigInt. The highest possible value that fits in an unsigned 64-bit integer is 2n ** 64n - 1n (18446744073709551615n). Upon overflow, it will be zero (0n). littleEndian Optional Indicates whether the 64-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is written. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such that it would store beyond the end of the view. Examples Using the setBigUint64 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setBigUint64(0, 3n); dataview.getBigUint64(0); // 3n Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setBigUint64()' in that ...
DataView.prototype.setFloat32() - JavaScript
equest. Syntax dataview.setFloat32(byteOffset, value [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to store the data. value The value to set. littleEndian Optional Indicates whether the 32-bit float is stored in little- or big-endian format. If false or undefined, a big-endian value is written. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such as it would store beyond the end of the view. Examples Using the setFloat32 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setFloat32(1, 3); dataview.getFloat32(1); // 3 Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setFloat32' in that specification.
DataView.prototype.setFloat64() - JavaScript
equest. Syntax dataview.setFloat64(byteOffset, value [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to store the data. value The value to set. littleEndian Optional Indicates whether the 64-bit float is stored in little- or big-endian format. If false or undefined, a big-endian value is written. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such as it would store beyond the end of the view. Examples Using the setFloat64 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setFloat64(0, 3); dataview.getFloat64(0); // 3 Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setFloat64' in that specification.
DataView.prototype.setInt16() - JavaScript
ll request. Syntax dataview.setInt16(byteOffset, value [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to store the data. value The value to set. littleEndian Optional Indicates whether the 16-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is written. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such as it would store beyond the end of the view. Examples Using the setInt16 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setInt16(1, 3); dataview.getInt16(1); // 3 Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setInt16' in that specification. ...
DataView.prototype.setInt32() - JavaScript
ll request. Syntax dataview.setInt32(byteOffset, value [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to store the data. value The value to set. littleEndian Optional Indicates whether the 32-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is written. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such as it would store beyond the end of the view. Examples Using the setInt32 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setInt32(1, 3); dataview.getInt32(1); // 3 Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setInt32' in that specification. ...
DataView.prototype.setInt8() - JavaScript
is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dataview.setInt8(byteOffset, value) Parameters byteOffset The offset, in byte, from the start of the view where to store the data. value The value to set. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such as it would store beyond the end of the view. Examples Using the setInt8 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setInt8(1, 3); dataview.getInt8(1); // 3 Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setInt8' in that specification. ...
DataView.prototype.setUint16() - JavaScript
l request. Syntax dataview.setUint16(byteOffset, value [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to store the data. value The value to set. littleEndian Optional Indicates whether the 16-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is written. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such as it would store beyond the end of the view. Examples Using the setUint16 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setUint16(1, 3); dataview.getUint16(1); // 3 Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setUint16' in that specification. ...
DataView.prototype.setUint32() - JavaScript
l request. Syntax dataview.setUint32(byteOffset, value [, littleEndian]) Parameters byteOffset The offset, in byte, from the start of the view where to store the data. value The value to set. littleEndian Optional Indicates whether the 32-bit int is stored in little- or big-endian format. If false or undefined, a big-endian value is written. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such as it would store beyond the end of the view. Examples Using the setUint32 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setUint32(1, 3); dataview.getUint32(1); // 3 Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setUint32' in that specification. ...
DataView.prototype.setUint8() - JavaScript
s stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dataview.setUint8(byteOffset, value) Parameters byteOffset The offset, in byte, from the start of the view where to store the data. value The value to set. Return value undefined. Errors thrown
RangeError Thrown if the byteOffset is set such as it would store beyond the end of the view. Examples Using the setUint8 method var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setUint8(1, 3); dataview.getUint8(1); // 3 Specifications Specification ECMAScript (ECMA-262)The definition of 'DataView.prototype.setUint8' in that specification. ...
DataView - JavaScript
taview.getUint32(byteOffset, littleEndian); const right = dataview.getUint32(byteOffset+4, littleEndian); // combine the two 32-bit values const combined = littleEndian? left + 2**32*right : 2**32*left + right; if (!Number.isSafeInteger(combined)) console.warn(combined, 'exceeds MAX_SAFE_INTEGER. Precision may be lost'); return combined; } Alternatively, if you need full 64-bit
range, you can create a BigInt. Further, although native BigInts are much faster than user-land library equivalents, BigInts will always be much slower than 32-bit integers in JavaScript due to the nature of their variable size. const BigInt = window.BigInt, bigThirtyTwo = BigInt(32), bigZero = BigInt(0); function getUint64BigInt(dataview, byteOffset, littleEndian) { // split 64-bit number into two ...
Date.UTC() - JavaScript
fied date and time. Years between 0 and 99 are converted to a year in the 20th century (1900 + year). For example, 95 is converted to the year 1995. The UTC() method differs from the Date constructor in two ways: Date.UTC() uses universal time instead of the local time. Date.UTC() returns a time value as a number instead of creating a Date object. If a parameter is outside of the expected
range, the UTC() method updates the other parameters to accommodate the value. For example, if 15 is used for month, the year will be incremented by 1 (year + 1) and 3 will be used for the month. UTC() is a static method of Date, so it's called as Date.UTC() rather than as a method of a Date instance. Examples Using Date.UTC() The following statement creates a Date object with the arguments treated...
Date.parse() - JavaScript
tring with invalid date values new Date('23/25/2014'); will be treated as a local date of 25 November, 2015 in Firefox 30 and an invalid date in Safari 7. However, if the string is recognized as an ISO format string and it contains invalid values, it will return NaN in all browsers compliant with ES5 and later: // ISO string with invalid values new Date('2014-25-23').toISOString(); // throws "
RangeError: invalid date" in all ES5-compliant browsers SpiderMonkey's implementation-specific heuristic can be found in jsdate.cpp. The string "10 06 2014" is an example of a non-conforming ISO format and thus falls back to a custom routine. See also this rough outline on how the parsing works. new Date('10 06 2014'); will be treated as a local date of 6 October, 2014, and not 10 June, 2014. Oth...
Date.prototype.setDate() - JavaScript
examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.setDate(dayValue) Parameters dayValue An integer representing the day of the month. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the given date (the Date object is also changed in place). Description If the dayValue is outside of the
range of date values for the month, setDate() will update the Date object accordingly. For example, if 0 is provided for dayValue, the date will be set to the last day of the previous month. If a negative number is provided for dayValue, the date will be set counting backwards from the last day of the previous month. -1 would result in the date being set to 1 day before the last day of the previous m...
Date.prototype.setFullYear() - JavaScript
ay of the month. If you specify the dateValue parameter, you must also specify the monthValue. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you do not specify the monthValue and dateValue parameters, the values returned from the getMonth() and getDate() methods are used. If a parameter you specify is outside of the expected
range, setFullYear() attempts to update the other parameters and the date information in the Date object accordingly. For example, if you specify 15 for monthValue, the year is incremented by 1 (yearValue + 1), and 3 is used for the month. Examples Using setFullYear() var theBigDay = new Date(); theBigDay.setFullYear(1997); Specifications Specification ECMAScript (ECMA-262)The d...
Date.prototype.setHours() - JavaScript
must also specify the minutesValue and secondsValue. Return value The number of milliseconds between January 1, 1970 00:00:00 UTC and the updated date. Description If you do not specify the minutesValue, secondsValue, and msValue parameters, the values returned from the getMinutes(), getSeconds(), and getMilliseconds() methods are used. If a parameter you specify is outside of the expected
range, setHours() attempts to update the date information in the Date object accordingly. For example, if you use 100 for secondsValue, the minutes will be incremented by 1 (minutesValue + 1), and 40 will be used for seconds. Examples Using setHours() var theBigDay = new Date(); theBigDay.setHours(7); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prot...
Date.prototype.setMilliseconds() - JavaScript
project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.setMilliseconds(millisecondsValue) Parameters millisecondsValue A number between 0 and 999, representing the milliseconds. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you specify a number outside the expected
range, the date information in the Date object is updated accordingly. For example, if you specify 1005, the number of seconds is incremented by 1, and 5 is used for the milliseconds. Examples Using setMilliseconds() var theBigDay = new Date(); theBigDay.setMilliseconds(100); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.setMilliseconds' in ...
Date.prototype.setMinutes() - JavaScript
specify the msValue parameter, you must also specify the minutesValue and secondsValue. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you do not specify the secondsValue and msValue parameters, the values returned from getSeconds() and getMilliseconds() methods are used. If a parameter you specify is outside of the expected
range, setMinutes() attempts to update the date information in the Date object accordingly. For example, if you use 100 for secondsValue, the minutes will be incremented by 1 (minutesValue + 1), and 40 will be used for seconds. Examples Using setMinutes() var theBigDay = new Date(); theBigDay.setMinutes(45); Specifications Specification ECMAScript (ECMA-262)The definition of 'Da...
Date.prototype.setMonth() - JavaScript
and 12 represents January of the following year. dayValue Optional. An integer from 1 to 31, representing the day of the month. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you do not specify the dayValue parameter, the value returned from the getDate() method is used. If a parameter you specify is outside of the expected
range, setMonth() attempts to update the date information in the Date object accordingly. For example, if you use 15 for monthValue, the year will be incremented by 1, and 3 will be used for month. The current day of month will have an impact on the behaviour of this method. Conceptually it will add the number of days given by the current day of the month to the 1st day of the new month specified as t...
Date.prototype.setSeconds() - JavaScript
between 0 and 59, representing the seconds. msValue Optional. A number between 0 and 999, representing the milliseconds. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you do not specify the msValue parameter, the value returned from the getMilliseconds() method is used. If a parameter you specify is outside of the expected
range, setSeconds() attempts to update the date information in the Date object accordingly. For example, if you use 100 for secondsValue, the minutes stored in the Date object will be incremented by 1, and 40 will be used for seconds. Examples Using setSeconds() var theBigDay = new Date(); theBigDay.setSeconds(30); Specifications Specification ECMAScript (ECMA-262)The definition...
Date.prototype.setUTCDate() - JavaScript
tive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.setUTCDate(dayValue) Parameters dayValue An integer from 1 to 31, representing the day of the month. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If a parameter you specify is outside of the expected
range, setUTCDate() attempts to update the date information in the Date object accordingly. For example, if you use 40 for dayValue, and the month stored in the Date object is June, the day will be changed to 10 and the month will be incremented to July. Examples Using setUTCDate() var theBigDay = new Date(); theBigDay.setUTCDate(20); Specifications Specification ECMAScript (ECM...
Date.prototype.setUTCFullYear() - JavaScript
f the month. If you specify the dayValue parameter, you must also specify the monthValue. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you do not specify the monthValue and dayValue parameters, the values returned from the getUTCMonth() and getUTCDate() methods are used. If a parameter you specify is outside of the expected
range, setUTCFullYear() attempts to update the other parameters and the date information in the Date object accordingly. For example, if you specify 15 for monthValue, the year is incremented by 1 (yearValue + 1), and 3 is used for the month. Examples Using setUTCFullYear() var theBigDay = new Date(); theBigDay.setUTCFullYear(1997); Specifications Specification ECMAScript (ECMA-...
Date.prototype.setUTCHours() - JavaScript
o specify the minutesValue and secondsValue. Return value The number of milliseconds between January 1, 1970 00:00:00 UTC and the updated date. Description If you do not specify the minutesValue, secondsValue, and msValue parameters, the values returned from the getUTCMinutes(), getUTCSeconds(), and getUTCMilliseconds() methods are used. If a parameter you specify is outside of the expected
range, setUTCHours() attempts to update the date information in the Date object accordingly. For example, if you use 100 for secondsValue, the minutes will be incremented by 1 (minutesValue + 1), and 40 will be used for seconds. Examples Using setUTCHours() var theBigDay = new Date(); theBigDay.setUTCHours(8); Specifications Specification ECMAScript (ECMA-262)The definition of '...
Date.prototype.setUTCMilliseconds() - JavaScript
ease clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.setUTCMilliseconds(millisecondsValue) Parameters millisecondsValue A number between 0 and 999, representing the milliseconds. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If a parameter you specify is outside of the expected
range, setUTCMilliseconds() attempts to update the date information in the Date object accordingly. For example, if you use 1100 for millisecondsValue, the seconds stored in the Date object will be incremented by 1, and 100 will be used for milliseconds. Examples Using setUTCMilliseconds() var theBigDay = new Date(); theBigDay.setUTCMilliseconds(500); Specifications Specification ...
Date.prototype.setUTCMinutes() - JavaScript
fy the msValue parameter, you must also specify the minutesValue and secondsValue. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you do not specify the secondsValue and msValue parameters, the values returned from getUTCSeconds() and getUTCMilliseconds() methods are used. If a parameter you specify is outside of the expected
range, setUTCMinutes() attempts to update the date information in the Date object accordingly. For example, if you use 100 for secondsValue, the minutes will be incremented by 1 (minutesValue + 1), and 40 will be used for seconds. Examples Using setUTCMinutes() var theBigDay = new Date(); theBigDay.setUTCMinutes(43); Specifications Specification ECMAScript (ECMA-262)The definiti...
Date.prototype.setUTCMonth() - JavaScript
esenting the months January through December. dayValue Optional. An integer from 1 to 31, representing the day of the month. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you do not specify the dayValue parameter, the value returned from the getUTCDate() method is used. If a parameter you specify is outside of the expected
range, setUTCMonth() attempts to update the date information in the Date object accordingly. For example, if you use 15 for monthValue, the year will be incremented by 1, and 3 will be used for month. Examples Using setUTCMonth() var theBigDay = new Date(); theBigDay.setUTCMonth(11); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.setUTCMonth'...
Date.prototype.setUTCSeconds() - JavaScript
ween 0 and 59, representing the seconds. msValue Optional. A number between 0 and 999, representing the milliseconds. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If you do not specify the msValue parameter, the value returned from the getUTCMilliseconds() method is used. If a parameter you specify is outside of the expected
range, setUTCSeconds() attempts to update the date information in the Date object accordingly. For example, if you use 100 for secondsValue, the minutes stored in the Date object will be incremented by 1, and 40 will be used for seconds. Examples Using setUTCSeconds() var theBigDay = new Date(); theBigDay.setUTCSeconds(20); Specifications Specification ECMAScript (ECMA-262)The d...
Date.prototype.toLocaleDateString() - JavaScript
default time zone console.log(date.toLocaleDateString()); // -> "12/11/2012" if run in en-US locale with time zone America/Los_Angeles Checking for support for locales and options arguments The locales and options arguments are not supported in all browsers yet. To check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a
RangeError exception: function toLocaleDateStringSupportsLocales() { try { new Date().toLocaleDateString('i'); } catch (e) { return e.name === '
RangeError'; } return false; } Using locales This example shows some of the variations in localized date formats. In order to get the format of the language used in the user interface of your application, make sure to specify that language (...
Date.prototype.toLocaleString() - JavaScript
time zone console.log(date.toLocaleString()); // -> "12/11/2012, 7:00:00 PM" if run in en-US locale with time zone America/Los_Angeles Checking for support for locales and options arguments The locales and options arguments are not supported in all browsers yet. To check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a
RangeError exception: function toLocaleStringSupportsLocales() { try { new Date().toLocaleString('i'); } catch (e) { return e instanceof
RangeError; } return false; } Using locales This example shows some of the variations in localized date and time formats. In order to get the format of the language used in the user interface of your application, make sure to specify that language ...
Date.prototype.toLocaleTimeString() - JavaScript
default time zone console.log(date.toLocaleTimeString()); // -> "7:00:00 PM" if run in en-US locale with time zone America/Los_Angeles Checking for support for locales and options arguments The locales and options arguments are not supported in all browsers yet. To check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a
RangeError exception: function toLocaleTimeStringSupportsLocales() { try { new Date().toLocaleTimeString('i'); } catch (e) { return e.name === '
RangeError'; } return false; } Using locales This example shows some of the variations in localized time formats. In order to get the format of the language used in the user interface of your application, make sure to specify that language (...
Float32Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create a Float32Array // From a length var float32 = new Float32Array(2); float32[0] = 42; console.log(float32[0]); // 42 console.log(float32.length); // 2 console.log(float32.BYTES_PER_ELEMENT); // 4 // From an a...
Float64Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create a Float64Array // From a length var float64 = new Float64Array(2); float64[0] = 42; console.log(float64[0]); // 42 console.log(float64.length); // 2 console.log(float64.BYTES_PER_ELEMENT); // 8 // From an a...
Function.prototype.apply() - JavaScript
to know the arguments of the called object when you use the apply method. You can use arguments to pass all the arguments to the called object. The called object is then responsible for handling the arguments. Since ECMAScript 5th Edition, you can also use any kind of object which is array-like. In practice, this means it's going to have a length property, and integer ("index") properties in the
range (0..length - 1). For example, you could use a NodeList, or a custom object like { 'length': 2, '0': 'eat', '1': 'bananas' }. Note: Many older browsers--including Chrome <17 and Internet Explorer <9--don't accept array-like objects, and will throw an exception. Examples Using apply to append an array to another You can use push to append an element to an array. And, because push accepts a va...
Int16Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create an Int16Array // From a length var int16 = new Int16Array(2); int16[0] = 42; console.log(int16[0]); // 42 console.log(int16.length); // 2 console.log(int16.BYTES_PER_ELEMENT); // 2 // From an array var arr...
Int32Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create an Int32Array // From a length var int32 = new Int32Array(2); int32[0] = 42; console.log(int32[0]); // 42 console.log(int32.length); // 2 console.log(int32.BYTES_PER_ELEMENT); // 4 // From an array var arr...
Int8Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create an Int8Array // From a length var int8 = new Int8Array(2); int8[0] = 42; console.log(int8[0]); // 42 console.log(int8.length); // 2 console.log(int8.BYTES_PER_ELEMENT); // 1 // From an array var arr = new ...
Intl.DateTimeFormat - JavaScript
imeFormat object. Intl.DateTimeFormat.prototype.formatToParts() Returns an Array of objects representing the date string in parts that can be used for custom locale-aware formatting. Intl.DateTimeFormat.prototype.resolvedOptions() Returns a new object with properties reflecting the locale and formatting options computed during initialization of the object. Intl.DateTimeFormat.prototype.format
Range() This method receives two Dates and formats the date
range in the most concise way based on the locale and options provided when instantiating DateTimeFormat. Intl.DateTimeFormat.prototype.format
RangeToParts() This method receives two Dates and returns an Array of objects containing the locale-specific tokens representing each part of the formatted date
range. Examples Using DateTimeFormat...
Intl.getCanonicalLocales() - JavaScript
ull request. Syntax Intl.getCanonicalLocales(locales) Parameters locales A list of String values for which to get the canonical locale names. Return value An array containing the canonical locale names. Examples Using getCanonicalLocales Intl.getCanonicalLocales('EN-US'); // ["en-US"] Intl.getCanonicalLocales(['EN-US', 'Fr']); // ["en-US", "fr"] Intl.getCanonicalLocales('EN_US'); //
RangeError:'EN_US' is not a structurally valid language tag Specifications Specification ECMAScript Internationalization API (ECMA-402)The definition of 'Intl.getCanonicalLocales' in that specification. ...
Math.acos() - JavaScript
ractive-examples and send us a pull request. Syntax Math.acos(x) Parameters x A number representing a cosine, where x is between -1 and 1. Return value The arccosine (angle in radians) of the given number if it's between -1 and 1; otherwise, NaN. Description The Math.acos() method returns a numeric value between 0 and ? radians for x between -1 and 1. If the value of x is outside this
range, it returns NaN. Because acos() is a static method of Math, you always use it as Math.acos(), rather than as a method of a Math object you created (Math is not a constructor). Examples Using Math.acos() Math.acos(-2); // NaN Math.acos(-1); // 3.141592653589793 Math.acos(0); // 1.5707963267948966 Math.acos(0.5); // 1.0471975511965979 Math.acos(1); // 0 Math.acos(2); // NaN For values...
Math.asin() - JavaScript
e https://github.com/mdn/interactive-examples and send us a pull request. Syntax Math.asin(x) Parameters x A number. Return value The arcsine (in radians) of the given number if it's between -1 and 1; otherwise, NaN. Description The Math.asin() method returns a numeric value between -?2-\frac{\pi}{2} and ?2\frac{\pi}{2} radians for x between -1 and 1. If the value of x is outside this
range, it returns NaN. Because asin() is a static method of Math, you always use it as Math.asin(), rather than as a method of a Math object you created (Math is not a constructor). Examples Using Math.asin() Math.asin(-2); // NaN Math.asin(-1); // -1.5707963267948966 (-pi/2) Math.asin(0); // 0 Math.asin(0.5); // 0.5235987755982989 Math.asin(1); // 1.5707963267948966 (pi/2) Math.asin(2); //...
Math.fround() - JavaScript
4-bit float and a 32-bit float for equality may fail even though the numbers are seemingly identical. To solve this, Math.fround() can be used to cast the 64-bit float to a 32-bit float. Internally, JavaScript continues to treat the number as a 64-bit float, it just performs a "round to even" on the 23rd bit of the mantissa, and sets all following mantissa bits to 0. If the number is outside the
range of a 32-bit float, Infinity or -Infinity is returned. Because fround() is a static method of Math, you always use it as Math.fround(), rather than as a method of a Math object you created (Math is not a constructor). Polyfill This can be emulated with the following function, if Float32Array are supported: Math.fround = Math.fround || (function (array) { return function(x) { return array...
Math.log() - JavaScript
s not a constructor). If you need the natural log of 2 or 10, use the constants Math.LN2 or Math.LN10 . If you need a logarithm to base 2 or 10, use Math.log2() or Math.log10() . If you need a logarithm to other bases, use Math.log(x) / Math.log(otherBase) as in the example below; you might want to precalculate 1 / Math.log(otherBase) . Examples Using Math.log() Math.log(-1); // NaN, out of
range Math.log(0); // -Infinity Math.log(1); // 0 Math.log(10); // 2.302585092994046 Using Math.log() with a different base The following function returns the logarithm of y with base x (ie. logxy\log_x y): function getBaseLog(x, y) { return Math.log(y) / Math.log(x); } If you run getBaseLog(10, 1000) it returns 2.9999999999999996 due to floating-point rounding, which is very close to the act...
Number.prototype.toExponential() - JavaScript
ponential([fractionDigits]) Parameters fractionDigits Optional. An integer specifying the number of digits after the decimal point. Defaults to as many digits as necessary to specify the number. Return value A string representing the given Number object in exponential notation with one digit before the decimal point, rounded to fractionDigits digits after the decimal point. Exceptions
RangeError If fractionDigits is too small or too large. Values between 0 and 20, inclusive, will not cause a
RangeError. Implementations are allowed to support larger and smaller values as well. TypeError If this method is invoked on an object that is not a Number. Description If the fractionDigits argument is omitted, the number of digits after the decimal point defaults to the number of digits ...
Number.prototype.toFixed() - JavaScript
ed in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax numObj.toFixed([digits]) Parameters digits Optional The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger
range of values. If this argument is omitted, it is treated as 0. Return value A string representing the given number using fixed-point notation. Exceptions
RangeError If digits is too small or too large. Values between 0 and 100, inclusive, will not cause a
RangeError. Implementations are allowed to support larger and smaller values as chosen. TypeError If this method is invoked on an object...
Number.prototype.toLocaleString() - JavaScript
ocale and with default options is returned. var number = 3500; console.log(number.toLocaleString()); // Displays "3,500" if in U.S. English locale Checking for support for locales and options arguments The locales and options arguments are not supported in all browsers yet. To check for support in ES5.1 and later implementations, the requirement that illegal language tags are rejected with a
RangeError exception can be used: function toLocaleStringSupportsLocales() { var number = 0; try { number.toLocaleString('i'); } catch (e) { return e.name === '
RangeError'; } return false; } Prior to ES5.1, implementations were not required to throw a
range error exception if toLocaleString is called with arguments. A check that works in all hosts, including those supporting ECMA-...
Number.prototype.toPrecision() - JavaScript
r object in fixed-point or exponential notation rounded to precision significant digits. See the discussion of rounding in the description of the Number.prototype.toFixed() method, which also applies to toPrecision(). If the precision argument is omitted, behaves as Number.prototype.toString(). If the precision argument is a non-integer value, it is rounded to the nearest integer. Exceptions
RangeError If precision is not between 1 and 100 (inclusive), a
RangeError is thrown. Implementations are allowed to support larger and smaller values as well. ECMA-262 only requires a precision of up to 21 significant digits. Examples Using toPrecision let numObj = 5.123456 console.log(numObj.toPrecision()) // logs '5.123456' console.log(numObj.toPrecision(5)) // logs '5.1235' console.log(n...
Number.prototype.toString() - JavaScript
The toString() method returns a string representing the specified Number object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax numObj.toString([radix]) Parameters radix Optional. An integer in the
range 2 through 36 specifying the base to use for representing numeric values. Return value A string representing the specified Number object. Exceptions
RangeError If toString() is given a radix less than 2 or greater than 36, a
RangeError is thrown. Description The Number object overrides the toString() method of the Object object. (It does not inherit Object.prototype.toString()). For Number obj...
Proxy - JavaScript
ot work for native browser objects like DOM Elements. Validation With a Proxy, you can easily validate the passed value for an object. This example uses the set handler. ...
RegExp() constructor - JavaScript
mples and send us a pull request. Syntax Literal, constructor, and factory notations are possible: /pattern/flags new RegExp(pattern[, flags]) RegExp(pattern[, flags]) Parameters pattern The text of the regular expression. As of ES5, this can also be another RegExp object or literal (for the two RegExp constructor notations only). Patterns may include special characters to match a wider
range of values than would a literal string. flags If specified, flags is a string that contains the flags to add. Alternatively, if an object is supplied for the pattern, the flags string will replace any of that object's flags (and lastIndex will be reset to 0) (as of ES2015). If flags is not specified and a regular expressions object is supplied, that object's flags (and lastIndex value) wi...
String.prototype.charAt() - JavaScript
mples and send us a pull request. Syntax let character = str.charAt(index) Parameters index An integer between 0 and str.length - 1. If the index cannot be converted to the integer or no index is provided, the default is 0, so the first character of str is returned. Return value A string representing the character (exactly one UTF-16 code unit) at the specified index. If index is out of
range, charAt() returns an empty string. Description Characters in a string are indexed from left to right. The index of the first character is 0, and the index of the last character--in a string called stringName--is stringName.length - 1. If the index you supply is out of this
range, JavaScript returns an empty string. If no index is provided to charAt(), the default is 0. Examples Displaying ch...
String.prototype.indexOf() - JavaScript
-5) will return 4, as it starts at position 0, and o is found at position 4. On the other hand, 'hello world'.indexOf('o', 11) (and with any fromIndex value greater than 11) will return -1, as the search is started at position 11, a position after the end of the string. Return value The index of the first occurrence of searchValue, or -1 if not found. An empty string searchValue produces st
range results. With no fromIndex value, or any fromIndex value lower than the string's length, the returned value is the same as the fromIndex value: 'hello world'.indexOf('') // returns 0 'hello world'.indexOf('', 0) // returns 0 'hello world'.indexOf('', 3) // returns 3 'hello world'.indexOf('', 8) // returns 8 However, with any fromIndex value equal to or greater than the string's length, the retu...
String.prototype.localeCompare() - JavaScript
ort( (a, b) => a.localeCompare(b, 'fr', {ignorePunctuation: true})); // ['Adieu', 'cafe', 'Cliche', 'communique', 'Premier', 'reserve'] Check browser support for extended arguments The locales and options arguments are not supported in all browsers yet. To check whether an implementation supports them, use the "i" argument (a requirement that illegal language tags are rejected) and look for a
RangeError exception: function localeCompareSupportsLocales() { try { 'foo'.localeCompare('bar', 'i'); } catch (e) { return e.name === '
RangeError'; } return false; } Using locales The results provided by localeCompare() vary between languages. In order to get the sort order of the language used in the user interface of your application, make sure to specify that language (and possi...
String.prototype.match() - JavaScript
pturing groups are returned. In this case, the returned item will have additional properties as described below. Additional properties As explained above, some results contain additional properties as described below. groups An object of named capturing groups whose keys are the names and values are the capturing groups or undefined if no named capturing groups were defined. See Groups and
Ranges for more information. index The index of the search at which the result was found. input A copy of the search string. Description If the regular expression does not include the g flag, str.match() will return the same result as RegExp.exec(). Other methods If you need to know if a string matches a regular expression RegExp, use RegExp.test(). If you only want the first match found, y...
String.prototype.normalize() - JavaScript
efined, "NFC" is used. These values have the following meanings: "NFC" Canonical Decomposition, followed by Canonical Composition. "NFD" Canonical Decomposition. "NFKC" Compatibility Decomposition, followed by Canonical Composition. "NFKD" Compatibility Decomposition. Return value A string containing the Unicode Normalization Form of the given string. Errors thrown
RangeError A
RangeError is thrown if form isn't one of the values specified above. Description Unicode assigns a unique numerical value, called a code point, to each character. For example, the code point for "A" is given as U+0041. However, sometimes more than one code point, or sequence of code points, can represent the same abstract character -- the character "n" for example can be represented b...
String.prototype.replace() - JavaScript
. This logs 'Twas the night before Christmas...'. Note: See this guide for more explanations about regular expressions. Using global and ignore with replace() Global replace can only be done with a regular expression. In the following example, the regular expression includes the global and ignore case flags which permits replace() to replace each occurrence of 'apples' in the string with 'o
ranges'. let re = /apples/gi; let str = 'Apples are round, and apples are juicy.'; let newstr = str.replace(re, 'o
ranges'); console.log(newstr); // o
ranges are round, and o
ranges are juicy. This logs 'o
ranges are round, and o
ranges are juicy'. Switching words in a string The following script switches the words in the string. For the replacement text, the script uses capturing groups and the $1 an...
String.prototype.toLocaleLowerCase() - JavaScript
eter indicates the locale to be used to convert to lower case according to any locale-specific case mappings. If multiple locales are given in an Array, the best available locale is used. The default locale is the host environment's current locale. Return value A new string representing the calling string converted to lower case, according to any locale-specific case mappings. Exceptions A
RangeError ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. A TypeError ("invalid element in locales argument") is thrown if an array element isn't of type string. Description The toLocaleLowerCase() method returns the value of the string converted to lower case according to any locale-specific case mappings. toLocaleLowerCase() does not affect the value of...
String.prototype.toLocaleUpperCase() - JavaScript
eter indicates the locale to be used to convert to upper case according to any locale-specific case mappings. If multiple locales are given in an Array, the best available locale is used. The default locale is the host environment's current locale. Return value A new string representing the calling string converted to upper case, according to any locale-specific case mappings. Exceptions A
RangeError ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. A TypeError ("invalid element in locales argument") is thrown if an array element isn't of type string. Description The toLocaleUpperCase() method returns the value of the string converted to upper case according to any locale-specific case mappings. toLocaleUpperCase() does not affect the value of...
TypedArray.prototype.filter() - JavaScript
If a thisArg parameter is provided to filter, it will be passed to callback when invoked, for use as its this value. Otherwise, the value undefined will be passed for use as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. filter() does not mutate the typed array on which it is called. The
range of elements processed by filter() is set before the first invocation of callback. Elements which are appended to the typed array after the call to filter() begins will not be visited by callback. If existing elements of the typed array are changed, or deleted, their value as passed to callback will be the value at the time filter() visits them; elements that are deleted are not visited. Examples...
TypedArray.prototype.find() - JavaScript
hich have never been assigned values. callback is invoked with three arguments: the value of the element, the index of the element, and the typed array object being traversed. If a thisArg parameter is provided to find, it will be used as the this for each invocation of the callback. If it is not provided, then undefined is used. find does not mutate the typed array on which it is called. The
range of elements processed by find is set before the first invocation of callback. Elements that are appended to the typed array after the call to find begins will not be visited by callback. If an existing, unvisited element of the typed array is changed by callback, its value passed to the visiting callback will be the value at the time that find visits that element's index; elements that are delete...
TypedArray.prototype.findIndex() - JavaScript
never been assigned values. callback is invoked with three arguments: the value of the element, the index of the element, and the typed array object being traversed. If a thisArg parameter is provided to findIndex, it will be used as the this for each invocation of the callback. If it is not provided, then undefined is used. findIndex does not mutate the typed array on which it is called. The
range of elements processed by findIndex is set before the first invocation of callback. Elements that are appended to the typed array after the call to findIndex begins will not be visited by callback. If an existing, unvisited element of the typed array is changed by callback, its value passed to the visiting callback will be the value at the time that findIndex visits that element's index; elements ...
TypedArray.prototype.forEach() - JavaScript
ent value the element index the typed array being traversed If a thisArg parameter is provided to forEach(), it will be passed to callback when invoked, for use as its this value. Otherwise, the value undefined will be passed for use as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. The
range of elements processed by forEach() is set before the first invocation of callback. Elements that are appended to the typed array after the call to forEach() begins will not be visited by callback. If the values of existing elements of the typed array are changed, the value passed to callback will be the value at the time forEach() visits them; elements that are deleted before being visited are no...
TypedArray.prototype.map() - JavaScript
rovided to map(), it will be passed to mapFn when invoked, for use as its this value. Otherwise, the value undefined will be passed for use as its this value. The this value ultimately observable by mapFn is determined according to the usual rules for determining the this seen by a function. map() does not mutate the typed array on which it is called (although mapFn, if invoked, may do so). The
range of elements processed by map() is set before the first invocation of mapFn. Elements which are appended to the array after the call to map() begins will not be visited by mapFn. If existing elements of the typed array are changed, or deleted, their value as passed to mapFn will be the value at the time map() visits them; elements that are deleted are not visited. Examples Mapping a typed array ...
TypedArray.prototype.set() - JavaScript
e array from which to copy values. All values from the source array are copied into the target array, unless the length of the source array plus the offset exceeds the length of the target array, in which case an exception is thrown. typedarray If the source array is a typed array, the two arrays may share the same underlying ArrayBuffer; the JavaScript engine will intelligently copy the source
range of the buffer to the destination
range. offset Optional The offset into the target array at which to begin writing values from the source array. If this value is omitted, 0 is assumed (that is, the source array will overwrite values in the target array starting at index 0). Exceptions A
RangeError, if the offset is set such as it would store beyond the end of the typed array. Examples Usin...
TypedArray.prototype.subarray() - JavaScript
nd]]) Parameters begin Optional Element to begin at. The offset is inclusive. The whole array will be included in the new view if this value is not specified. end Optional Element to end at. The offset is exclusive. If not specified, all elements from the one specified by begin to the end of the array are included in the new view. Return value A new TypedArray object. Description The
range specified by begin and end is clamped to the valid index
range for the current array; if the computed length of the new array would be negative, it's clamped to zero. If either begin or end is negative, it refers to an index from the end of the array instead of from the beginning. Also note that this is creating a new view on the existing buffer; changes to the new object's contents will impact ...
Uint16Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Description The Uint16Array() typed array constructor creates an array of 16-bit unsigned integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, y...
Uint32Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create a Uint32Array // From a length var uint32 = new Uint32Array(2); uint32[0] = 42; console.log(uint32[0]); // 42 console.log(uint32.length); // 2 console.log(uint32.BYTES_PER_ELEMENT); // 4 // From an array v...
Uint8Array() constructor - JavaScript
be same as the length of the typedArray argument. object When called with an object argument, a new typed array is created as if by the TypedArray.from() method. buffer, byteOffset, length When called with a buffer, and optionally a byteOffset and a length argument, a new typed array view is created that views the specified ArrayBuffer. The byteOffset and length parameters specify the memory
range that will be exposed by the typed array view. If both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. Examples Different ways to create a Uint8Array // From a length var uint8 = new Uint8Array(2); uint8[0] = 42; console.log(uint8[0]); // 42 console.log(uint8.length); // 2 console.log(uint8.BYTES_PER_ELEMENT); // 1 // From an array var arr ...
Uint8ClampedArray - JavaScript
The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). Constructor Uint8ClampedArray() Creates a new Uint8ClampedArray object. Static properties Uint8ClampedArray.BYTES_PER_ELEMENT Returns a number value of the element size. ...
WebAssembly.Memory() constructor - JavaScript
but shared memories do. shared Optional A boolean value that defines whether the memory is a shared memory or not. If set to true, it is a shared memory. The default is false. Note: A WebAssembly page has a constant size of 65,536 bytes, i.e., 64KiB. Exceptions If memoryDescriptor is not of type object, a TypeError is thrown. If maximum is specified and is smaller than initial, a
RangeError is thrown. Examples Creating a new Memory instance There are two ways to get a WebAssembly.Memory object. The first way is to construct it from JavaScript. The following example creates a new WebAssembly Memory instance with an initial size of 10 pages (640KiB), and a maximum size of 100 pages (6.4MiB). Its buffer property will return an ArrayBuffer. var memory = new WebAssembly.Memory(...
WebAssembly.Table() constructor - JavaScript
o be stored in the table. At the moment this can only have a value of "anyfunc" (functions). initial The initial number of elements of the WebAssembly Table. maximum Optional The maximum number of elements the WebAssembly Table is allowed to grow to. Exceptions If tableDescriptor is not of type object, a TypeError is thrown. If maximum is specified and is smaller than initial, a
RangeError is thrown. Examples Creating a new WebAssembly Table instance The following example (see table2.html source code and live version) creates a new WebAssembly Table instance with an initial size of 2 elements. We then print out the table length and contents of the two indexes (retrieved via Table.prototype.get() to show that the length is two and both elements are null. var tbl = new WebA...
WebAssembly.Table.prototype.get() - JavaScript
Assembly.Table() object retrieves a function reference stored at a given index. Syntax table.get(index); Parameters index The index of the function reference you want to retrieve. Return value A function reference -- this is an exported WebAssembly function, a JavaScript wrapper for an underlying wasm function. Exceptions If index is greater than or equal to Table.prototype.length, a
RangeError is thrown. Examples Using get The following example (see table.html on GitHub, and view it live also) compiles and instantiates the loaded table.wasm byte code using the WebAssembly.instantiateStreaming() method. It then retrieves the references stored in the exported table. WebAssembly.instantiateStreaming(fetch('table.wasm')) .then(function(obj) { var tbl = obj.instance.exports.tbl; ...
WebAssembly.Table.prototype.grow() - JavaScript
The grow() prototype method of the WebAssembly.Table object increases the size of the Table instance by a specified number of elements. Syntax table.grow(number); Parameters number The number of elements you want to grow the table by. Return value The previous length of the table. Exceptions If the grow() operation fails for whatever reason, a
RangeError is thrown. Examples Using grow The following example creates a new WebAssembly Table instance with an initial size of 2 and a maximum size of 10. var table = new WebAssembly.Table({ element: "anyfunc", initial: 2, maximum: 10 }); You can then grow the table by 1 with the following: console.log(table.length); // "2" console.log(table.grow(1)); // "2" console.log(table.length); // "3" Specifications Specificat...
WebAssembly.Table.prototype.set() - JavaScript
en index to a different value. Syntax table.set(index, value); Parameters index The index of the function reference you want to mutate. value The value you want to mutate the reference to. This must be an exported WebAssembly function, a JavaScript wrapper for an underlying wasm function. Return value Void. Exceptions If index is greater than or equal to Table.prototype.length, a
RangeError is thrown. If value is not an exported WebAssembly function or null, a TypeError is thrown. Examples Using Table.set The following example (see table2.html source code and live version) creates a new WebAssembly Table instance with an initial size of 2 references. We then print out the table length and contents of the two indexes (retrieved via Table.prototype.get()) to show that the le...
Standard built-in objects - JavaScript
bjects These are the fundamental, basic objects upon which all other objects are based. This includes general objects, booleans, functions, and symbols. Object Function Boolean Symbol Error objects Error objects are a special type of fundamental object. They include the basic Error type, as well as several specialized error types. Error AggregateError EvalError InternalError
RangeError ReferenceError SyntaxError TypeError URIError Numbers and dates These are the base objects representing numbers, dates, and mathematical calculations. Number BigInt Math Date Text processing These objects represent strings and support manipulating them. String RegExp Indexed collections These objects represent collections of data which are ordered by an index value. T...
Conditional (ternary) operator - JavaScript
condition is any of these, the result of the conditional expression will be the result of executing the expression exprIfFalse. Examples A simple example var age = 26; var beverage = (age >= 21) ? "Beer" : "Juice"; console.log(beverage); // "Beer" Handling null values One common usage is to handle a value that may be null: let greeting = person => { let name = person ? person.name : `st
ranger` return `Howdy, ${name}` } console.log(greeting({name: `Alice`})); // "Howdy, Alice" console.log(greeting(null)); // "Howdy, st
ranger" Conditional chains The ternary operator is right-associative, which means it can be "chained" in the following way, similar to an if ... else if ... else if ... else chain: function example(...) { return condition1 ? value1 : co...
block - JavaScript
function or script, and the effects of setting them persist beyond the block itself. In other words, block statements do not introduce a scope. For example: var x = 1; { var x = 2; } console.log(x); // logs 2 This logs 2 because the var x statement within the block is in the same scope as the var x statement before the block. In non-strict code, function declarations inside blocks behave st
rangely. Do not use them. Block scoping rules with let, const or function declaration in strict mode By contrast, identifiers declared with let and const do have block scope: let x = 1; { let x = 2; } console.log(x); // logs 1 The x = 2 is limited in scope to the block in which it was defined. The same is true of const: const c = 1; { const c = 2; } console.log(c); // logs 1 and does not thro...
JavaScript typed arrays - JavaScript
, and use that to read and write the contents of the buffer. Typed array views Typed array views have self-descriptive names and provide views for all the usual numeric types like Int8, Uint32, Float64 and so forth. There is one special typed array view, the Uint8ClampedArray. It clamps the values between 0 and 255. This is useful for Canvas data processing, for example. ...
display - Web app manifests
Note: If the display member is not specified, it defaults to browser. Note: You can selectively apply CSS to your app based on the display mode, using the display-mode media feature. ...
serviceworker - Web app manifests
"type": "", "update_via_cache": "none" } Values Service worker contain the following values (only src is required): Member Description src The URL to download the service worker script from. This is the only required member of the serviceworker member. scope A string representing a URL that defines a service worker's registration scope; that is, what
range of URLs a service worker can control. This is usually a relative URL, relative to the base URL of the application. By default, the scope value for a service worker registration is set to the directory where the service worker script is located. type ? update_via_cache Whether the user agent cache should be bypassed when fetching the service worker. ...
Guide to streaming audio and video - Web media technologies
rmance. HTTPS Live Streaming HTTPS Live Streaming (HLS) is a protocol developed by Apple and supported by Safari on all of their platforms. HLS may also be supported in other environments, although in some cases this support is conditional. For example, because many web sites' mobile-specific content assume that mobile browsers support HLS, Firefox for Android does as well, in order to avoid st
range compatibility errors from occurring due to this assumption being incorrect. The desktop version of Android, however, does not support HLS. HLS uses playlists to allow the user to not only select the media to stream, but also to choose among versions or forms of the same media. For example, HLS lets the server stream a video with multiple audio streams which the user can choose from, in order to ...
Using images in HTML - Web media technologies
n HTML document, while the <picture> element enables responsive images. In this guide you'll find links to resources that deal with adding images to websites. References These articles cover some of the HTML elements and CSS properties that are used to control how images are displayed on the web. HTML <img> The HTML <img> element is used to embed an image in a webpage. It supports a wide
range of attributes that control how the image behaves and allows you to add important information like alt text for people who don't see the image. <picture> The HTML <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. The browser considers each child <source> element and chooses the best match am...
Web media technologies
dio and video playback, manipulation, and recording. If you're not sure which API you should use, this is the place to start. Using audio and video in HTML A guide to using the HTML <audio> and <video> elements. Accessibility guide for media in web design In this guide, we cover ways web designers and developers can create content that is accessible to people with different capabilities. This
ranges from simply using the alt attribute on <img> elements to captions to tagging media for screen readers. Guide to media types and formats on the web A guide to the file types and codecs available for images, audio, and video media on the web. This includes recommendations for what formats to use for what kinds of content, best practices including how to provide fallbacks and how to prioritize me...
Privacy, permissions, and information security
ast some percentage of those users by simply using the corresponding phone books. Personally identification can include information like usernames, real names, passwords, phone numbers or addresses (or even portions of them), information about medical history, Social Security Numbers, driver licenses, or any other form of ID or ID number, credit card information, and so forth. It's a very broad
range of information. Whenever working with data, always stop and think: is there any way this can be used to even through many steps identify a specific person? Privacy The concept of privacy is somewhat hard to define. Everyone has some idea what it means to keep something private, but when talking about the privacy of data, it becomes murky. Fundamentally, privacy of your data on the internet ...
bias - SVG: Scalable Vector Graphics
After applying the kernelMatrix of the <feConvolveMatrix> element to the input image to yield a number and applied the divisor attribute, the bias attribute is added to each component. This allows representation of values that would otherwise be clamped to 0 or 1. Usage notes Value <number> Default value 0 Animatable Yes One application of bias is when it is desirable to have 0.5 gray value be the zero response of the filter. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'bias' in that specification. ...
calcMode - SVG: Scalable Vector Graphics
cifies that the animation function will jump from one value to the next without any interpolation. linear Simple linear interpolation between values is used to calculate the animation function. Except for <animateMotion>, this is the default value. paced Defines interpolation to produce an even pace of change across the animation. This is only supported for values that define a linear numeric
range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). If paced is specified, any keyTimes or keySplines will be ignored. For <animateMotion>, this is the default value. spline Interpolates from one value in the values list to the next according to a time function defined by a cubic Bezier spline. The points of the spline are defined in t...
fill-opacity - SVG: Scalable Vector Graphics
Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetfill-opaci...
keySplines - SVG: Scalable Vector Graphics
-point> Each control point description is a set of four values: x1 y1 x2 y2, describing the Bezier control points for one time segment. The keyTimes values that define the associated segment are the Bezier "anchor points", and the keySplines values are the control points. Thus, there must be one fewer sets of control points than there are keyTimes. The values of x1 y1 x2 y2 must all be in the
range 0 to 1. Specifications Specification Status Comment SVG Animations Level 2The definition of 'keySplines' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'keySplines' in that specification. Recommendation Initial definition ...
opacity - SVG: Scalable Vector Graphics
="100%" height="100%" fill="url(#gradient)" /> <circle cx="50" cy="50" r="40" fill="black" /> <circle cx="150" cy="50" r="40" fill="black" opacity="0.3" /> </svg> Usage notes Default value 1 Value <alpha-value> Animatable Yes <alpha-value> The uniform opacity setting to be applied across an entire object, as a <number>. Any values outside the
range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this
range. Specifications Specification Status Comment CSS Color Module Level 4The definition of 'opacity' in that specification. Working Draft Defines in more detail what this attribute applies to. CSS Color Module Level 3The definition of 'opacity' in that specification. Recommenda...