Search completed in 1.39 seconds.
String.prototype.charAt() - JavaScript
The String object's
charAt() method returns a new string consisting of the single UTF-16 code unit located at the specified offset into 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 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
Charact...
...h - 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. ...
...ge,
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. ...
...And 23 more matches
String.prototype.charCodeAt() - JavaScript
The
charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index. 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. The UTF-16 code unit matches the Unicode code point for code points which can be represented in a single UTF-16 code unit. If the Unicode code point cannot be represented in a single UTF-16 code unit (because its value is greater than 0xFFFF) then the code unit returned will be the first part of a surrogate pair for the code point. If you want the entire code point value, use codePointAt(). ...
...-16 code unit matches the Unicode code point for code points which can be represented in a single UTF-16 code unit. If the Unicode code point cannot be represented in a single UTF-16 code unit (because its value is greater than 0xFFFF) then the code unit returned will be the first part 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 Unic...
...reater 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. ...
...And 11 more matches
chargingchange - Archive of obsolete content
Read only. ...
...Read only. ...
...he battery API has changed. General info Specification Battery Interface Event Bubbles No Cancelable No Target BatteryManager Default Action None Properties The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. ...
...And 10 more matches
Character classes - JavaScript
Has one of the following meanings: Matches any single
character except line terminators: \n, \r, \u2028 or \u2029. For example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". Inside a
character set, the dot loses its special meaning and matches a literal dot. Note that the m multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the
character set [^] can be used -- it will match any
character including newlines. ...
...llowing meanings: Matches any single
character except line terminators: \n, \r, \u2028 or \u2029. For example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". Inside a
character set, the dot loses its special meaning and matches a literal dot. Note that the m multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the
character set [^] can be used -- it will match any
character including newlines. ES2018 added the s "dotAll" flag, which allows the dot to also match line terminators. \d Matches any digit (Arabic numeral). Equivalent to [0-9]. For example, /\d/ or /[0-9]/ matches "2" in "B2 is the suite number". ...
...ch a pattern across multiple lines, the
character set [^] can be used -- it will match any
character including newlines. ES2018 added the s "dotAll" flag, which allows the dot to also match line terminators. \d Matches any digit (Arabic numeral). Equivalent to [0-9]. For example, /\d/ or /[0-9]/ matches "2" in "B2 is the suite number". \D Matches any
character that is not a digit (Arabic numeral). Equivalent to [^0-9]. For example, /\D/ or /[^0-9]/ matches "B" in "B2 is the suite number". \w Matches any alphanumeric
character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_]. For example, /\w/ matches "a" in "apple", "5" in "$5.28", and "3" in "3D". ...
...And 10 more matches
chargingtimechange - Archive of obsolete content
Read only. ...
...Read only. ...
...he battery API has changed. General info Specification Battery Interface Event Bubbles No Cancelable No Target BatteryManager Default Action None Properties The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. ...
...And 9 more matches
BluetoothCharacteristicProperties - Web APIs
indicateRead only Returns a boolean that is true if indications of the
characteristic value with acknowledgement is permitted. ...
... indicateRead only Returns a boolean that is true if indications of the
characteristic value with acknowledgement is permitted. ...
... indicateRead only Returns a boolean that is true if indications of the
characteristic value with acknowledgement is permitted. ...
...And 9 more matches
@charset - CSS: Cascading Style Sheets
The @
charset CSS at-rule specifies the
character encoding used in the style sheet. It must be the first element in the style sheet and not be preceded by any
character; as it is not a nested statement, it cannot be used inside conditional group at-rules. If several @
charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an HTML element or inside the <style> element where the
character set of the HTML page is relevant. @
charset "utf-8"; This at-rule is useful when using non-ASCII
characters in some CSS properties, like content. ...
...nditional group at-rules. If several @
charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an HTML element or inside the <style> element where the
character set of the HTML page is relevant. @
charset "utf-8"; This at-rule is useful when using non-ASCII
characters in some CSS properties, like content. As there are several ways to define the
character encoding of a style sheet, the browser will try the following methods in the following order (and stop as soon as one yields a result) : The value of the Unicode byte-order
character placed at the beginning of the file. The value given by the
charset attribute of the Content-Type: HTTP header or the equivalent in the protocol used to serve the style sheet. The @
charset CSS at-rule. Use...
... encoding of a style sheet, the browser will try the following methods in the following order (and stop as soon as one yields a result) : The value of the Unicode byte-order
character placed at the beginning of the file. The value given by the
charset attribute of the Content-Type: HTTP header or the equivalent in the protocol used to serve the style sheet. The @
charset CSS at-rule. Use the
character encoding defined by the referring document: the
charset attribute of the <link> element. This method is obsoleted in HTML5 and must not be used. ...
...And 9 more matches
nsICurrentCharsetListener
intl/uconv/idl/nsICurrent
CharsetListener.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 1.7 Implemented by: @mozilla.org/intl/current
charsetlistener;1. ...
... intl/uconv/idl/nsICurrent
CharsetListener.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 1.7 Implemented by: @mozilla.org/intl/current
charsetlistener;1. ...
... intl/uconv/idl/nsICurrent
CharsetListener.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 1.7 Implemented by: @mozilla.org/intl/current
charsetlistener;1. ...
...And 8 more matches
JS_GetTwoByteExternalStringChars
JS_GetTwoByteExternalString
Chars always succeeds, and returns a pointer to the string. ...
... JS_GetTwoByteExternalString
Chars always succeeds, and returns a pointer to the string. ...
... This article covers features introduced in SpiderMonkey 38 Get the
chars of an external string. Syntax const
char16_t * JS_GetTwoByteExternalString
Chars(JSString *str); Name Type Description str JSString * A string to get
characters. Description JS_GetTwoByteExternalString
Chars gets the
characters of the string, str. JS_GetTwoByteExternalString
Chars always succeeds, and returns a pointer to the string. ...
...And 7 more matches
BluetoothRemoteGATTCharacteristic - Web APIs
The BluetoothRemoteGatt
Characteristic interface of the Web Bluetooth API represents a GATT
Characteristic, which is a basic data element that provides further information about a peripheral's service. ...
... The BluetoothRemoteGatt
Characteristic interface of the Web Bluetooth API represents a GATT
Characteristic, which is a basic data element that provides further information about a peripheral's service. ...
... The BluetoothRemoteGatt
Characteristic interface of the Web Bluetooth API represents a GATT
Characteristic, which is a basic data element that provides further information about a peripheral's service. ...
...And 7 more matches
dischargingtimechange - Archive of obsolete content
The dis
chargingtimechange event is fired when the dis
chargingTime attribute of the battery API has changed. General info Specification Battery Interface Event Bubbles No Cancelable No Target BatteryManager Default Action None Properties The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.dis
chargingTime double (float) the remaining time in seconds until the system's battery is completely dis
charged and the system is about to be suspended. ...
...ceive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.dis
chargingTime double (float) the remaining time in seconds until the system's battery is completely dis
charged and the system is about to be suspended. Returns positive infinity if the battery is
charging, if the implementation is unable to report the remaining dis
charging time, or if there is no battery attached to the system. Read only. ...
... remaining time in seconds until the system's battery is completely dis
charged and the system is about to be suspended. Returns positive infinity if the battery is
charging, if the implementation is unable to report the remaining dis
charging time, or if there is no battery attached to the system. Read only. ...
...And 6 more matches
CharacterData - Web APIs
The
CharacterData abstract interface represents a Node object that contains
characters. This is an abstract interface, meaning there aren't any object of type
CharacterData: it is implemented by other interfaces, like Text, Comment, or ProcessingInstruction which aren't abstract. <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 meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,...
...eight="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/
CharacterData" target="_top"><rect x="266" y="1" width="130" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="331" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">
CharacterData</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits pro...
...roke-width="2px" /><text x="331" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">
CharacterData</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, Node, and implements the ChildNode and NonDocumentTypeChildNode interface.
CharacterData.data Is a DOMString representing the textual data contained in this object.
CharacterData.length Read only Returns an unsigned long representing the size of the string contained in
CharacterData.data. NonDocumentTypeChildNode.nextElementSibling Read only Returns the Element immediately following the specified one in its parent's children list, or null if the specified element is t...
...And 6 more matches
Accept-Charset - HTTP
In early versions of HTTP/1.1, a default
character encoding was defined: ISO-8859-1. ...
... The Accept-
Charset request HTTP header advertises which
character encodings the client understands. Using content negotiation, the server selects one of the encodings, uses it, and informs the client of its choice within the Content-Type response header, usually in a
charset= parameter. Browsers usually don't send this header, as the default value for each resource is usually correct and transmitting it would allow fingerprinting. If the server cannot serve any
character encoding from this request header, it can theoretically send back a 406 Not Acceptable error code. But for a better user experience, this is rarely done and the Accept-
Charset header is ignored. In early versions of HTTP/1.1, a default
character encoding was defined: ISO-8859-1. This is no longer recommended, and now each ...
...header, it can theoretically send back a 406 Not Acceptable error code. But for a better user experience, this is rarely done and the Accept-
Charset header is ignored. In early versions of HTTP/1.1, a default
character encoding was defined: ISO-8859-1. This is no longer recommended, and now each content-type may have its own default. UTF-8 is now well-supported and the overwhelmingly preferred
character encoding. ...
...And 6 more matches
String.fromCharCode() - JavaScript
The static String.from
CharCode() method returns a string created from the specified 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.from
CharCode(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. ...
... Returning supplementary
characters In UTF-16, the most common
characters can be represented by a single 16-bit value (i.e. a code unit). ...
... 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 from
CharCode() is a static method of String, you always use it as String.from
CharCode(), 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...
...And 6 more matches
BatteryManager.onchargingchange - Web APIs
Specifies an event listener to receive
chargingchange events. These events occur when the battery
charging state is updated. Syntax battery.on
chargingchange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the
chargingchange event occurs. ...
... Specifies an event listener to receive
chargingchange events. These events occur when the battery
charging state is updated. Syntax battery.on
chargingchange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the
chargingchange event occurs. ...
... Specifies an event listener to receive
chargingchange events. These events occur when the battery
charging state is updated. Syntax battery.on
chargingchange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the
chargingchange event occurs. ...
...And 5 more matches
BatteryManager.onchargingtimechange - Web APIs
Specifies an event listener to receive
chargingtimechange events. These events occur when the battery
chargingTime is updated. Syntax battery.on
chargingtimechange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the
chargingtimechange event occurs. ...
... Specifies an event listener to receive
chargingtimechange events. These events occur when the battery
chargingTime is updated. Syntax battery.on
chargingtimechange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the
chargingtimechange event occurs. ...
... Specifies an event listener to receive
chargingtimechange events. These events occur when the battery
chargingTime is updated. Syntax battery.on
chargingtimechange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the
chargingtimechange event occurs. ...
...And 5 more matches
BatteryManager.ondischargingtimechange - Web APIs
Specifies an event listener to receive dis
chargingtimechange events. These events occur when the battery dis
chargingTime is updated. Syntax battery.ondis
chargingtimechange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the dis
chargingtimechange event occurs. ...
... Specifies an event listener to receive dis
chargingtimechange events. These events occur when the battery dis
chargingTime is updated. Syntax battery.ondis
chargingtimechange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the dis
chargingtimechange event occurs. ...
...fies an event listener to receive dis
chargingtimechange events. These events occur when the battery dis
chargingTime is updated. Syntax battery.ondis
chargingtimechange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the dis
chargingtimechange event occurs. ...
...And 5 more matches
JS_EncodeCharacters
Obsolete since JSAPI 19This 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. Convert a 16-bit string to an 8-bit string. Syntax JSBool JS_Encode
Characters(JSContext *cx, const js
char *src, size_t srclen,
char *dst, size_t *dstlen); Name Type Description cx JSContext * A context. src const js
char * The pointer to 16-bit values of JSString. This can be obtained with JS_GetString
Chars. srclen size_t The length of the source string, in 16-bit values. dst const
char * The pointer to an array of bytes to be filled with encoded
characters; or NULL. The caller is responsible for allocating an...
...s responsible for allocating and freeing this buffer. dstlenp size_t * In/out parameter. On entry, if dst is non-null, *dstlenp must be the length of the destination string in 16-bit units. On success, *dstlenp receives the length of the converted string, in bytes. On failure, *dstlenp receives the number of bytes written to dst before the error occurred. Description JS_Encode
Characters copies the
characters of a js
char array into a
char array, converting the 16-bit values to 8-bit values. If SpiderMonkey was built with JS_C_STRINGS_ARE_UTF8 defined or JS_SetCStringsAreUTF8 was called, the string is converted to UTF-8. Otherwise each
character is simply truncated to 8 bits. If UTF-8 is turned on, the length of the encoded string may vary. To calculate the number of bytes...
...cters of a js
char array into a
char array, converting the 16-bit values to 8-bit values. If SpiderMonkey was built with JS_C_STRINGS_ARE_UTF8 defined or JS_SetCStringsAreUTF8 was called, the string is converted to UTF-8. Otherwise each
character is simply truncated to 8 bits. If UTF-8 is turned on, the length of the encoded string may vary. ...
...And 4 more matches
JS_GetFlatStringChars
Obsolete since JSAPI 33This 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. This article covers features introduced in SpiderMonkey 1.8.5 Get the
chars of a flat string. Use JS_FlattenString to flatten the string. ...
... Obsolete since JSAPI 33This 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. This article covers features introduced in SpiderMonkey 1.8.5 Get the
chars of a flat string. Use JS_FlattenString to flatten the string. ...
... Obsolete since JSAPI 33This 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. This article covers features introduced in SpiderMonkey 1.8.5 Get the
chars of a flat string. Use JS_FlattenString to flatten the string. ...
...And 4 more matches
JS_GetLatin1FlatStringChars
This article covers features introduced in SpiderMonkey 38 Get the
chars of a flat string. Syntax const JS::Latin1
Char * JS_GetLatin1FlatString
Chars(const JS::AutoCheckCannotGC &nogc, JSFlatString *str); const
char16_t * JS_GetTwoByteFlatString
Chars(const JS::AutoCheckCannotGC &nogc, JSFlatString *str); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC & A reference to JS::AutoCheckCannotGC. str JSFlatString * A string to get
characters. Description JS_GetLatin1FlatString
Chars and JS_GetTwoByteFlatString
Chars return a pointer to the ...
...equest. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC & A reference to JS::AutoCheckCannotGC. str JSFlatString * A string to get
characters. Description JS_GetLatin1FlatString
Chars and JS_GetTwoByteFlatString
Chars return a pointer to the string. ...
...t be in a request on this JSContext.. nogc JS::AutoCheckCannotGC & A reference to JS::AutoCheckCannotGC. str JSFlatString * A string to get
characters. Description JS_GetLatin1FlatString
Chars and JS_GetTwoByteFlatString
Chars return a pointer to the string. ...
...And 4 more matches
BatteryManager.charging - Web APIs
A Boolean value indicating whether or not the device's battery is currently being
charged. Syntax var
charging = battery.
charging On return,
charging indicates whether or not the battery, which is a BatteryManager object, is currently being
charged; if the battery is
charging, this value is true. Otherwise, the value is false. ...
... A Boolean value indicating whether or not the device's battery is currently being
charged. Syntax var
charging = battery.
charging On return,
charging indicates whether or not the battery, which is a BatteryManager object, is currently being
charged; if the battery is
charging, this value is true. Otherwise, the value is false. ...
... A Boolean value indicating whether or not the device's battery is currently being
charged. Syntax var
charging = battery.
charging On return,
charging indicates whether or not the battery, which is a BatteryManager object, is currently being
charged; if the battery is
charging, this value is true. Otherwise, the value is false. ...
...And 4 more matches
Localizations and character encodings - Developer guides
Browsers process text as Unicode internally. However, a way of representing
characters in terms of bytes (
character encoding) is used for transferring text over the network to the browser. The HTML specification recommends the use of the UTF-8 encoding (which can represent all of Unicode) and regardless of the encoding used requires Web content to declare what encoding was used. The <meta> element's
charset attribute is used to specify the page's
character encoding. It must be used within a <head> block. ...
...work to the browser. The HTML specification recommends the use of the UTF-8 encoding (which can represent all of Unicode) and regardless of the encoding used requires Web content to declare what encoding was used. The <meta> element's
charset attribute is used to specify the page's
character encoding. It must be used within a <head> block. To specify that a page is using, for example, the UTF-8
character encoding (as per the recommendation), simply place the following line in the <head> block: <meta
charset="utf-8"> Details and browser internals When the encoding is declared by Web content like the HTML specification requires, Firefox will use that encoding for turning the bytes into the internal representation. Unfortunately, using UTF-8 and declaring that UTF-8 was used was not always ...
...stic detection among multiple legacy encodings was introduced to Web browsers. This has then had the effect that Web authors have depended on heuristic detection being present, so Firefox still has heuristic detection in these locales. Finding canonical encoding names The text below refers to canonical names of encodings. The canonical names are the values to the right of the equals sign in unix
charset.properties. Specifying the fallback encoding As of Firefox 28, this section is obsolete, since the preference intl.
charset.default no longer exists. The mapping from locales onto fallback encodings is now built into Gecko itself. The fallback encoding is specified by the preference intl.
charset.default in intl.properties. It should be set to the canonical name of the legacy encoding that us...
...And 4 more matches
JS_GetLatin1StringCharsAndLength
This article covers features introduced in SpiderMonkey 38 Get the
chars and the length of a string. Syntax const JS::Latin1
Char * JS_GetLatin1String
CharsAndLength(JSContext *cx, const JS::AutoCheckCannotGC &nogc, JSString *str, size_t *length); const
char16_t * JS_GetTwoByteString
CharsAndLength(JSContext *cx, const JS::AutoCheckCannotGC &nogc, JSString *str, size_t *length); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC & A reference to JS::AutoCheckCannotGC. str JSString * A string to get
characters. length size_t...
... cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC & A reference to JS::AutoCheckCannotGC. str JSString * A string to get
characters. length size_t * Out parameter. Receives the length of the string. ...
...t. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC & A reference to JS::AutoCheckCannotGC. str JSString * A string to get
characters. length size_t * Out parameter. Receives the length of the string. ...
...And 3 more matches
BatteryManager.chargingTime - Web APIs
Indicates the amount of time, in seconds, that remain until the battery is fully
charged. Even if the time returned is precise to the second, browsers round them to a higher interval (typically to the closest 15 minutes) for privacy reasons. Syntax var time = battery.
chargingTime On return, time is the remaining time in seconds until the battery, which is a BatteryManager object, is fully
charged, or 0 if the battery is already fully
charged. If the battery is currently dis
charging, this value is Infinity. ...
...s round them to a higher interval (typically to the closest 15 minutes) for privacy reasons. Syntax var time = battery.
chargingTime On return, time is the remaining time in seconds until the battery, which is a BatteryManager object, is fully
charged, or 0 if the battery is already fully
charged. If the battery is currently dis
charging, this value is Infinity. ...
... a higher interval (typically to the closest 15 minutes) for privacy reasons. Syntax var time = battery.
chargingTime On return, time is the remaining time in seconds until the battery, which is a BatteryManager object, is fully
charged, or 0 if the battery is already fully
charged. If the battery is currently dis
charging, this value is Infinity. ...
...And 3 more matches
BatteryManager.dischargingTime - Web APIs
Indicates the amount of time, in seconds, that remains until the battery is fully dis
charged. Even if the time returned is precise to the second, browsers round them to a higher interval (typically to the closest 15 minutes) for privacy reasons. Syntax var time = battery.dis
chargingTime On return, time is the remaining time in seconds until the battery, which is a BatteryManager object, is fully dis
charged and the system will suspend. This value is Infinity if the battery is currently
charging rather than dis
charging, or if the system is unable to report the remaining dis
charging time. ...
...acy reasons. Syntax var time = battery.dis
chargingTime On return, time is the remaining time in seconds until the battery, which is a BatteryManager object, is fully dis
charged and the system will suspend. This value is Infinity if the battery is currently
charging rather than dis
charging, or if the system is unable to report the remaining dis
charging time. ...
...tax var time = battery.dis
chargingTime On return, time is the remaining time in seconds until the battery, which is a BatteryManager object, is fully dis
charged and the system will suspend. This value is Infinity if the battery is currently
charging rather than dis
charging, or if the system is unable to report the remaining dis
charging time. ...
...And 3 more matches
KeyboardEvent.charCode - Web APIs
The
charCode read-only property of the KeyboardEvent interface returns the Unicode value of a
character key pressed during a keypress event. Do not use this property, as it is deprecated. Use the key property instead. Syntax var code = event.
charCode; Return value A number that represents the Unicode value of the
character key that was pressed. ...
...rty of the KeyboardEvent interface returns the Unicode value of a
character key pressed during a keypress event. Do not use this property, as it is deprecated. Use the key property instead. Syntax var code = event.
charCode; Return value A number that represents the Unicode value of the
character key that was pressed. ...
...hat represents the Unicode value of the
character key that was pressed. Example HTML <p>Type anything into the input box below to log a <code>
charCode</code>.</p> <input type="text" /> <p id="log"></p> JavaScript let input = document.querySelector('input'); let log = document.querySelector('#log'); input.addEventListener('keypress', function(e) { log.innerText = `Key pressed: ${String.from
CharCode(e.
charCode)}\n
charCode: ${e.
charCode}`; }); Result Notes In a keypress event, the Unicode value of the key pressed is stored in either the keyCode or
charCode property, but never both. If the key pressed generates a
character (e.g., 'a'),
charCode is set to the code of that
character;
charCode respects the letter case (in other words,
charCode takes into account whether the shift key i...
...And 3 more matches
SyntaxError: illegal character - JavaScript
The JavaScript exception "illegal
character" occurs when there is an invalid or unexpected token that doesn't belong at this position in the code. Message SyntaxError: Invalid
character (Edge) SyntaxError: illegal
character (Firefox) SyntaxError: Invalid or unexpected token (Chrome) Error type SyntaxError What went wrong? There is an invalid or unexpected token that doesn't belong at this position in the code. Use an editor that supports syntax highlighting and carefully check your code against mismatches like a minus sign ( - ) versus a dash ( - ) or simple quotes ( " ) vs non-standard quotation marks ( " ). Examples Mismatched
characters Some
characters look similar, but will cause the parser to fail interpreting your code. Famous examples of this are quotes, the minus or semicolo...
...gainst mismatches like a minus sign ( - ) versus a dash ( - ) or simple quotes ( " ) vs non-standard quotation marks ( " ). Examples Mismatched
characters Some
characters look similar, but will cause the parser to fail interpreting your code. Famous examples of this are quotes, the minus or semicolon (greek questionmark (U+37e) looks same). ...
... Mismatched
characters Some
characters look similar, but will cause the parser to fail interpreting your code. Famous examples of this are quotes, the minus or semicolon (greek questionmark (U+37e) looks same). "This looks like a string"; // SyntaxError: illegal
character // " and " are not " but look like this 42 - 13; // SyntaxError: illegal
character // - is not - but looks like this var foo = 'bar'; // SyntaxError: illegal
character // <37e> is not ; but looks like this This should work: "This is actually a string"; 42 - 13; var foo = 'bar'; Some editors and IDEs will notify you or at least use a slightly different highlighting for it, but not all. When somethin...
...And 3 more matches
JS_GetStringCharAt
This article covers features introduced in SpiderMonkey 38 Return a specified
character from a string. Syntax bool JS_GetString
CharAt(JSContext *cx, JSString *str, size_t index,
char16_t *res);
char16_t JS_GetFlatString
CharAt(JSFlatString *str, size_t index); 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 JSString * or JSFlatString * The string to get
character. index size_t An integer between 0 and 1-less-than the length of the string. res
char16_t * (JS_GetString
CharAt only) Out parameter. On successful, receives the
character code. Description JS_GetString
CharA...
...build, the caller must be in a request on this JSContext. str JSString * or JSFlatString * The string to get
character. index size_t An integer between 0 and 1-less-than the length of the string. res
char16_t * (JS_GetString
CharAt only) Out parameter. On successful, receives the
character code. Description JS_GetString
CharAt and JS_GetFlatString
CharAt get the specified
character from the string str. ...
... or JSFlatString * The string to get
character. index size_t An integer between 0 and 1-less-than the length of the string. res
char16_t * (JS_GetString
CharAt only) Out parameter. On successful, receives the
character code. Description JS_GetString
CharAt and JS_GetFlatString
CharAt get the specified
character from the string str. On successful, JS_GetString
CharAt returns true and stores the
character code into *res, otherwise returns false. JS_GetFlatString
CharAt always succeeds, and returns the
character code. ...
...And 2 more matches
JS_GetStringCharsAndLength
Obsolete since JSAPI 33This 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. This article covers features introduced in SpiderMonkey 1.8.5 Get the
characters and the length of a string. Syntax const js
char * JS_GetString
CharsAndLength(JSContext *cx, JSString *str, size_t *length); Name Type Description cx JSContext * The context. Requires request. ...
...ntroduced in SpiderMonkey 1.8.5 Get the
characters and the length of a string. Syntax const js
char * JS_GetString
CharsAndLength(JSContext *cx, JSString *str, size_t *length); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * A string to get
characters. length size_t * Out parameter. Receives the length of the string. ...
...dLength(JSContext *cx, JSString *str, size_t *length); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
...And 2 more matches
JS_StringHasLatin1Chars
Clients can use JS_StringHasLatin1
Chars and can then call either the Latin1* or TwoByte* functions. ...
... This article covers features introduced in SpiderMonkey 38 Determine if a string's
characters are stored as Latin1. Syntax bool JS_StringHasLatin1
Chars(JSString *str); Name Type Description str JSString * String to examine. Description JS_StringHasLatin1
Chars returns true iff the string's
characters are stored as Latin1. String
characters are stored as either Latin1
Char (8-bit) or
char16_t (16-bit). Clients can use JS_StringHasLatin1
Chars and can then call either the Latin1* or TwoByte* functions. ...
... Name Type Description str JSString * String to examine. Description JS_StringHasLatin1
Chars returns true iff the string's
characters are stored as Latin1. String
characters are stored as either Latin1
Char (8-bit) or
char16_t (16-bit). Clients can use JS_StringHasLatin1
Chars and can then call either the Latin1* or TwoByte* functions. ...
...And 2 more matches
nsICharsetResolver
intl/
chardet/public/nsI
CharsetResolver.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 1.7 Method overview void notifyResolved
Charset(in ACString
charset, in nsISupports closure); ACString request
Charset(in nsIWebNavigation aWebNavigation, in nsIChannel aChannel, out boolean aWant
Charset, out nsISupports aClosure); Methods notifyResolved
Charset() Some implementations may request that they be notified when the
charset is actually detected. void notifyResolved
Charset( in ACString
charset, in nsISupports closure ); Parameters
charset The detected
charset. closure The closure returned by request
Charset(). ...
...Navigation, in nsIChannel aChannel, out boolean aWant
Charset, out nsISupports aClosure); Methods notifyResolved
Charset() Some implementations may request that they be notified when the
charset is actually detected. void notifyResolved
Charset( in ACString
charset, in nsISupports closure ); Parameters
charset The detected
charset. closure The closure returned by request
Charset(). request
Charset() Called to resolve the
charset that should be used for parsing the document being loaded from aChannel. If the
charset cannot be resolved, but the implementation of nsI
CharsetResolver wants to be notified of the final resolved
charset when one is available, it can set aWant
Charset to true. ...
...et. closure The closure returned by request
Charset(). request
Charset() Called to resolve the
charset that should be used for parsing the document being loaded from aChannel. If the
charset cannot be resolved, but the implementation of nsI
CharsetResolver wants to be notified of the final resolved
charset when one is available, it can set aWant
Charset to true. If this is done, the caller of request
Charset is responsible for calling notifyResolved
Charset() and passing it the final resolved
charset and the closure that request
Charset set. ACString request
Charset( in nsIWebNavigation aWebNavigation, in nsIChannel aChannel, out boolean aWant
Charset, out nsISupports aClosure ); Parameters aWebNavigation The nsIWebNavigation the document is being loaded in. May be null. aChannel The channel...
...And 2 more matches
Flame Chart - Firefox Developer Tools
The Flame
Chart shows you the state of the JavaScript stack for your code at every millisecond during the performance profile. This gives you a way to know exactly which function was executing at any point during the recording, how long it ran for, and where it was called from. The Call Tree and the Flame
Chart are both used to analyze your site's JavaScript, and they both use the same data: a sample of the JavaScript engine's stack, taken periodically during the recording. But while the Call Tree organizes this data to show you where your program is spending most time in aggregate across the recording, the Flame
Chart uses it to show you when in the recording particular functions are executing. Essentially it shows you the state of the call stack at any given point during the rec...
...aken periodically during the recording. But while the Call Tree organizes this data to show you where your program is spending most time in aggregate across the recording, the Flame
Chart uses it to show you when in the recording particular functions are executing. Essentially it shows you the state of the call stack at any given point during the recording. Here's a screenshot showing the Flame
Chart for a section of a profile: First of all, you'll see that, in the recording overview pane, we've selected a small slice of the recording to view in the Flame
Chart. The Flame
Chart displays a lot of data, so to get readable results, it's usually necessary to zoom in. In the Flame
Chart view itself, along the X-axis is time. The screenshot above covers the period from 1435ms to a little past ...
... are the functions on the call stack at that point in time, with the top-level at the top, and the leaf function at the bottom. Functions are color-coded to make them easier to distinguish. This gives you a way to know exactly which function was executing at any point during the recording, how long it ran for, and where it was called from. Zooming and panning To work effectively with the Flame
Chart, you'll need to be able to navigate it. There are two main controls you can use to navigate the Flame
Chart: Zoom: increase/decrease the selected portion of the complete profile that's displayed in the Flame
Chart 1) Mouse wheel up/down in the Flame
Chart. 2) Trackpad 2 fingers up/down in the Flame
Chart. Pan: move the selected portion of the complete profile ...
...And 2 more matches
PRUnichar
An unsigned 16-bit type, like
char in Java or the "
characters" of a JavaScript string defined in /mozilla/xpcom/base/nscore.h. ...
... An unsigned 16-bit type, like
char in Java or the "
characters" of a JavaScript string defined in /mozilla/xpcom/base/nscore.h. ...
... An unsigned 16-bit type, like
char in Java or the "
characters" of a JavaScript string defined in /mozilla/xpcom/base/nscore.h. ...
... An unsigned 16-bit type, like
char in Java or the "
characters" of a JavaScript string defined in /mozilla/xpcom/base/nscore.h. ...
JS_GetStringChars
Obsolete since JSAPI 33This 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. Retrieve a pointer to the 16-bit values that make up a given string. Syntax js
char * JS_GetString
Chars(JSString *str); // Obsolete since JSAPI 1.8.5 const js
char * JS_GetString
CharsZ(JSContext *cx, JSString *str); // Added in SpiderMonkey 1.8.2, Obsolete since JSAPI 33 Name Type Description cx JSContext * (in JS_GetString
CharsZ only) A context. str JSString * The string to obtain
characters from. Description JS_GetString
Chars Obsolete since JavaScript 1.8.5 returns a pointer to the first element of an array of js
chars. Warnings: The array is not ne...
.... If it does, the behavior is undefined. The content of a JS string is not guaranteed to be valid UTF-16. It may contain surrogate code units that aren't properly paired. It may also contain zeroes. ...
...rly paired. It may also contain zeroes. The array returned by this function remains valid as long as str is valid. ...
...The array returned by this function remains valid as long as str is valid. ...
BluetoothRemoteGATTCharacteristic.startNotifications() - Web APIs
Specifications Specification Status Comment Web BluetoothThe definition of 'startNotifications()' in that specification. ...
... Specifications Specification Status Comment Web BluetoothThe definition of 'startNotifications()' in that specification. ...
... Specifications Specification Status Comment Web BluetoothThe definition of 'startNotifications()' in that specification. ...
... Specifications Specification Status Comment Web BluetoothThe definition of 'startNotifications()' in that specification. ...
International characters in XUL JavaScript - Archive of obsolete content
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. This means that such script files can use any
character from virtually any language of the world. For example, they can contain a line: var text = "Ein schones Beispiel eines mehrsprachigen Textes: ???"; This mixes German and Japanese
characters. Earlier versions always interpreted JS files loaded from XUL as ISO-8859-1 (Latin-1), in both local and remote cases. Unicode escapes, as discussed below, have always worked. How the
character encoding is determined in Gecko 1.8 and later When the JavaScript file is loaded from a chrome:// URL, a Byte Order Mark (FIXME: )(BOM) is used to determine the
character encoding of the script. Otherwise, the...
...er versions always interpreted JS files loaded from XUL as ISO-8859-1 (Latin-1), in both local and remote cases. Unicode escapes, as discussed below, have always worked. How the
character encoding is determined in Gecko 1.8 and later When the JavaScript file is loaded from a chrome:// URL, a Byte Order Mark (FIXME: )(BOM) is used to determine the
character encoding of the script. Otherwise, the
character encoding will be the same as the one used by the XUL file (which can be specified using an encoding attribute in the <?xml?> tag). ...
...ined in Gecko 1.8 and later When the JavaScript file is loaded from a chrome:// URL, a Byte Order Mark (FIXME: )(BOM) is used to determine the
character encoding of the script. Otherwise, the
character encoding will be the same as the one used by the XUL file (which can be specified using an encoding attribute in the <?xml?> tag). By default this will use UTF-8, which can represent virtually all
characters in the world. If the script file is loaded via HTTP, the HTTP header can contain a
character encoding declaration as part of the Content-Type header, for example: Content-Type: application/javascript;
charset=UTF-8 If no
charset parameter is specified, the same rules as above apply. Cross-version compatibility If you want the same code to work in both Gecko 1.8 and earlier versions, y...
-ms-hyphenate-limit-chars - Archive of obsolete content
The -ms-hyphenate-limit-
chars CSS property is a Microsoft extension that specifies one to three values indicating the minimum number of
characters in a hyphenated word. If the word does not meet the required minimum number of
characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated. Initial valueautoApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values auto Corresponds to a value of 5 2 2, indicating a 5-
character word limit, 2
characters required before a hyphenation break, and 2
characters required following a hyphenation break. ...
... If the third value is missing it is equal to the second. ...
... If the third value is missing it is equal to the second. If the second and third values are missing they are given a value of auto. Negative values are not allowed. ...
BluetoothRemoteGATTCharacteristic.stopNotifications() - Web APIs
}) Returns A Promise. Specifications Specification Status Comment Web BluetoothThe definition of 'stopNotifications()' in that specification. ...
...}) Returns A Promise. Specifications Specification Status Comment Web BluetoothThe definition of 'stopNotifications()' in that specification. ...
...}) Returns A Promise. Specifications Specification Status Comment Web BluetoothThe definition of 'stopNotifications()' in that specification. ...
BluetoothRemoteGATTCharacteristic.uuid - Web APIs
Specifications Specification Status Comment Web BluetoothThe definition of 'uuid' in that specification. ...
... Syntax var uuid = BluetoothRemoteGATT
Characteristic.uuid Returns A DOMString. ...
... Specifications Specification Status Comment Web BluetoothThe definition of 'uuid' in that specification. ...
characteristic - Web APIs
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. ...
... Specifications Specification Status Comment Web BluetoothThe definition of '
characteristic' in that specification. 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. ...
...efinition. 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 Internet
characteristic ExperimentalChrome Full support 57Notes Full support 57Notes Notes macOS only. Full support 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-featu...
MutationObserverInit.characterData - Web APIs
The MutationObserverInit dictionary's optional
characterData property is used to specify whether or not to monitor the node or nodes being observed for changes to their textual contents.
Character data changes are detectable on any text node, including nodes based on the Text, ProcessingInstruction, and Comment interfaces. Note that this doesn't monitor content of an HTMLElement, even if it only contains text inside, as it only monitors text nodes themselves. So either pass directly a text node to the observe() method or you need to also set subtree: true. Syntax var options = {
characterData: true | false } Value A Boolean value indicating whether or not to call the observer's callback function when textual nodes' values change. If true, the callback specified when observe() was ...
...racterData: true | false } Value A Boolean value indicating whether or not to call the observer's callback function when textual nodes' values change. If true, the callback specified when observe() was used to start observing the node or subtree is called any time the contents of a text node are changed. ...
...ged. You can expand the capabilities of attribute mutation monitoring using other options:
characterDataOldValue lets you specify whether or not you want the previous value of changed text nodes to be provided using the MutationRecord's oldValue property. subtree lets you specify whether to watch the target node and all of its descendants (true), or just the target node (false). If you set
characterDataOldValue to true,
characterData is automatically assumed to be true, even if you don't expressly set it as such. Example Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.
characterData' in that specification. Living Standard ...
MutationObserverInit.characterDataOldValue - Web APIs
The MutationObserverInit dictionary's optional
characterDataOldValue property is used to specify whether or not the MutationRecord.oldValue property for DOM mutations should be set to the previous value of text nodes which changed. If you set the MutationObserverInit.
characterData property to true but don't set
characterDataOldValue to true as well, the MutationRecord will not include information describing the prior state of the text node's contents.
Character data changes are detectable on any text node, including nodes based on the Text, ProcessingInstruction, and Comment interfaces. ...
...changed. If you set the MutationObserverInit.
characterData property to true but don't set
characterDataOldValue to true as well, the MutationRecord will not include information describing the prior state of the text node's contents.
Character data changes are detectable on any text node, including nodes based on the Text, ProcessingInstruction, and Comment interfaces. Syntax var options = {
characterDataOldValue: true | false } Value A Boolean value indicating whether or not to set the MutationRecord's oldValue property to be a string containing the value of the
character node's contents prior to the change represented by the mutation record. By default, only changes to the text of the node specified as the target parameter when you called observe() are monitored. To watch for change...
...utationRecord's oldValue property to be a string containing the value of the
character node's contents prior to the change represented by the mutation record. By default, only changes to the text of the node specified as the target parameter when you called observe() are monitored. To watch for changes to the text contents of all descendants of target, set the subtree option to true. If you set
characterDataOldValue to true,
characterData is automatically assumed to be true, even if you don't expressly set it as such. Example Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.
characterDataOldValue' in that specification. Living Standard ...
JS_GetLatin1InternedStringChars
This article covers features introduced in SpiderMonkey 38 Get the
chars of an interned string. Syntax const JS::Latin1
Char * JS_GetLatin1InternedString
Chars(const JS::AutoCheckCannotGC &nogc, JSString *str); const
char16_t * JS_GetTwoByteInternedString
Chars(const JS::AutoCheckCannotGC &nogc, JSString *str); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC & A reference to JS::AutoCheckCannotGC. str JSString * A string to get
characters. Description JS_GetLatin1InternedString
Chars and JS_GetTwoByteInternedString
Chars gets th...
... Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC & A reference to JS::AutoCheckCannotGC. str JSString * A string to get
characters. Description JS_GetLatin1InternedString
Chars and JS_GetTwoByteInternedString
Chars gets the
characters of the string, str. If successful, JS_GetLatin1String
CharsAndLength and JS_GetTwoByteString
CharsAndLength return a pointer to the string, otherwise return NULL. See Also MXR ID Search for JS_GetLatin1InternedString
Chars MXR ID Search for JS_GetTwoByteInternedString
Chars JS_GetLatin1FlatString
Chars JS_GetTwoByteFlatString
Chars JS_GetLatin1String
CharsAndLength JS_GetTwoByteStringCha...
nsISupportsChar
Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. Remarks This interface was frozen for Gecko 1.2. ...
... Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. Remarks This interface was frozen for Gecko 1.2. ...
BluetoothRemoteGATTCharacteristic.properties - Web APIs
Specifications Specification Status Comment Web BluetoothThe definition of 'properties' in that specification. ...
... The BluetoothRemoteGATT
Characteristic.properties read-only property returns a Bluetooth
CharacteristicProperties instance containing the properties of this
characteristic. Syntax var properties = BluetoothRemoteGATT
Characteristic.properties Returns The properties of this
characteristic. Specifications Specification Status Comment Web BluetoothThe definition of 'properties' in that specification. Draft Initial definition. ...
BluetoothRemoteGATTCharacteristic.readValue() - Web APIs
}) Returns A Promise that resolves to an DataView. Specifications Specification Status Comment Web BluetoothThe definition of 'readValue()' in that specification. ...
...}) Returns A Promise that resolves to an DataView. Specifications Specification Status Comment Web BluetoothThe definition of 'readValue()' in that specification. ...
BluetoothRemoteGATTCharacteristic.service - Web APIs
Specifications Specification Status Comment Web BluetoothThe definition of 'service' in that specification. ...
... Specifications Specification Status Comment Web BluetoothThe definition of 'service' in that specification. ...
BluetoothRemoteGATTCharacteristic.value - Web APIs
Specifications Specification Status Comment Web BluetoothThe definition of 'value' in that specification. ...
... The BluetoothRemoteGATT
Characteristic.value read-only property returns currently cached
characteristic value. This value gets updated when the value of the
characteristic is read or updated via a notification or indication. Syntax var value = BluetoothRemoteGATT
Characteristic.value Returns The currently cached
characteristic value. Specifications Specification Status Comment Web BluetoothThe definition of 'value' in that specification. Draft Initial definition. ...
UIEvent.isChar - Web APIs
The UIEvent.is
Char read-only property returns a Boolean indicating whether the event produced a key
character or not. Syntax var is
Char = UIEvent.is
Char; Value A Boolean which is true if the event produces a
character; otherwise false. Some keystroke combinations may raise events but not produce any
character (example: ctrl-alt-?). When this is the case, is
Char returns false. It is used when event handlers need to do something like echo the input on the screen. Example In this snippet, which is part of an event handler, the event is checked to see if it generates a
character; if it does, the value of UIEvent.which is appended to a string which buffers the typed
characters. ...
...any
character (example: ctrl-alt-?). When this is the case, is
Char returns false. It is used when event handlers need to do something like echo the input on the screen. Example In this snippet, which is part of an event handler, the event is checked to see if it generates a
character; if it does, the value of UIEvent.which is appended to a string which buffers the typed
characters. if (event.is
Char) {
characterBuffer += e.which; } Specification This property is not part of any specification. ...
CSS Charsets - CSS: Cascading Style Sheets
Reference At-rules @
charset Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of '@
charset' in that specification. ...
... CSS
Charsets is a module of CSS that lets you specify the
character set used in the style sheet. Reference At-rules @
charset Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of '@
charset' in that specification. Recommendation Initial definition ...
documentCharsetInfo - Archive of obsolete content
<< XUL Reference document
CharsetInfo Obsolete since Gecko 12.0 Type: nsIDocument
CharsetInfo This read-only property contains the nsIDocument
CharsetInfo object for the document which is used to handle which
character set should be used to display the document. The properties of the nsIDocument
CharsetInfo object were merged into the docshell in Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9). ...
Character sets supported by Gecko - Gecko Redirect 1
In Gecko-internal APIs, it is necessary to use particular (potentially) mixed-case names for the encodings. For encodings that have a compatibility name in the DOM Standard, except gbk, this is the compatibilty name. For other encodings, including gbk, this is the lower-case name from the Encoding Standard. ...
Character - MDN Web Docs Glossary: Definitions of Web-related terms
A
character is either a symbol (letters, numbers, punctuation) or non-printing "control" (e.g., carriage return or soft hyphen). UTF-8 is the most common
character set and includes the graphemes of the most popular human languages. Learn More General knowledge
Character (computing) on Wikipedia
Character encoding on Wikipedia ASCII on Wikipedia UTF-8 on Wikipedia Unicode on Wikipedia ...
Character encoding - MDN Web Docs Glossary: Definitions of Web-related terms
An encoding defines a mapping between bytes and text. A sequence of bytes allows for different textual interpretations. By specifying a particular encoding (such as UTF-8), we specify how the sequence of bytes is to be interpreted. For example, in HTML we normally declare a
character encoding of UTF-8, using the following line: <meta
charset="utf-8"> This ensures that you can use
characters from just about any human language in your HTML document, and they will display reliably. Learn more General knowledge
Character encoding on W3C
Character encoding on Wikipedia ...
Character set - MDN Web Docs Glossary: Definitions of Web-related terms
A
character set is an encoding system to let computers know how to recognize
Character, including letters, numbers, punctuation marks, and whitespace. In earlier times, countries developed their own
character sets due to their different languages used, such as Kanji JIS codes (e.g. Shift-JIS, EUC-JP, etc.) for Japanese, Big5 for traditional Chinese, and KOI8-R for Russian. However, Unicode gradually became most acceptable
character set for its universal language support. If a
character set is used incorrectly (For example, Unicode for an acticle encoded in Big5), you may see nothing but broken
characters, which are called Mojibake. ...
JS_GetInternedStringChars
Obsolete since JSAPI 33This 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. This article covers features introduced in SpiderMonkey 1.8.5 Get the
chars of an interned string. Syntax const js
char * JS_GetInternedString
Chars(JSString *str); const js
char * JS_GetInternedString
CharsAndLength(JSString *str, size_t *length); Name Type Description str JSString * The interned string. length size_t * Out parameter. Receives the length of the string. Description JS_GetInternedString
Chars returns a pointer to the interned string. JS_GetInternedString
CharsAndLength returns a pointer to the interned string and stores the length of ...
jschar
Obsolete since JSAPI 35This 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. js
char is the type of JavaScript "
characters", the 16-bit elements that make up strings. js
char, a typedef for the standard C++ type
char16_t, will be removed in JSAPI 38. Functions that use js
char will use
char16_t directly. Embedder code should use
char16_t, too. (See bug 1063962.) As required by the ECMAScript standard, ECMA 262-3 ?4.3.16", JavaScript strings are arbitrary sequences of 16-bit values. A string may contain unmatched surrogates, which are not valid UTF-16. It may also contain zeroes ('\0'). To get the
characters of a JavaScript string, use JS_GetString
Chars. See Also bug 1063962 ...
BluetoothCharacteristicProperties.authenticatedSignedWrites - Web APIs
The authenticatedSignedWrites read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if signed writing to the
characteristic value is permitted. Syntax var aBoolean = Bluetooth
CharacteristicProperties.authenticatedSignedWrites; Value A Boolean. Specifications Specification Status Comment Web BluetoothThe definition of 'authenticatedSignedWrites' in that specification. Draft Initial definition. ...
BluetoothCharacteristicProperties.broadcast - Web APIs
The broadcast read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if the broadcast of the
characteristic value is permitted using the Server
Characteristic Configuration Descriptor. Syntax var aBoolean = Bluetooth
CharacteristicProperties.broadcast; Value A Boolean. Specifications Specification Status Comment Web BluetoothThe definition of 'broadcast' in that specification. Draft Initial definition. ...
BluetoothCharacteristicProperties.indicate - Web APIs
The indicate read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if indications of the
characteristic value with acknowledgement is permitted. Syntax var aBoolean = Bluetooth
CharacteristicProperties.indicate; Value A Boolean. Specifications Specification Status Comment Web BluetoothThe definition of 'indicate' in that specification. Draft Initial definition. ...
BluetoothCharacteristicProperties.notify - Web APIs
The notify read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if notifications of the
characteristic value without acknowledgement is permitted. Syntax var aBoolean = Bluetooth
CharacteristicProperties.notify; Value A Boolean. Specifications Specification Status Comment Web BluetoothThe definition of 'notify' in that specification. Draft Initial definition. ...
BluetoothCharacteristicProperties.read - Web APIs
The read read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if the reading of the
characteristic value is permitted. Syntax var aBoolean = Bluetooth
CharacteristicProperties.read; Value A Boolean. Specifications Specification Status Comment Web BluetoothThe definition of 'read' in that specification. Draft Initial definition. ...
BluetoothCharacteristicProperties.reliableWrite - Web APIs
The reliableWrite read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if reliable writes to the
characteristic is permitted. Syntax var aBoolean = Bluetooth
CharacteristicProperties.reliableWrite; Value A Boolean Specifications Specification Status Comment Web BluetoothThe definition of 'reliableWrite' in that specification. Draft Initial definition. ...
BluetoothCharacteristicProperties.writableAuxiliaries - Web APIs
The writableAuxiliaries read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if reliable writes to the
characteristic descriptor is permitted. Syntax var aBoolean = Bluetooth
CharacteristicProperties.writableAuxiliaries; Value A Boolean. Specifications Specification Status Comment Web BluetoothThe definition of 'writableAuxiliaries' in that specification. Draft Initial definition. ...
BluetoothCharacteristicProperties.write - Web APIs
The write read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if the writing to the
characteristic with response is permitted. Syntax var aBoolean = Bluetooth
CharacteristicProperties.write; Value A Boolean. Specifications Specification Status Comment Web BluetoothThe definition of 'write' in that specification. Draft Initial definition. ...
BluetoothCharacteristicProperties.writeWithoutResponse - Web APIs
The writeWithoutResponse read-only property of the Bluetooth
CharacteristicProperties interface returns a boolean that is true if the writing to the
characteristic without response is permitted. Syntax var aBoolean = Bluetooth
CharacteristicProperties.writeWithoutResponse; Value A Boolean. Specifications Specification Status Comment Web BluetoothThe definition of 'authenticatedSignedWrites' in that specification. Draft Initial definition. ...
getCharacteristic() - Web APIs
The BluetoothGATTService.get
Characteristic() method returns a Promise to an instance of BluetoothGATT
Characteristic for a given universally unique identifier (UUID). Syntax bluetoothGATTServiceInstance.get
Characteristic(
characteristic).then(function(BluetoothGATT
Characteristic) { ... } ) Returns A Promise to an instance of BluetoothGATT
Characteristic Parameters
characteristic The UUID of a
characteristic, for example '00002a37-0000-1000-8000-00805f9b34fb' for the Heart Rate Measurement
characteristic. Specifications Specification Status Comment Web BluetoothThe definition of 'get
Characteristic()' in that specification. Draft Initial definition. ...
getCharacteristics() - Web APIs
The BluetoothGATTService.get
Characteristics() method returns a Promise to a list of BluetoothGATT
Characteristic instances for a given universally unique identifier (UUID). Syntax bluetoothGATTServiceInstance.get
Characteristics(
characteristics).then(function(BluetoothGATT
Characteristic[]) { ... } ) Returns A Promise to an Array of BluetoothGATT
Characteristic instances. Parameters
characteristic The UUID of a
characteristic, for example '00002a37-0000-1000-8000-00805f9b34fb' for the Heart Rate Measurement
characteristic. Specifications Specification Status Comment Web BluetoothThe definition of 'get
Characteristics()' in that specification. Draft Initial definition. ...
HTMLFormElement.acceptCharset - Web APIs
The HTMLFormElement.accept
Charset property represents a list of the supported
character encodings for the given <form> element. This list can be comma-separated or space-separated. Syntax var string = form.accept
Charset; form.accept
Charset = string; Example inputs = document.forms['myform'].accept
Charset; Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLFormElement: accept
Charset' in that specification. Living Standard ...
SpeechSynthesisEvent.charIndex - Web APIs
The
charIndex read-only property of the SpeechSynthesisUtterance interface returns the index position of the
character in the SpeechSynthesisUtterance.text that was being spoken when the event was triggered. Syntax event.
charIndex; Value A number. Examples utterThis.onpause = function(event) { var
char = event.utterance.text.
charAt(event.
charIndex); console.log('Speech paused at
character ' + event.
charIndex + ' of "' + event.utterance.text + '", which is "' +
char + '".'); } Specifications Specification Status Comment Web Speech APIThe definition of '
charIndex' in that specification. Draft ...
StringView - Archive of obsolete content
The aims of this library are: to create a C-like interface for strings (i.e., an array of
character codes -- an ArrayBufferView in JavaScript) based upon the JavaScript ArrayBuffer interface to create a highly extensible library that anyone can extend by adding methods to the object StringView.prototype to create a collection of methods for such string-like objects (since now: stringViews) which work strictly on arrays of numbers rather than on creating new immutable JavaScript strings to work with Unicode encodings other than JavaScript's default UTF-16 DOMStrings Introduction 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 ...
...uction 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 data. In the past, this had to be simulated by treating the raw data as a string and using the
charCodeAt() method to read the bytes from the data buffer. However, this is slow and error-prone, due to the need for multiple conversions (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats). JavaScript typed arrays provide a mechanism for accessing raw binary data much more efficiently. The StringView constructor is one level above typed ar...
...iew (vInput, sEncoding /* optional (default: UTF-8) */, nOffset /* optional */, nLength /* optional */) { var fTAView, aWhole, aRaw, fPutOutptCode, fGetOutptChrSize, nInptLen, nStartIdx = isFinite(nOffset) ? ...
...And 106 more matches
nsDependentString
Class Declaration nsTDependentString_
CharT Stores a null-terminated, immutable sequence of
characters. Subclass of nsTString that restricts string value to an immutable
character sequence. This class does not own its data, so the creator of objects of this type must take care to ensure that a nsTDependentString continues to reference valid memory for the duration of its use. ...
...
characters. Subclass of nsTString that restricts string value to an immutable
character sequence. This class does not own its data, so the creator of objects of this type must take care to ensure that a nsTDependentString continues to reference valid memory for the duration of its use. ...
... Subclass of nsTString that restricts string value to an immutable
character sequence. This class does not own its data, so the creator of objects of this type must take care to ensure that a nsTDependentString continues to reference valid memory for the duration of its use. ...
...And 88 more matches
nsDependentCString
Class Declaration nsTDependentString_
CharT Stores a null-terminated, immutable sequence of
characters. Subclass of nsTString that restricts string value to an immutable
character sequence. This class does not own its data, so the creator of objects of this type must take care to ensure that a nsTDependentString continues to reference valid memory for the duration of its use. ...
...
characters. Subclass of nsTString that restricts string value to an immutable
character sequence. This class does not own its data, so the creator of objects of this type must take care to ensure that a nsTDependentString continues to reference valid memory for the duration of its use. ...
... Subclass of nsTString that restricts string value to an immutable
character sequence. This class does not own its data, so the creator of objects of this type must take care to ensure that a nsTDependentString continues to reference valid memory for the duration of its use. ...
...And 81 more matches
nsXPIDLString
Class Declaration nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const
CharT*| (3) getter_Copies method is supported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. ...
... Class Declaration nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const
CharT*| (3) getter_Copies method is supported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. ...
... Class Declaration nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const
CharT*| (3) getter_Copies method is supported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. ...
...And 79 more matches
nsCAutoString
Class Declaration nsTAutoString_
CharT Subclass of nsTString_
CharT that adds support for stack-based string allocation. It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64
characters. ...
... Class Declaration nsTAutoString_
CharT Subclass of nsTString_
CharT that adds support for stack-based string allocation. It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64
characters. ...
... Class Declaration nsTAutoString_
CharT Subclass of nsTString_
CharT that adds support for stack-based string allocation. It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64
characters. ...
...And 77 more matches
nsAutoString
Class Declaration nsTAutoString_
CharT Subclass of nsTString_
CharT that adds support for stack-based string allocation. It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64
characters. ...
... Class Declaration nsTAutoString_
CharT Subclass of nsTString_
CharT that adds support for stack-based string allocation. It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64
characters. ...
... Class Declaration nsTAutoString_
CharT Subclass of nsTString_
CharT that adds support for stack-based string allocation. It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64
characters. ...
...And 76 more matches
nsXPIDLCString
Class Declaration nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const
CharT*| (3) getter_Copies method is supported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. ...
... Class Declaration nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const
CharT*| (3) getter_Copies method is supported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. ...
... Class Declaration nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const
CharT*| (3) getter_Copies method is supported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. ...
...And 76 more matches
nsAdoptingString
Class Declaration nsTAdoptingString extends nsTXPIDLString such that: (1) Adopt given string on construction or assignment, i.e. take the value of what's given, and make what's given forget its value. Note that this class violates constness in a few places. ...
...Class Declaration nsTAdoptingString extends nsTXPIDLString such that: (1) Adopt given string on construction or assignment, i.e. take the value of what's given, and make what's given forget its value. Note that this class violates constness in a few places. ...
...tion nsTAdoptingString extends nsTXPIDLString such that: (1) Adopt given string on construction or assignment, i.e. take the value of what's given, and make what's given forget its value. Note that this class violates constness in a few places. ...
...And 75 more matches
nsAdoptingCString
Class Declaration nsTAdoptingString extends nsTXPIDLString such that: (1) Adopt given string on construction or assignment, i.e. take the value of what's given, and make what's given forget its value. Note that this class violates constness in a few places. ...
... Class Declaration nsTAdoptingString extends nsTXPIDLString such that: (1) Adopt given string on construction or assignment, i.e. take the value of what's given, and make what's given forget its value. Note that this class violates constness in a few places. ...
...claration nsTAdoptingString extends nsTXPIDLString such that: (1) Adopt given string on construction or assignment, i.e. take the value of what's given, and make what's given forget its value. Note that this class violates constness in a few places. ...
...And 71 more matches
nsString
Class Declaration This is the canonical null-terminated string class. All subclasses promise null-terminated storage. Instances of this class allocate strings on the heap. NAMES: nsString for wide
characters nsCString for narrow
characters This class is also known as nsAFlat[C]String, where "flat" is used to denote a null-terminated string. Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting ...
... EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral...
...operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsAString_internal Data Members No public members. ...
...And 68 more matches
Index - Web APIs
y, Reference, expiryYear The expiryYear property of the BasicCardResponse dictionary contains the expiry year of the card used to make the payment. 263 Battery Status API API, Apps, Battery, Battery API, Battery Status API, Guide, Mobile, Obsolete, Overview The Battery Status API, more often referred to as the Battery API, provides information about the system's battery
charge level and lets you be notified by events that are sent when the battery level or
charging status change. This can be used to adjust your app's resource usage to reduce battery drain when the battery is low, or to save changes before the battery runs out in order to prevent data loss. 264 BatteryManager API, Battery API, Device API, Interface, Obsolete, Reference, Reference(2) ...
... status change. This can be used to adjust your app's resource usage to reduce battery drain when the battery is low, or to save changes before the battery runs out in order to prevent data loss. ...
...our app's resource usage to reduce battery drain when the battery is low, or to save changes before the battery runs out in order to prevent data loss. 264 BatteryManager API, Battery API, Device API, Interface, Obsolete, Reference, Reference(2) The BatteryManager interface provides ways to get information about the system's battery
charge level. 265 BatteryManager.
charging API, Battery API, NeedsMarkupWork, Property, Reference, Reference(2) A Boolean value indicating whether or not the device's battery is currently being
charged. 266 BatteryManager.
chargingTime API, Battery API, NeedsMarkupWork, Property, Reference, Reference(2) Indicates the amount of time, in seconds, that remain until the battery is fully
charged. 267 ...
...And 68 more matches
NS_ConvertASCIItoUTF16
Class Declaration Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assig...
... Methods Constructors void NS_ConvertASCIItoUTF16(c...
...ting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsAutoString Data Members No public members. Methods Constructors void NS_ConvertASCIItoUTF16(const
char*) - source ...
...And 67 more matches
NS_ConvertUTF8toUTF16
Class Declaration Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assig...
... Methods Constructors void NS_ConvertUTF8toUTF16(co...
...ting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsAutoString Data Members No public members. Methods Constructors void NS_ConvertUTF8toUTF16(const
char*) - source P...
...And 67 more matches
nsPromiseFlatString
Class Declaration Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assig...
... Methods Constructors void nsPromiseFlatString(const ns...
... Methods Constructors void nsPromiseFlatString(const nsAString_internal&) - so...
...And 67 more matches
nsCString
Class Declaration This is the canonical null-terminated string class. All subclasses promise null-terminated storage. Instances of this class allocate strings on the heap. NAMES: nsString for wide
characters nsCString for narrow
characters This class is also known as nsAFlat[C]String, where "flat" is used to denote a null-terminated string. Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading Be...
... EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral...
...operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsACString_internal Data Members No public members. ...
...And 66 more matches
NS_ConvertUTF16toUTF8
Class Declaration A helper class that converts a UTF-16 string to UTF-8 Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCase...
...hConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsCAutoString ...
...nLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsCAutoString Data Members No public members. ...
...And 65 more matches
NS_LossyConvertUTF16toASCII
Class Declaration A helper class that converts a UTF-16 string to ASCII in a lossy manner Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsA...
...hConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsCAutoString ...
...al(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsCAutoString Data Members No public members. ...
...And 65 more matches
nsFixedString
Class Declaration Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assig...
...EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsString Data Members No public members. Methods Constructors void nsFixedString(PRUni
char*, PR...
... Base Classes nsString Data Members No public members. ...
...And 65 more matches
nsPromiseFlatCString
Class Declaration Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(ch...
... Methods Constructors void nsPromiseFlatCString(const ...
... Methods Constructors void nsPromiseFlatCString(const nsACString_internal&) -...
...And 65 more matches
nsFixedCString
Class Declaration Method Overview Constructors operator= get Find RFind RFind
Char Find
CharInSet RFind
CharInSet Compare EqualsIgnoreCase ToFloat ToInteger Mid Left Right Set
CharAt Strip
Chars StripWhitespace Replace
Char ReplaceSubstring Trim CompressWhitespace AssignWithConversion AppendWithConversion AppendInt AppendFloat BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(ch...
...EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Base Classes nsCString Data Members No public members. Methods Constructors void nsFixedCString(
char*, PRUin...
...
Char Base Classes nsCString Data Members No public members. ...
...And 64 more matches
Mozilla internal string guide
Most of the Mozilla code uses a C++ class hierarchy to pass string data, rather than using raw pointers. This guide documents the string classes which are visible to code within the Mozilla codebase (code which is linked into libxul). Introduction The string classes are a library of C++ classes which are used to manage buffers of wide (16-bit) and narrow (8-bit)
character strings. The headers and implementation are in the xpcom/string directory. All strings are stored as a single contiguous buffer of
characters. The 8-bit and 16-bit string classes have completely separate base classes, but share the same APIs. As a result, you cannot assign a 8-bit string to a 16-bit string without some kind of conversion helper class or routine. For the purpose of this document, we will refer to th...
...ble, and therefore does not emit construction/destruction code when stored in statics, as opposed to the other string classes. The Major String Classes The list below describes the main base classes. Once you are familiar with them, see the appendix describing What Class to Use When. nsAString/nsACString: the abstract base class for all strings. It provides an API for assignment, individual
character access, basic manipulation of
characters in the string, and string comparison. This class corresponds to the XPIDL AString parameter type. nsAString is not necessarily null-terminated. nsString/nsCString: builds on nsAString by guaranteeing a null-terminated storage. This allows for a method (.get()) to access the underlying
character buffer. The remainder of the string classes inherit fr...
... .IsEmpty() - the fastest way of determining if the string has any value. Use this instead of testing string.Length == 0 .Equals(string) - TRUE if the given string has the same value as the current string. ...
...And 53 more matches
nsACString (External)
area alt="" coords="499,294,779,342" href="http://developer.mozilla.org/en/NS_LossyConvertUTF16toASCII_external" shape="rect" title="NS_LossyConvertUTF16toASCII_external"> <area alt="" coords="803,294,925,342" href="http://developer.mozilla.org/en/nsLiteralCString_(External)" shape="rect" title="nsLiteralCString_(External)"></map> Method Overview BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace ...
...Methods BeginReading PRUint32 BeginReading(const
char**, const
char**) const - source Returns the length, beginning, and end of a string in one operation. ...
...Methods BeginReading PRUint32 BeginReading(const
char**, const
char**) const - source Returns the length, beginning, and end of a string in one operation. ...
...And 51 more matches
nsCString external
Class Declaration Method Overview Constructors get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char ...
...pendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCStringContainer Data Members No public members. Methods Constructors void nsCString_external() - source void nsCString_external(const nsCString_external&) - source Parameters nsCString_external& aString void nsCString_external(const nsACString&) - source Para...
...embers No public members. ...
...And 50 more matches
nsDependentCString external
Class Declaration Method Overview Constructors Rebind get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind ...
... Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCString_external Data Members No public members. Methods Constructors void nsDependentCString_external() - source void nsDependentCString_external(const
char*, PRUint32) - source Parameters
char* aData PRUint32 aLength Rebind void R...
...ind
Char AppendInt ToInteger Base Classes nsCString_external Data Members No public members. ...
...And 50 more matches
NS ConvertUTF16toUTF8 external
Class Declaration Method Overview Constructors get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char ...
...pendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCString_external Data Members No public members. Methods Constructors void NS_ConvertUTF16toUTF8_external(const nsAString&) - source Parameters nsAString& aStr void NS_ConvertUTF16toUTF8_external(const PRUni
char*, PRUint32) - source Parameters PRUni
char* aData PR...
...e Classes nsCString_external Data Members No public members. ...
...And 49 more matches
NS LossyConvertUTF16toASCII external
Class Declaration Method Overview Constructors get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char ...
...pendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCString_external Data Members No public members. Methods Constructors void NS_LossyConvertUTF16toASCII_external(const nsAString&) - source Parameters nsAString& aStr void NS_LossyConvertUTF16toASCII_external(const PRUni
char*, PRUint32) - source Parameters PRUni
char* a...
...nsCString_external Data Members No public members. ...
...And 49 more matches
PromiseFlatCString (External)
Class Declaration Method Overview get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char ...
... DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCStringContainer Data Members No public members. ...
...s No public members. ...
...And 49 more matches
nsCAutoString (External)
Class Declaration Method Overview get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char ...
... DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCStringContainer Data Members No public members. ...
...s No public members. ...
...And 49 more matches
nsCStringContainer (External)
Class Declaration Method Overview BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare(const
char*, PRInt32 (*) Compare(const nsACString&, PRInt32 (*) Equals(const
char*, PRInt32 (*) Equals(const nsACString&, PRInt32 (*) operator< operator<= operator== operator>= operato...
...Method...
...PRInt32 (*) Equals(const
char*, PRInt32 (*) Equals(const nsACString&, PRInt32 (*) operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find(const nsACString&, PRInt32 (*) Find(const nsACString&, PRUint32, PRInt32 (*) Find(const
char*, PRInt32 (*) Find(const
char*, PRUint32, PRInt32 (*) RFind(const nsACString&, PRInt32 (*) RFind(const nsACString&, PRInt32, PRInt32 (*) RFind(const
char*, PRInt32 (*) RFind(const
char*, PRInt32, PRInt32 (*) Find
Char RFind
Char AppendInt ToInteger Base Classes nsACString Data Members No public members. Methods BeginReading PRUint32...
...And 49 more matches
sample2
ng(err) PR_ErrorToString((err), PR_LANGUAGE_I_DEFAULT) #endif /* sample 6 commands */ typedef enum { GENERATE_CSR, ADD_CERT_TO_DB, SAVE_CERT_TO_HEADER, ENCRYPT, DECRYPT, SIGN, VERIFY, UNKNOWN } CommandType; typedef enum { SYMKEY = 0, MACKEY = 1, IV = 2, MAC = 3, PAD = 4, PUBKEY = 5, LAB = 6, CERTENC= 7, CERTVFY= 8, SIG = 9 } HeaderType; /* * Print usage message and exit */ static void Usage(const
char *progName) { fprintf(stderr, "\nUsage: %s %s %s %s %s %s %s %s %s %s\n\n", progName, " -<g|a|h|e|ds|v> -d <dbdirpath> ", "[-p <dbpwd> | -f <dbpwdfile>] [-z <noisefilename>] [-a <\"\">]", "-s <subject> -r <csr> | ", "-n <nickname> -t <trust> -c <cert> [ -r <csr> -u <issuernickname> [-x <\"\">] -m <serialnumber> ] | ", "-n <nickname> -b <headerfilename> | ", "-b <headerfilename> -i <ipfilename> -e ...
...e signing request \n\n", "-r <csr>"); fprintf(stderr, "%-30s - generate a self-signed cert [optional]\n\n", "-x"); fprintf(stderr, "%-30s - to enable ascii [optional]\n\n", "-a"); fprintf(stderr, "%-30s - to save certificate to header file as sig verification [optional]\n\n", "-v"); exit(-1); } /* * Validate the options used for Generate CSR command */ static void ValidateGenerateCSRCommand(const
char *progName, const
char *dbdir, CERTName *subject, const
char *subjectStr, const
char *certReqFileName) { PRBool validationFailed = PR_FALSE; if (!subject) { PR_fprintf(PR_STDERR, "%s -G -d %s -s: improperly formatted name: \"%s\"\n", progName, dbdir, subjectStr); validationFailed = PR_TRUE; } if (!certReqFileName) { PR_fprintf(PR_STDERR, "%s -G -d %s -s %s -r: certificate request file name not fou...
...ileName) { PR_fprintf(PR_STDERR, "%s -G -d %s -s %s -r: certificate request file name not found\n", progName, dbdir, subjectStr); validationFailed = PR_TRUE; } if (validationFailed) { fprintf(stderr, "\nUsage: %s %s \n\n", progName, "-G -d <dbdirpath> -s <subject> -r <csr> \n"); exit(-1); } } /* * Validate the options used for Add Cert to DB command */ static void ValidateAddCertToDBCommand(const
char *progName, const
char *dbdir, const
char *nickNameStr, const
char *trustStr, const
char *certFileName, const
char *certReqFileName, const
char *issuerNameStr, const
char *serialNumberStr, PRBool selfsign) { PRBool validationFailed = PR_FALSE; if (!nickNameStr) { PR_fprintf(PR_STDERR, "%s -A -d %s -n : nick name is missing\n", progName, dbdir); validationFailed = PR_TRUE; } if (!trustStr) { PR_fpr...
...And 48 more matches
nsLiteralCString (External)
Class Declaration Method Overview Rebind get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char ...
...pendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCString_external Data Members No public members. Methods Rebind void Rebind(const
char*, PRUint32) - source Parameters
char* aData PRUint32 aLength get
char* get() const - source operator= nsCString_external& operator=(const nsCString_exte...
...RUint32 aLength get
char* get() const - source operator= nsCString_external& operator=(const nsCString_external&) - source Parameters nsCString_external& aString nsACString& operator=(const nsACString&) - source Parameters nsACString& aString nsACString& operator=(const
char*) - source Parameters
char* aPtr nsACString& operator=(
char) - source Parameters
char a
Char Adopt void Adopt(const
char*, PRUint32) - source Parameters
char* aData PRUint32 aLength BeginReading PRUint32 BeginReading(const
char**, const
char**) const - source ...
...And 48 more matches
nsLiteralString (External)
Class Declaration Method Overview Rebind get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char ...
...pendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCString_external Data Members No public members. Methods Rebind void Rebind(const
char*, PRUint32) - source Parameters
char* aData PRUint32 aLength get
char* get() const - source operator= nsCString_external& operator=(const nsCString_exte...
...RUint32 aLength get
char* get() const - source operator= nsCString_external& operator=(const nsCString_external&) - source Parameters nsCString_external& aString nsACString& operator=(const nsACString&) - source Parameters nsACString& aString nsACString& operator=(const
char*) - source Parameters
char* aPtr nsACString& operator=(
char) - source Parameters
char a
Char Adopt void Adopt(const
char*, PRUint32) - source Parameters
char* aData PRUint32 aLength BeginReading PRUint32 BeginReading(const
char**, const
char**) const - source ...
...And 48 more matches
nsDependentCSubstring
Class Declaration nsTDependentSubstring_
CharT A string class which wraps an external array of string
characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
... Class Declaration nsTDependentSubstring_
CharT A string class which wraps an external array of string
characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
... Class Declaration nsTDependentSubstring_
CharT A string class which wraps an external array of string
characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
...And 47 more matches
nsDependentCSubstring external
Class Declaration Method Overview Constructors Rebind BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind...
...pendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsCStringContainer Data Members No public members. Methods Constructors void nsDependentCSubstring_external() - source void nsDependentCSubstring_external(const
char*, PRUint32) - source Parameters
char* aStart PRUint32 aLength void nsDependentCSubstring_external(c...
... void nsDependentCSubstring_external(const nsACString&, PRUint32) - source Parameters nsACString& aStr PRUint32 aStartPos void nsDependentCSubstring_external(const nsACString&, PRUint32, PRUint32) - source Parameters nsACString& aStr PRUint32 aStartPos PRUint32 aLength Rebind void Rebind(const
char*, PRUint32) - source Parameters
char* aStart PRUint32 aLength BeginReading PRUint32 BeginReading(const
char**, const
char**) const - source Returns the length, beginning, and end of a string in one operation. Parameters
char** begin
char** end
char* BeginReading() const - source EndR...
...And 46 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
NERATE_CSR, ADD_CERT_TO_DB, SAVE_CERT_TO_HEADER, ENCRYPT, DECRYPT, SIGN, VERIFY, UNKNOWN } CommandType; typedef enum { SYMKEY = 0, MACKEY = 1, IV = 2, MAC = 3, PAD = 4, PUBKEY = 5, LAB = 6, CERTENC= 7, CERTVFY= 8, SIG = 9 } HeaderType; /* * Print usage message and exit */ static void Usage(const
char *progName) { fprintf(stderr, "\nUsage: %s %s %s %s %s %s %s %s %s %s\n\n", progName, " -<G|A|H|E|DS|V> -d <dbdirpath> ", "[-p <dbpwd> | -f <dbpwdfile>] [-z <noisefilename>] [-a <\"\">]", "-s <subject> -r <csr> | ", "-n <nickName> -t <trust> -c <cert> [ -r <csr> -u <issuerNickname> [-x <\"\">] -m <serialNumber> ] | ", ...
...nerate a self-signed cert [optional]\n\n", "-x"); fprintf(stderr, "%-30s - to enable ascii [optional]\n\n", "-a"); fprintf(stderr, "%-30s - to save certificate to header file as sig verification [optional]\n\n", "-v"); exit(-1); } /* * Validate the options used for Generate CSR command */ static void ValidateGenerateCSRCommand(const
char *progName, const
char *dbdir, CERTName *subject, const
char *subjectStr, const
char *certReqFileName) { PRBool validationFailed = PR_FALSE; if (!subject) { PR_fprintf(PR_STDERR, "%s -G -d %s -s: improperly formatted name: \"%s\"\n", progName, db...
...t found\n", progName, dbdir, subjectStr); validationFailed = PR_TRUE; } if (validationFailed) { fprintf(stderr, "\nUsage: %s %s \n\n", progName, "-G -d <dbdirpath> -s <subject> -r <csr> \n"); exit(-1); } } /* * Validate the options used for Add Cert to DB command */ static void ValidateAddCertToDBCommand(const
char *progName, const
char *dbdir, const
char *nickNameStr, const
char *trustStr, const
char *certFileName, const
char *certReqFileName, const
char *issuerNameStr, const
char *serialNumberStr, ...
...And 45 more matches
nsDependentString external
Class Declaration dependent strings Method Overview Constructors Rebind get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerC...
... operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsString_external Data Members No public members. Methods Constructors void nsDependentString_external() - source void nsDependentString_external(const PRUni
char*, PRUint32) - source Parameters PRUni
char* aData PRUint32 aLength Rebind ...
... AppendInt ToInteger Base Classes nsString_external Data Members No public members. ...
...And 45 more matches
nsString external
Class Declaration basic strings Method Overview Constructors get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral ...
... operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. Methods Constructors void nsString_external() - source void nsString_external(const nsString_external&) - source Parameters nsString_external& aString void nsString_external(const nsAString&) - source ...
...a Members No public members. ...
...And 45 more matches
NS ConvertASCIItoUTF16 external
Class Declaration Method Overview Constructors get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find ...
... operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsString_external Data Members No public members. Methods Constructors void NS_ConvertASCIItoUTF16_external(const nsACString&) - source Parameters nsACString& aStr void NS_ConvertASCIItoUTF16_external(const
char*, PRUint32) - source Parameters
char* a...
...ase Classes nsString_external Data Members No public members. ...
...And 44 more matches
NS ConvertUTF8toUTF16 external
Class Declaration Method Overview Constructors get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find ...
... operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsString_external Data Members No public members. Methods Constructors void NS_ConvertUTF8toUTF16_external(const nsACString&) - source Parameters nsACString& aStr void NS_ConvertUTF8toUTF16_external(const
char*, PRUint32) - source Parameters
char* aDa...
... Base Classes nsString_external Data Members No public members. ...
...And 44 more matches
nsDependentSubstring
Class Declaration nsTDependentSubstring_
CharT A string class which wraps an external array of string
characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
... Class Declaration nsTDependentSubstring_
CharT A string class which wraps an external array of string
characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
... Class Declaration nsTDependentSubstring_
CharT A string class which wraps an external array of string
characters. It is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
...And 44 more matches
PromiseFlatString (External)
Class Declaration Method Overview get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind F...
... operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. Methods get PRUni
char* get() const - source operator= nsString_external& operator=(const nsString_external&) - source Parameters nsString_external& aString nsAString& operator=(const nsAStr...
...o public members. ...
...And 43 more matches
nsAutoString (External)
Class Declaration Method Overview get operator= Adopt BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind F...
... operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. Methods get PRUni
char* get() const - source operator= nsString_external& operator=(const nsString_external&) - source Parameters nsString_external& aString nsAString& operator=(const nsAStr...
...o public members. ...
...And 43 more matches
nsStringContainer (External)
Class Declaration Method Overview BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char ...
...erator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsAString Data Members No public members. ...
...erator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Base Classes nsAString Data Members No public members. ...
...And 43 more matches
nsDependentSubstring external
Class Declaration substrings Method Overview Constructors Rebind BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare(const PRUni
char*, PRInt32 (*) Compare(const nsAString&, PRInt32 (*) Equals(const PRUni
char*, PRInt32 (*) Equals(const nsAString&, PRInt32 (*) operator< operator<=...
...Methods Constructors void nsDependentSubstring_external() - source void nsDependentSubstring_external(const PRUni
char*, PRUint32) - source Parameters PRUni
char aStart PRUint32 aLength void nsDepen...
...Methods Constructors void nsDependentSubstring_external() - source void nsDependentSubstring_external(const PRUni
char*, PRUint32) - source Parameters PRUni
char aStart PRUint32 aLength void nsDependentSubstring_exter...
...And 41 more matches
Encrypt Decrypt_MAC_Using Token
AC-----" #define MAC_TRAILER "-----END MAC-----" #define PAD_HEADER "-----BEGIN PAD-----" #define PAD_TRAILER "-----END PAD-----" typedef enum { ENCRYPT, DECRYPT, UNKNOWN } CommandType; typedef enum { SYMKEY = 0, MACKEY = 1, IV = 2, MAC = 3, PAD = 4 } HeaderType; /* * Print usage message and exit. ...
...{ PR_fprintf(PR_STDERR, "Symmetric Key Generation Failed \n"); } return key; } /* * MacInit */ SECStatus MacInit(PK11Context *ctx) { SECStatus rv = PK11_DigestBegin(ctx); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestBegin()\n"); } return rv; } /* * MacUpdate */ SECStatus MacUpdate(PK11Context *ctx, unsigned
char *msg, unsigned int msgLen) { SECStatus rv = PK11_DigestOp(ctx, msg, msgLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : DigestOp()\n"); } return rv; } /* * Finalize MACing. */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen...
... */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestFinal()\n"); } return SECSuccess; } /* * Compute Mac. ...
...And 40 more matches
nsACString_internal
Class Declaration nsTSubstring is the most abstract class in the string hierarchy. It represents a single contiguous array of
characters, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES: nsAString for wide
characters nsACString for narrow
characters Many of the accessors on nsTSubstring are inlined as an optimization. <map id="classes" name="classes"> <area alt="" coords="456,5,605,53" href="http://developer.mozilla.org/en/nsACString_internal" shape="rect" title="nsACString_internal"> <area alt="" coords="415,101,497,149" href="http://developer.mozilla.org/en/nsCString" shape="rect" title="nsCString"> <area alt="" coords="521,101,689,149" href="http://developer.mozilla.org/en/n...
...tp://developer.mozilla.org/en/NS_ConvertUTF16toUTF8" shape="rect" title="NS_ConvertUTF16toUTF8"> <area alt="" coords="309,293,445,341" href="http://developer.mozilla.org/en/nsAdoptingCString" shape="rect" title="nsAdoptingCString"> </map> Method Overview Constructors BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char operator= Adopt Replace ReplaceASCII Append AppendASCII ...
... First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char operator= Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Data Members No public members. Methods Constructors void nsACString_internal(const nsCSubstringTuple&) - source this is public to support automatic conversion of tuple to string base type, which helps avoid converting to nsTASt...
...And 40 more matches
nsAString (External)
_ConvertASCIItoUTF16_external"> <area alt="" coords="491,294,733,342" href="http://developer.mozilla.org/en/NS_ConvertUTF8toUTF16_external" shape="rect" title="NS_ConvertUTF8toUTF16_external"> <area alt="" coords="757,294,869,342" href="http://developer.mozilla.org/en/nsLiteralString_(External)" shape="rect" title="nsLiteralString_(External)"> </map> Method Overview BeginReading EndReading
CharAt operator[] First BeginWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqual...
...nWriting EndWriting SetLength Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Data Members No public members. ...
...ppendLiteral operator+= Insert Cut Truncate Strip
Chars StripWhitespace Trim DefaultComparator Compare Equals operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find RFind Find
Char RFind
Char AppendInt ToInteger Data Members No public members. ...
...And 40 more matches
nsAString_internal
Class Declaration nsTSubstring is the most abstract class in the string hierarchy. It represents a single contiguous array of
characters, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES: nsAString for wide
characters nsACString for narrow
characters Many of the accessors on nsTSubstring are inlined as an optimization. <map id="classes" name="classes"> <area alt="" coords="415,5,553,53" href="http://developer.mozilla.org/en/nsAString_internal" shape="rect" title="nsAString_internal"> <area alt="" coords="379,101,451,149" href="http://developer.mozilla.org/en/nsString" shape="rect" title="nsString"> <area alt="" coords="475,101,635,149" href="http://developer.mozilla.org/en/nsDep...
...http://developer.mozilla.org/en/NS_ConvertUTF8toUTF16" shape="rect" title="NS_ConvertUTF8toUTF16"> <area alt="" coords="277,293,405,341" href="http://developer.mozilla.org/en/nsAdoptingString" shape="rect" title="nsAdoptingString"> </map> Method Overview Constructors BeginReading EndReading BeginWriting EndWriting Data Length IsEmpty IsVoid IsTerminated
CharAt operator[] First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char operator= Adopt Replace ReplaceASCII Append AppendASCII ...
... First Last Count
Char Find
Char Equals EqualsASCII EqualsLiteral(const
char EqualsLiteral(
char LowerCaseEqualsASCII LowerCaseEqualsLiteral(const
char LowerCaseEqualsLiteral(
char Assign AssignASCII AssignLiteral(const
char AssignLiteral(
char operator= Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const
char AppendLiteral(
char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid Strip
Char Data Members No public members. Methods Constructors void nsAString_internal(const nsSubstringTuple&) - source this is public to support automatic conversion of tuple to string base type, which helps avoid converting to nsTAStri...
...And 38 more matches
Enc Dec MAC Output Public Key as CSR
in nss wasn't. * FIXME: samples should determine the version of nss that's available and refuse * to run if not 3.13 or higher. ...
...te :"); fprintf(stderr, "%-7s .enc and .header as intermediate output files.\n\n", ""); fprintf(stderr, "%-7s For decrypt, it takes .enc and .header\n", ""); fprintf(stderr, "%-7s as input files and produces as a final output file.\n\n", ""); exit(-1); } /* Map option letter enumerated commad type */ static CommandType option2Command(const
char* c) { switch (*c) { case 'G': return GEN_CSR; case 'E': return ENCRYPT; case 'D': return DECRYPT; default: return UNKNOWN; } } /* * Wrap the symkey using public key */ SECStatus WrapKey(PK11SymKey* key, SECKEYPublicKey *pubKey, SECItem **wrappedKey) { SECStatus rv; SECItem *data = (SECItem *)PORT_ZAlloc(sizeof(SECItem)); if (!data) { PR_fprintf(PR_...
... using public key */ SECStatus WrapKey(PK11SymKey* key, SECKEYPublicKey *pubKey, SECItem **wrappedKey) { SECStatus rv; SECItem *data = (SECItem *)PORT_ZAlloc(sizeof(SECItem)); if (!data) { PR_fprintf(PR_STDERR, "Error while allocating memory\n"); rv = SECFailure; goto cleanup; } data->len = SECKEY_PublicKeyStrength(pubKey); data->data = (unsigned
char*)PORT_ZAlloc((data->len)*sizeof(unsigned int)); if (!data->data) { PR_fprintf(PR_STDERR, "Error while allocating memory\n"); rv = SECFailure; goto cleanup; } rv = PK11_PubWrapSymKey(CKM_RSA_PKCS, pubKey, key, data); if (rv != SECSuccess) { rv = SECFailure; } else { *wrappedKey = data; return SECSuccess; } cleanup: if (...
...And 33 more matches
EncDecMAC using token object - sample 3
---" #define IV_TRAILER "-----END IV-----" #define MAC_HEADER "-----BEGIN MAC-----" #define MAC_TRAILER "-----END MAC-----" #define PAD_HEADER "-----BEGIN PAD-----" #define PAD_TRAILER "-----END PAD-----" typedef enum { ENCRYPT, DECRYPT, UNKNOWN } CommandType; typedef enum { SYMKEY = 0, MACKEY = 1, IV = 2, MAC = 3, PAD = 4 } HeaderType; /* * Print usage message and exit */ static void Usage(const
char *progName) { fprintf(stderr, "\nUsage: %s -c -d [-z ] " "[-p | -f ] -i -o \n\n", progName); fprintf(stderr, "%-20s Specify 'a' for encrypt operation\n\n", "-c "); fprintf(stderr, "%-20s Specify 'b' for decrypt operation\n\n", " "); fprintf(stderr, "%-20s Specify db directory path\n\n", "-d "); fprintf(stderr, "%-20s Specify db password [optional]\n\n", "-p "); fprintf(stderr, "%-20s Specify db pa...
...anism, NULL, keySize, keyID, PR_TRUE, pwdata); if (!key) { PR_fprintf(PR_STDERR, "Symmetric Key Generation Failed \n"); } return key; } /* * MacInit */ SECStatus MacInit(PK11Context *ctx) { SECStatus rv = PK11_DigestBegin(ctx); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestBegin()\n"); } return rv; } /* * MacUpdate */ SECStatus MacUpdate(PK11Context *ctx, unsigned
char *msg, unsigned int msgLen) { SECStatus rv = PK11_DigestOp(ctx, msg, msgLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : DigestOp()\n"); } return rv; } /* * Finalize MACing */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen); if (rv != SECSuccess) { PR_fprintf(PR_...
...gestOp()\n"); } return rv; } /* * Finalize MACing */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestFinal()\n"); } return SECSuccess; } /* * Compute Mac */ SECStatus ComputeMac(PK11Context *ctxmac, unsigned
char *ptext, unsigned int ptextLen, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = MacInit(ctxmac); if (rv != SECSuccess) return rv; rv = MacUpdate(ctxmac, ptext, ptextLen); if (rv != SECSuccess) return rv; rv = MacFinal(ctxmac, mac, macLen, maxLen); return rv; } /* * WriteToHeaderFile */ SECStatus WriteToHeaderFile(const
char *buf, unsigned int len, HeaderType type, P...
...And 29 more matches
Encrypt Decrypt MAC Keys As Session Objects
MAC-----" #define MAC_TRAILER "-----END MAC-----" #define PAD_HEADER "-----BEGIN PAD-----" #define PAD_TRAILER "-----END PAD-----" typedef enum { ENCRYPT, DECRYPT, UNKNOWN } CommandType; typedef enum { SYMKEY = 0, MACKEY = 1, IV = 2, MAC = 3, PAD = 4 } HeaderType; /* * Print usage message and exit */ static void Usage(const
char *progName) { fprintf(stderr, "\nUsage: %s -c -d [-z ] " "[-p | -f ] -i -o \n\n", progName); fprintf(stderr, "%-20s Specify 'a' for encrypt operation\n\n", "-c "); fprintf(stderr, "%-20s Specify 'b' for decrypt operation\n\n", " "); fprintf(stderr, "%-20s Specify db directory path\n\n", "-d "); fprintf(stder...
...{ PR_fprintf(PR_STDERR, "Symmetric Key Generation Failed \n"); } return key; } /* * MacInit */ SECStatus MacInit(PK11Context *ctx) { SECStatus rv = PK11_DigestBegin(ctx); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestBegin()\n"); } return rv; } /* * MacUpdate */ SECStatus MacUpdate(PK11Context *ctx, unsigned
char *msg, unsigned int msgLen) { SECStatus rv = PK11_DigestOp(ctx, msg, msgLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : DigestOp()\n"); } return rv; } /* * Finalize MACing */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen)...
...g */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestFinal()\n"); } return SECSuccess; } /* * Compute Mac */ SECStatus ComputeMac(PK11Context *ctxmac, unsigned
char *ptext, unsigned int ptextLen, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = MacInit(ctxmac); if (rv != SECSuccess) return rv; rv = MacUpdate(ctxmac, ptext, ptextLen); if (rv != SECSuccess) return rv; rv = MacFinal(ctxmac, mac, macLen, maxLen); return rv; } /* * WriteToHeaderFile */ SECStatus WriteToHeaderFile(cons...
...And 28 more matches
Encrypt and decrypt MAC using token
MAC-----" #define MAC_TRAILER "-----END MAC-----" #define PAD_HEADER "-----BEGIN PAD-----" #define PAD_TRAILER "-----END PAD-----" typedef enum { ENCRYPT, DECRYPT, UNKNOWN } CommandType; typedef enum { SYMKEY = 0, MACKEY = 1, IV = 2, MAC = 3, PAD = 4 } HeaderType; /* * Print usage message and exit */ static void Usage(const
char *progName) { fprintf(stderr, "\nUsage: %s -c -d [-z ] " "[-p | -f ] -i -o \n\n", progName); fprintf(stderr, "%-20s Specify 'a' for encrypt operation\n\n", "-c "); fprintf(stderr, "%-20s Specify 'b' for decrypt operation\n\n", " "); fprintf(stderr, "%-20s Specify db directory path\n\n", "-d "); fprintf(stder...
...{ PR_fprintf(PR_STDERR, "Symmetric Key Generation Failed \n"); } return key; } /* * MacInit */ SECStatus MacInit(PK11Context *ctx) { SECStatus rv = PK11_DigestBegin(ctx); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestBegin()\n"); } return rv; } /* * MacUpdate */ SECStatus MacUpdate(PK11Context *ctx, unsigned
char *msg, unsigned int msgLen) { SECStatus rv = PK11_DigestOp(ctx, msg, msgLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : DigestOp()\n"); } return rv; } /* * Finalize MACing */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen)...
...g */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestFinal()\n"); } return SECSuccess; } /* * Compute Mac */ SECStatus ComputeMac(PK11Context *ctxmac, unsigned
char *ptext, unsigned int ptextLen, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = MacInit(ctxmac); if (rv != SECSuccess) return rv; rv = MacUpdate(ctxmac, ptext, ptextLen); if (rv != SECSuccess) return rv; rv = MacFinal(ctxmac, mac, macLen, maxLen); return rv; } /* * WriteToHeaderFile */ SECStatus WriteToHeaderFile(cons...
...And 28 more matches
NSS Sample Code Sample_3_Basic Encryption and MACing
N MAC-----" #define MAC_TRAILER "-----END MAC-----" #define PAD_HEADER "-----BEGIN PAD-----" #define PAD_TRAILER "-----END PAD-----" typedef enum { ENCRYPT, DECRYPT, UNKNOWN } CommandType; typedef enum { SYMKEY = 0, MACKEY = 1, IV = 2, MAC = 3, PAD = 4 } HeaderType; /* Print a usage message and exit */ static void Usage(const
char *progName) { fprintf(stderr, "\nUsage: %s -c <a|b> -d <dbdirpath> [-z <noisefilename>] " "[-p <dbpwd> | -f <dbpwdfile>] -i <ipfilename> -o <opfilename>\n\n", progName); fprintf(stderr, "%-20s Specify 'a' for encrypt operation\n\n", "-c <a|b>"); fprintf(stderr, "%-20s Specify 'b' for decrypt operation\n\n", " "); fprintf(stderr, ...
...{ PR_fprintf(PR_STDERR, "Symmetric Key Generation Failed \n"); } return key; } /* * MacInit */ SECStatus MacInit(PK11Context *ctx) { SECStatus rv = PK11_DigestBegin(ctx); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestBegin()\n"); } return rv; } /* * MacUpdate */ SECStatus MacUpdate(PK11Context *ctx, unsigned
char *msg, unsigned int msgLen) { SECStatus rv = PK11_DigestOp(ctx, msg, msgLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : DigestOp()\n"); } return rv; } /* * Finalize MACing */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen)...
...g */ SECStatus MacFinal(PK11Context *ctx, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = PK11_DigestFinal(ctx, mac, macLen, maxLen); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Compute MAC Failed : PK11_DigestFinal()\n"); } return SECSuccess; } /* * Compute Mac */ SECStatus ComputeMac(PK11Context *ctxmac, unsigned
char *ptext, unsigned int ptextLen, unsigned
char *mac, unsigned int *macLen, unsigned int maxLen) { SECStatus rv = MacInit(ctxmac); if (rv != SECSuccess) return rv; rv = MacUpdate(ctxmac, ptext, ptextLen); if (rv != SECSuccess) return rv; rv = MacFinal(ctxmac, mac, macLen, maxLen); return rv; } /* * Write To Header File */ SECStatus WriteToHeaderFile(c...
...And 28 more matches
Index
opeChain is supplied, it uses scopeChain as its enclosing scope. If scopeChain is omitted, it creates a new function object in cx's global. This can be helpful if funobj is an extant function that you wish to use as if it were enclosed by a newly-created global object. 31 JS::Compile JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::Compile compiles a script, srcBuf,
chars, bytes, or file, for execution. 32 JS::CompileFunction JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::CompileFunction compiles a function from a text string
chars, bytes, or srcBuf. 33 JS::CompileOffThread JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::CompileOffThread compiles a script,
chars for execution. 34 JS::Comp...
...ng on the context. In other words, it returns the global object on the current scope chain. 38 JS::DeflateStringToUTF8Buffer JSAPI Reference, Refere, SpiderMonkey JS::DeflateStringToUTF8Buffer encodes src as UTF8. The caller must either ensure dst has enough space to encode the entire string, or pass the length of the buffer as dstlenp. In which case, the function will encode
characters from the string until the buffer is exhausted. Does not write the null terminator. 39 JS::DoubleNaNValue JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::DoubleNaNValue returns a value of type JS::Value that represents an IEEE floating-point quiet Not-a-Number (NaN). 40 JS::DoubleValue JSAPI Reference, Reference, Reference(2), SpiderMonkey ...
...JavaScript value false. 43 JS::Float32Value JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::Float32Value converts a C floating-point number of type float to JS::Value, the type of JavaScript values. 44 JS::GetDeflatedUTF8StringLength JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::GetDeflatedUTF8StringLength returns the length of the
char buffer required to encode s as UTF8. The returned length does not include the null-terminator. 45 JS::GetFirstArgumentAsTypeHint JSAPI Reference, Reference, Reference(2), SpiderMonkey JS::GetFirstArgumentAsTypeHint converts first argument of @@toPrimitive method to JSType. 46 JS::GetSelfHostedFunction JSAPI Reference, Reference, Reference(2), SpiderMonkey ...
...And 27 more matches
IAccessibleText
he boundary types must be supported. This enum is used in textBeforeOffset(), textAtOffset(), and textAfterOffset(). ...
...long startOffset, [in] long endOffset ); [propget] HRESULT attributes([in] long offset, [out] long startOffset, [out] long endOffset, [out] BSTR textAttributes ); [propget] HRESULT caretOffset([out] long offset ); [propget] HRESULT
characterExtents([in] long offset, [in] enum IA2CoordinateType coordType, [out] long x, [out] long y, [out] long width, [out] long height ); [propget] HRESULT n
Characters([out] long n
Characters ); [propget] HRESULT newText([out] IA2TextSegment newText ); [propget] HRESULT nSelections([out] long nSelections ); [propget] HRESULT offsetAtPoint([in] long x, [in] long y, [in] enum IA2CoordinateType coordType, [out] long offset ); [propget] HRESULT oldText([out] IA2TextSegment oldText ); HRESULT removeSelection([in] long selectionIndex ); HRESULT scrol...
...g endOffset, [out] BSTR text ); [propget] HRESULT textBeforeOffset([in] long offset, [in] enum IA2TextBoundaryType boundaryType, [out] long startOffset, [out] long endOffset, [out] BSTR text ); Methods addSelection() Adds a text() selection(). HRESULT addSelection( [in] long startOffset, [in] long endOffset ); Parameters startOffset Starting offset ( 0 based). ...
...And 24 more matches
Regular expression syntax cheatsheet - JavaScript
This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide.
Character classes If you are looking to contribute to this document, please also edit the original article
Characters Meaning . Has one of the following meanings: Matches any single
character except line terminators: \n, \r, \u2028 or \u2029. For example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". Inside a
character set, the dot loses its special meaning and matches a literal dot. Note that the m multiline flag do...
...llowing meanings: Matches any single
character except line terminators: \n, \r, \u2028 or \u2029. For example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". Inside a
character set, the dot loses its special meaning and matches a literal dot. Note that the m multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the
character set [^] can be used -- it will match any
character including newlines. ES2018 added the s "dotAll" flag, which allows the dot to also match line terminators. \d Matches any digit (Arabic numeral). Equivalent to [0-9]. For example, /\d/ or /[0-9]/ matches "2" in "B2 is the suite number". ...
...ch a pattern across multiple lines, the
character set [^] can be used -- it will match any
character including newlines. ES2018 added the s "dotAll" flag, which allows the dot to also match line terminators. \d Matches any digit (Arabic numeral). Equivalent to [0-9]. For example, /\d/ or /[0-9]/ matches "2" in "B2 is the suite number". \D Matches any
character that is not a digit (Arabic numeral). Equivalent to [^0-9]. For example, /\D/ or /[^0-9]/ matches "B" in "B2 is the suite number". \w Matches any alphanumeric
character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_]. For example, /\w/ matches "a" in "apple", "5" in "$5.28", and "3" in "3D". ...
...And 23 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. 28 Baseline CSS, Glossary, SVG, alignment, typography The baseline is a term used in European and West Asian typography meaning an imaginary line upon which the
characters of a font rest. 29 BiDi Accessibility, Glossary BiDi (BiDirectional) refers to a document containing both right-to-left and left-to-right text. Even when both directionalities occur in the same paragraph, the text in each language must appear in its proper directionality. 30 BigInt BigInt, Glossary, JavaScript, Reference, arbitrary precision format ...
... header CORS, Fetch, Glossary, HTTP A CORS-safelisted response header is an HTTP header which has been safelisted so that it will not be filtered when responses are processed by CORS, since they're considered safe (as the headers listed in Access-Control-Expose-Headers). 51 CRLF CR, CRLF, Glossary, Infrastructure, LF, carriage return, line feed CR and LF are control
characters or bytecode that can be used to mark a line break in a text file. 52 CRUD Glossary, Infrastructure CRUD (Create, Read, Update, Delete) is an acronym for ways one can operate on stored data. It is a mnemonic for the four basic functions of persistent storage. CRUD typically refers to operations performed in a database or datastore, but it can also apply to higher level ...
...esponse authentication Security In security protocols, a challenge is some data sent to the client by the server in order to generate a different response each time. Challenge-response protocols are one way to fight against replay attacks where an attacker listens to the previous messages and resends them at a later time to get the same credentials as the original message. ...
...And 22 more matches
Utilities for nss samples
se utility functions are adapted from those found in * the sectool library used by the NSS security tools and * other NSS test applications. ...
...ssword */ PW_FROMFILE = 1, /* password stored in a file */ PW_PLAINTEXT = 2 /* plain-text password passed in buffer */ /* PW_EXTERNAL = 3 */ } source;
char *data; /* depending on source this can be the actual * password or the file to read it from */ } secuPWData; /* * PrintAsAscii */ extern void PrintAsAscii(PRFileDesc* out, const unsigned
char *data, unsigned int len); /* * PrintAsHex */ extern void PrintAsHex(PRFileDesc* out, const unsigned
char *data, unsigned int len); /* * GetDigit */ extern int GetDigit(
char c); /* * HexToBuf */ extern int HexToBuf(unsigned
char *inString, SECItem *outbuf, PRBool isHexData); /* * FileToItem */ extern SECStatus FileToItem(SECItem *dst, PRFileDesc *src); /* * CheckPassword */ extern P...
... len); /* * PrintAsHex */ extern void PrintAsHex(PRFileDesc* out, const unsigned
char *data, unsigned int len); /* * GetDigit */ extern int GetDigit(
char c); /* * HexToBuf */ extern int HexToBuf(unsigned
char *inString, SECItem *outbuf, PRBool isHexData); /* * FileToItem */ extern SECStatus FileToItem(SECItem *dst, PRFileDesc *src); /* * CheckPassword */ extern PRBool CheckPassword(
char *cp); /* * GetPassword */ extern
char * GetPassword(FILE *input, FILE *output,
char *prompt, PRBool (*ok)(
char *)); /* * FilePasswd extracts the password from a text file * * Storing passwords is often used with server environments * where prompting the user for a password or requiring it * to be entered in the commnd line is not a feasible optio...
...And 21 more matches
Key Values - Web APIs
KeyboardEvent.key Value Description Virtual Keycode Windows Mac Linux Android "Unidentified" The user agent wasn't able to map the event's virtual keycode to a specific key value. This can happen due to hardware or software constraints, or because of constraints around the platform on which the user agent is running. varies ...
...roid "Unidentified" The user agent wasn't able to map the event's virtual keycode to a specific key value. This can happen due to hardware or software constraints, or because of constraints around the platform on which the user agent is running. varies varies varies varies Modifier keys Modifiers are special keys which are used to generate special
characters or cause special actions when used in combination with other keys. Examples include the Shift and Control keys, and lock keys such as Caps Lock and NumLock. KeyboardEvent.key Value Description Virtual Keycode Windows Mac Linux Android "Alt" [5] The Alt (Alternative) key. VK_MENU (0x12) VK_LMENU (0xA4) VK_RMENU (0xA5) kVK_Option (0x...
... GDK_KEY_Mode_switch (0xFF7E) GDK_KEY_ISO_Level3_Shift (0xFE03) GDK_KEY_ISO_Level3_Latch (0xFE04) GDK_KEY_ISO_Level3_Lock (0xFE05) GDK_KEY_ISO_Level5_Shift (0xFE11) GDK_KEY_ISO_Level5_Latch (0xFE12) GDK_KEY_ISO_Level5_Lock (0xFE13) Qt::Key_AltGr (0x01001103 Qt::Key_Mode_switch (0x0100117E) "CapsLock" The Caps Lock key. Toggles the capital
character lock on and off for subsequent input. VK_CAPITAL (0x14) kVK_CapsLock (0x39) GDK_KEY_Caps_Lock (0xFFE5) Qt::Key_CapsLock (0x01000024) KEYCODE_CAPS_LOCK (115) "Control" The Control, Ctrl, or Ctl key. Allows typing control
characters. VK_CONTROL (0x11) VK_LCONTROL (0xA2) VK_RCONTROL (0xA3) kVK_Control (0x3B) kVK_RightControl (0x3E) GDK_KEY_Contro...
...And 21 more matches
Secure Development Guidelines
n logic based on results returned by the database SQL Injection: Example snprintf(str, sizeof(str), "SELECT * FROM account WHERE name ='%s'", name); sqlite3_exec(db, str, NULL, NULL, NULL); SQL Injection: Prevention Use parameterized queries Insert a marker for every piece of dynamic content so data does not get mixed with SQL instructions Example: sqlite3_stmt *stmt;
char *str = "SELECT * FROM account where name='?'"; sqlite3_prepare_v2(db, str, strlen(str), &stmt, NULL); sqlite3_bind_text(stmt, 1, name, strlen(name), SQLITE_TRANSIENT); sqlite3_step(stmt); sqlite3_finalize(p_stmt); Writing Secure Code: Arithmetic Issues Integer Overflows/Underflows Overflows occur when an arithmetic operation attempts to create a numeric value that is larger than can...
...); sqlite3_finalize(p_stmt); Writing Secure Code: Arithmetic Issues Integer Overflows/Underflows Overflows occur when an arithmetic operation attempts to create a numeric value that is larger than can be represented within the available storage space MAX + 1 will be 0 and 0 - 1 will be MAX! ...
...oo: 0x%08x\r\n", foo); } Integer Overflows/Underflows Example of an integer underflow int main() { unsigned int foo = 0; printf("foo: 0x%08x\r\n", foo); foo--; printf("foo: 0x%08x\r\n", foo); } Integer Overflows/Underflows Real-life example (bug 303213) JSBool js_str_escape(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval){ ... new
chars = (js
char *) JS_malloc(cx, (newlength + 1) * sizeof(js
char)); ... for (i = 0, ni = 0; i < length; i++) { if ((ch =
chars[i]) < 128 && IS_OK(ch, mask)) { new
chars[ni++] = ch; ... } ... } ... } Integer Overflows/Underflows: Prevention Difficult to fix: You need to check every arithmetic operation with user input Arithmetic libraries like...
...And 20 more matches
CData
in other words, the following JavaScript expression should return a copy of the original CData object: eval(dataObject.toSource()); toString() Returns a string identifying the data. String toString(); Parameters None. Return value A string identifying the data. Methods available on string objects These methods must be called on objects that are arrays or pointers to 8-bit or 16-bit
character or integer types, terminated by a null
character. readString() Converts a
character array to a JavaScript string. 8-bit strings are assumed to be encoded as UTF-8. If the 8-bit string contains invalid encoded
character, a TypeError exception is thrown. String readString(); Parameters None. Return value A new String object that is a copy of the original string contents. readStringR...
...ated by a null
character. readString() Converts a
character array to a JavaScript string. 8-bit strings are assumed to be encoded as UTF-8. If the 8-bit string contains invalid encoded
character, a TypeError exception is thrown. String readString(); Parameters None. Return value A new String object that is a copy of the original string contents. readStringReplaceMalformed() Converts a
character array to a JavaScript string. 8-bit strings are assumed to be encoded as UTF-8. If the 8-bit string contains invalid encoded
character, no exception is thrown. String readStringReplaceMalformed(); Parameters None. Return value A new String object that is a copy of the original string contents. Invalid encoded
characters will be replaced by ?(U+FFFD). Here is a method to read "malfo...
... Parameters None. Return value A new String object that is a copy of the original string contents. Invalid encoded
characters will be replaced by ?(U+FFFD). ...
...And 19 more matches
nsIDocShell
ndowTarget, in string aTypeHint, in nsIInputStream aPostDataStream, in nsIInputStream aHeadersStream, in unsigned long aLoadFlags, in nsISHEntry aSHEntry, in boolean firstParty, out nsIDocShell aDocShell, out nsIRequest aRequest); Native code only! boolean isBeingDestroyed(); void loadStream(in nsIInputStream aStream, in nsIURI aURI, in ACString aContentType, in ACString aContent
Charset, in nsIDocShellLoadInfo aLoadInfo); Native code only! void loadURI(in nsIURI uri, in nsIDocShellLoadInfo loadInfo, in unsigned long aLoadFlags, in boolean firstParty); Native code only! void prepareForNewContentModel(); void resumeRefreshURIs(); void setChildOffset(in unsigned long offset); Native code only! void setCurrentURI(in nsIURI aURI); ...
...boolean Tells the docshell whether the canvas should have focus. Called by the focus manager when the user tabs to the frame rather than an element. Obsolete since Gecko 1.9.2 channelIsUnsafe boolean Find out if the currently loaded document came from a suspicious channel (such as a JAR channel where the server-returned content type is not a known JAR type). Read only. ...
... a known JAR type). Read only.
charset string The converter to use when reading the document's data. In Mozilla code, all text is encoded as Unicode. When reading a document, a converter is used to translate the text from its original format into Unicode. This attribute lets you: See what converter was used when retrieving the document's data. Override that
character set for documents for which the specified fallback or auto-detected
character set is incorrect. Reading this value reports the encoding that was used when loading the data into the document. Setting this attribute overrides the encoding; however, to update the DOM or display of the content, you need have the data reparsed. ...
...And 18 more matches
Working with data
ated directly into the new one. If type is an array type of unspecified length, the following steps are taken: If the value is a size value, a new array of that length is created, with its cells ready to accept values of the same type as those in the specified array. This is the same as new ArrayType(type.elementType, value). If the type represents a JavaScript string (that is, an array of js
char characters followed by a null terminator), a copy of that string is created and returned. If the type is an array of 8-bit
characters and value is a UTF-16 string, the new CData object is the result of converting the UTF-16 string to UTF-8, with a null terminator. If the value is a JavaScript array object and it has a non-negative length, a new array is created and the contents of the array spe...
...is ctypes.void_t, a TypeError is thrown. Example: Creating an array let arrayType = ctypes.ArrayType(ctypes.int32_t); let myArray = new arrayType(5); At this point, myArray.length is 5; there are 5 entries in the array. myArray.constructor.size is 20; the total size of the array's data buffer is 20 bytes (5 entries, 4 bytes apiece). ...
...xample: Creating an array let arrayType = ctypes.ArrayType(ctypes.int32_t); let myArray = new arrayType(5); At this point, myArray.length is 5; there are 5 entries in the array. myArray.constructor.size is 20; the total size of the array's data buffer is 20 bytes (5 entries, 4 bytes apiece). ...
...And 18 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
nent' C++/JS This document was authored by Hiroshi Shimoda of Clear Code Inc. and was originally published in Japanese for the Firefox Developers Conference Summer 2007. Mr. Shimoda is a co-author of Firefox 3 Hacks (O'Reilly Japan, 2008). This chapter explains how to use XPCOM to implement advanced processes using only JavaScript. Introduction JavaScript lacks functions for opening files and
character-code conversion, among other things. A different mechanism is needed to perform these functions. Internet Explorer handles this using ActiveX; in Firefox, we use the Cross-Platform Component Object Model, or XPCOM. Due to deprecation of enablePrivilege this functionality can not be used in web pages. EnablePrivilege is disabled in Firefox 15 and will be removed in Firefox 17. About XPCOM ...
... at the API reference and the interface definitions from XPIDL in the actual source code. Note: Interface Definition Language (IDL) is a language for giving standard definitions of objects, methods, and so forth. The XPIDL (Cross-Platform IDL) used by Mozilla is a partial extension to the CORBA IDL. You can perform a full-text search of the Firefox source code in Mozilla Cross-Reference using
character strings, filenames, etc as search keys. If you're having trouble with any of the details of the interface, it is helpful to search on the source code for usage examples within Firefox. Note: To look at the Firefox 3 source code, choose "Firefox 3" in the Starting Points list. For Firefox 3.5 choose "Mozilla 1.9.1." For the current development trunk of Firefox, choose "Mozilla Central" and...
...al file, as shown in Listing 6. When you initialize this by passing the full path to the file with the nsILocalFile.initWithPath() method, it becomes available to all functions. It doesn't matter whether a file at the specified path already exists. Note: Use the path format suited to your platform: the Windows "\" path delimiter is interpreted as an escape code, so should always be written "\\";
characters like "./" on Linux require no special handling. Listing 6: Creating an XPCOM object representing a file var file = Components.classes['@mozilla.org/file/local;1'] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath('C:\\temp\\temp.txt'); Creating and deleting files Listing 7 shows how to delete a file if it exists, and create a new file with the same name.
...And 17 more matches
Grammar and types - JavaScript
For example, the word Fruh (which means "early" in German) could be used as a variable name. ...
...the detailed reference about JavaScript's lexical grammar.) It is considered best practice, however, to always write a semicolon after a statement, even when it is not strictly needed. This practice reduces the chances of bugs getting into the code. ...
...t practice, however, to always write a semicolon after a statement, even when it is not strictly needed. This practice reduces the chances of bugs getting into the code. The source text of JavaScript script gets scanned from left to right, and is converted into a sequence of input elements which are tokens, control
characters, line terminators, comments, or whitespace. (Spaces, tabs, and newline
characters are considered whitespace.) Comments The syntax of comments is the same as in C++ and in many other languages: // a one line comment /* this is a longer, * multi-line comment */ /* You can't, however, /* nest comments */ SyntaxError */ Comments behave like whitespace, and are discarded during script execution. Note: You might also see a third type of comment syntax at the start o...
...And 17 more matches
JSAPI User Guide
class of the global object. static JSClass globalClass = { "global", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr, nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook }; // The error reporter callback. void reportError(JSContext *cx, const
char *message, JSErrorReport *report) { fprintf(stderr, "%s:%u:%s\n", report->filename ? report->filename : "[no filename]", (unsigned int) report->lineno, message); } int run(JSContext *cx) { // Enter a request before running anything in the context. JSAutoRequest ar(cx); // Create the global object and a new compartment. RootedObject glob...
... the new global object's compartment. JSAutoCompartment ac(cx, global); // Populate the global object with the standard globals, like Object and // Array. if (!JS_InitStandardClasses(cx, global)) return 1; // Your application code here. This may include JSAPI calls to create your // own custom JS objects and run scripts. return 0; } int main(int argc, const
char *argv[]) { // Initialize the JS engine. if (!JS_Init()) return 1; // Create a JS runtime. JSRuntime *rt = JS_NewRuntime(8L * 1024L * 1024L); if (!rt) return 1; // Create a context. JSContext *cx = JS_NewContext(rt, 8192); if (!cx) return 1; JS_SetErrorReporter(rt, reportError); int status = run(cx); // Shut everything down. ...
... will be "inherited" by all instances through delegation up the instance's prototype link. */ my_props, my_methods, /* class constructor properties and methods */ my_static_props, my_static_methods); Running scripts /* These should indicate source location for diagnostics. */
char *filename; unsigned int lineno; /* * The return value comes back here -- if it could be a GC thing, you must * add it to the GC's "root set" with JS_Add*Root(cx, &thing) where thing * is a JSString *, JSObject *, or jsdouble *, and remove the root before * rval goes out of scope, or when rval is no longer needed. */ jsval rval; JSBool ok; /* * Some example source in a C string. Larger, n...
...And 16 more matches
Starting WebLock
ere is a match, you can handle the event any way you see fit. If the object has only registered for one notification, then you can ignore the aTopic string and simply handle the event as it occurs. In other words, the Observe method should never be called in response to some event for which the object is not registered. NS_IMETHODIMP WebLock::Observe(nsISupports *aSubject, const
char *aTopic, const PRUni
char *aData) { return NS_OK; } Notification via the observer service is somewhat indirect. The only way to register directly for a notification via the observer service is to instantiate an nsIObserver object. This works for most cases, but consider the case when you have this notification create a component. Since the component hasn't been created yet, th...
...d is called. This callback allows the component to execute any one-time registration code it may need. The inverse of this function is the unregistration callback, where it's a good idea to undo whatever the registration function did. The two functions look like this: static NS_METHOD WebLockRegistration(nsIComponentManager *aCompMgr, nsIFile *aPath, const
char *registryLocation, const
char *componentType, const nsModuleComponentInfo *info); static NS_METHOD WebLockUnregistration(nsIComponentManager *aCompMgr, nsIFile *aPath, const
char *registryLocation, const nsModuleComponentInfo *info); The names of the functions can be anything you wish. Bot...
...ort not only services but component instances as well. For the app-startup notification, you must explicitly pass the string "service," prior to the component's Contract ID. If you do not, the component will be created and then released after the notification, which may cause the component to be deleted. ...
...And 16 more matches
nsIAccessibleText
le/public/nsIAccessibleText.idlScriptable Please add a summary to this article. ...
...c/nsIAccessibleText.idlScriptable Please add a summary to this article. ...
...d a summary to this article. ...
...And 16 more matches
Reading textual data - Archive of obsolete content
This article describes how to read textual data from streams, files and sockets. In order to read textual data, you need to know which
character encoding the data is in. Files and network sockets contain bytes, not
characters - to give these bytes a meaning, you need to know the
character encoding. XXX: Document nsIUni
charStreamListener (gecko 1.8) XXX: Also document nsIStreamListener here? Determining the
character encoding of data If you have a network channel (nsIChannel), you can try the content
Charset property of it. Note that not all channels know the
character encoding of the data. You can fallback to the default
character encoding stored in preferences (intl.
charset.default, a localized pref value) When reading from a file, the question is harder to answer. Using the syste...
...etermining the
character encoding of data If you have a network channel (nsIChannel), you can try the content
Charset property of it. Note that not all channels know the
character encoding of the data. You can fallback to the default
character encoding stored in preferences (intl.
charset.default, a localized pref value) When reading from a file, the question is harder to answer. Using the system
character encoding may work (XXX insert text how to get it), or again the default
character encoding from preferences. Converting read data If you read data from nsIScriptableInputStream as described on the file I/O code snippets page, you can convert it to UTF-8 // sstream is nsIScriptableInputStream var str = sstream.read(4096); var utf8Converter = Components.classes["@mozilla.org/intl/utf8conver...
...sses["@mozilla.org/intl/utf8converterservice;1"]. getService(Components.interfaces.nsIUTF8ConverterService); var data = utf8Converter.convertURISpecToUTF8 (str, "UTF-8"); Gecko 1.8 and newer Reading strings Starting with Gecko 1.8 (SeaMonkey 1.0, Firefox 1.5), you can use nsIConverterInputStream to read strings from a stream (nsIInputStream). This work was done in bug 295047. ...
...And 15 more matches
source-editor.jsm
Boolean canUndo(); void endCompoundChange(); Boolean redo(); void resetUndo(); void startCompoundChange(); Boolean undo(); Display management operations void focus(); Number getTopIndex(); Boolean hasFocus(); void setTopIndex(Number aTopIndex); Content management operations Number get
CharCount(); String getIndentationString(); String getLineDelimiter(); Number getLineCount(); Number getLineEnd(Number aLineIndex, Boolean aIncludeDelimiter); Number getLineStart(Number aLineIndex); String getMode(); String getText([optional] Number aStart, [optional] Number aEnd); String getSelectedText(); void setMod...
...optional] Object aOptions ); Parameters aString Optional The string for which to search. If not specified, the currently selected text in the editor is used as the search string. aOptions Optional An optional object containing properties customizing the search operation. See Find options for details. Return value Returns an integer indicating the offset into the text at which the first
character of the found string is located, or -1 if the string wasn't found. Find options The aOptions object can customize the search operation. It may have the following properties: Property Type Description backwards Boolean If true, the search begins at start (or the end of the text, if start is not specified) and progresses toward the beginning of the text. Otherwi...
... line Number The 0-based line number on which the breakpoint is set. condition String The condition string that was specified when the breakpoint was set. getCaretOffset() Returns the current caret position (insertion point) as an offset into the text. Number getCaretOffset(); Parameters None. Return value The 0-based offset into the text at which newly-typed
characters will be inserted. getCaretPosition() Returns an object describing the position of the caret (insertion point) in terms of its line number and column. Object getCaretPosition(); Parameters None. Return value The returned object describes the caret position: Property Type Description line Number The 0-based line number on which the caret is located. ...
...And 15 more matches
NSS Sample Code Utilities_1
> #include <unistd.h> #include <sys/stat.h> #include <prprf.h> #include "util.h" /* * These utility functions are adapted from those found in * the sectool library used by the NSS security tools and * other NSS test applications. ...
...stat.h> #include <prprf.h> #include "util.h" /* * These utility functions are adapted from those found in * the sectool library used by the NSS security tools and * other NSS test applications. ...
...out) { PR_fprintf(out, "\n"); } /* * PrintAsAscii */ void PrintAsAscii(PRFileDesc* out, const unsigned
char *data, unsigned int len) {
char *b64Data = NULL; b64Data = BTOA_DataToAscii(data, len); PR_fprintf(out, "%s", b64Data); PR_fprintf(out, "\n"); if (b64Data) { PORT_Free(b64Data); } } /* * PrintAsHex */ void PrintAsHex(PRFileDesc* out, const unsigned
char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i != len - 1) { PR_fprintf(out, "%02x:", data[i]); column += 3; } else { PR_fprintf(out, "%02x",...
...And 15 more matches
nsIFile
e of any file or directory at the position represented by the nsIFile and create, move or copy items in the filesystem. An nsIFile can be retrieved by either instantiating an nsILocalFile using a platform specific path string or by using cross-platform locations retrieved from the directory service. All methods with string parameters have two forms. ...
...nted by the nsIFile and create, move or copy items in the filesystem. An nsIFile can be retrieved by either instantiating an nsILocalFile using a platform specific path string or by using cross-platform locations retrieved from the directory service. All methods with string parameters have two forms. The preferred form operates on UTF-16 encoded
characters strings. An alternate form operates on
characters strings encoded in the "native"
charset. A string containing
characters encoded in the native
charset cannot be safely passed to javascript via xpconnect. Therefore, the UTF-16 forms are scriptable, but the "native methods" are not. In addition, the native form cannot deal with files whose name contains
characters outside the default system code page on Windows. Using the native form limits...
...undefined behavior. leafName AString This attribute exposes the name of the nsIFile without any directory components. Changing the leaf name of a nsIFile does not affect the underlying filesystem. It only changes what this nsIFile references. nativeLeafName ACString This attribute exposes the name of the nsIFile without any directory components. [native
character encoding variant] Changing the leaf name of a nsIFile does not affect the underlying filesystem. It only changes what this nsIFile references. Native code only! nativePath ACString This attribute exposes the full path of the nsIFile. [native
character encoding variant] The value of this attribute is a platform-specific file path. Read only. Native code only! ...
...And 15 more matches
Gecko Keypress Event
Gecko 1.9 key handling changed significantly after Beta 5 (bug 359638, bug 429510 and the bugs on which they depend). The changes were risky so late in the release schedule, but they were necessary for fixing the many key handling bugs.
charCode of DOM keypress event If a keypress event is fired without any modifier keys (Ctrl/Alt(Option)/Meta(Win/Command)), then the properties of the event are the same as they were in Gecko1.8.1. That is, when the currently selected keyboard layout produces a Unicode
character (according to the current state of CapsLock and NumLock), the
charCode property contains that
character. When the keypress event includes modifier keys, sometimes the
charCode value is replaced with an ASCII
character according to the following rules. The accel key depends ...
...rent state of CapsLock and NumLock), the
charCode property contains that
character. When the keypress event includes modifier keys, sometimes the
charCode value is replaced with an ASCII
character according to the following rules. The accel key depends on the platform. Ctrl is the accel key on Windows and Linux, while Meta (i.e. Command) is the accel key on Mac. When the accel key is down, the
charCode of a keypress event may be replaced with a
character from a Latin keyboard layout only when the original
character is not an ASCII
character. This behavior helps the internationalization of web applications that have custom shortcut keys. ...
...s the accel key on Windows and Linux, while Meta (i.e. Command) is the accel key on Mac. When the accel key is down, the
charCode of a keypress event may be replaced with a
character from a Latin keyboard layout only when the original
character is not an ASCII
character. This behavior helps the internationalization of web applications that have custom shortcut keys. If Gecko doesn't replace the
charCode with an ASCII
character, the web application developers would need to consider all non-Latin keyboard layouts (Arabic, Greek, Hebrew, Russian, etc.). The
charCode value depends on the state of CapsLock and NumLock (except they are currently ignored if Alt (Option) is down on Mac - see bug 432953). There are also some differences between the platforms, as described in the following sections. ...
...And 14 more matches
<input type="email"> - HTML: Hypertext Markup Language
to ensure that they're formatted properly. ...
...to the attributes that operate on all <input> elements regardless of their type, email inputs support the following attributes: Attribute Description list The id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength The maximum number of
characters the input should accept minlength The minimum number of
characters long the input can be and still be considered valid multiple Whether or not to allow multiple, comma-separated, e-mail addresses to be entered pattern A regular expression the input's contents must match in order to be valid placeholder An exemplar value to display in the input field whenever it is empty readonly A Boolean attribute indicating...
...The <datalist> provides a list of predefined values to suggest to the user for this input. Any values in the list that are not compatible with the type are not included in the suggested options. The values provided are suggestions, not requirements: us...
...And 14 more matches
Writing textual data - Archive of obsolete content
This article describes how to write textual data to streams, files and sockets in an internationalization-aware way. When writing textual data to an output stream or to a file, you need to pick a
character encoding. Some
character encodings (UTF-8, UTF-16, UTF-32) can represent "all"
characters (the full repertoire of Unicode) while others can only represent a subset of the full repertoire. When the file is to be read only by the application/extension itself, using UTF-8 is often the best choice -- it can represent all
characters, and ASCII
characters are represented efficiently. ...
...(the full repertoire of Unicode) while others can only represent a subset of the full repertoire. When the file is to be read only by the application/extension itself, using UTF-8 is often the best choice -- it can represent all
characters, and ASCII
characters are represented efficiently. ...
...while others can only represent a subset of the full repertoire. When the file is to be read only by the application/extension itself, using UTF-8 is often the best choice -- it can represent all
characters, and ASCII
characters are represented efficiently. ...
...And 13 more matches
Getting started with HTML - Learn web development
ee your changes update live in the Output area. If you make a mistake, you can clear your work using the Reset button. If you get really stuck, press the Show solution button to see the answer. Playable code <h2>Live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>Editable code</h2> <p class="a11y-label">Press Esc to move focus away from the code area (Tab inserts a tab
character).</p> <textarea id="code" class="playable-code" style="min-height: 100px;width: 95%"> This is my text. </textarea> <div class="controls"> <input id="reset" type="button" value="Reset" /> <input id="solution" type="button" value="Show solution" /> </div> html { font-family: 'Open Sans Light',Helvetica,Arial,sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; tex...
...the element name, and between each attribute. If you make a mistake, you can always reset it using the Reset button. If you get really stuck, press the Show solution button to see the answer. ...
.../www.example.com' title='Isn't this fun?'>A link to my example.</a> Instead, you need to do this: <a href='http://www.example.com' title='Isn't this fun?'>A link to my example.</a> Anatomy of an HTML document Individual HTML elements aren't very useful on their own. Next, let's examine how individual elements combine to form an entire HTML page: <!DOCTYPE html> <html> <head> <meta
charset="utf-8"> <title>My test page</title> </head> <body> <p>This is my page</p> </body> </html> Here we have: <!DOCTYPE html>: The doctype. When HTML was young (1991-1992), doctypes were meant to act as links to a set of rules that the HTML page had to follow to be considered good HTML. Doctypes used to look something like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran...
...And 13 more matches
Embedding API for Accessibility
nt over the network. ...
...at in debug builds, this can cause a great number of assertions (bug 71598) To use prefs in embedding, use something like the following code: #include "nsIPref.h"; nsresult rv; nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv)); prefs->SetBoolPref("bool.pref.name", PR_TRUE /* or PR_FALSE */); prefs->SetIntPref("int.pref.name", newValue); prefs->Set
CharPref("string.pref.name", new
CharStarValue); To manually add a pref to your settings, add a line like the following to your prefs.js: user_pref("accessibility.browsewithcaret", true); Accessibility Prefs Reference The following is a description of what accessibility prefs give us (or will give us), for accessibility: Functionality Implementation Works as of ...
... 0.8 Cookies SetIntPref("network.cookie.cookieBehavior", behavior); /* behavior: 0=Accept, 1=Accept cookies from originating server only, 2=no cookies */ SetBoolPref("network.cookie.warnAboutCookies", boolWarn); Moz 0.8 Fonts Set
CharPref("font.name.monospace.x-western", newFontName); Set
CharPref("font.name.serif.x-western", newFontName); Set
CharPref("font.name.sans-serif.x-western", newFontName); /* For other i18n
charsets, change x-western to x-central-euro, x-cyrillic, x-unicode, x-user-def, x-baltic, el, tr, he, ar, th, ja, zh-CN or zh-TW */ ...
...And 13 more matches
nsIDBFolderInfo
Obsolete since Gecko 1.8 void getMailb...
...Obsolete since Gecko 1.8 void getMailboxName(in nsString boxName...
...Obsolete since Gecko 1.8 void getMailboxName(in nsString boxName); Native code only! Obsolete since Gecko 1.8 ...
...And 13 more matches
XPIDL
ways to make types: a typedef, a native, or an interface. In addition, there are a few built-in native types. The built-in native types are those listed under the type_spec production above. ...
...make types: a typedef, a native, or an interface. In addition, there are a few built-in native types. The built-in native types are those listed under the type_spec production above. ...
...es: a typedef, a native, or an interface. In addition, there are a few built-in native types. The built-in native types are those listed under the type_spec production above. ...
...And 13 more matches
Battery Status API - Web APIs
The Battery Status API, more often referred to as the Battery API, provides information about the system's battery
charge level and lets you be notified by events that are sent when the battery level or
charging status change. This can be used to adjust your app's resource usage to reduce battery drain when the battery is low, or to save changes before the battery runs out in order to prevent data loss. The Battery Status API extends window.navigator with a navigator.getBattery() method returning a battery promise, which is resolved in a BatteryManager object providing also some new events you can handle to monitor the battery status. ...
...when the battery is low, or to save changes before the battery runs out in order to prevent data loss. The Battery Status API extends window.navigator with a navigator.getBattery() method returning a battery promise, which is resolved in a BatteryManager object providing also some new events you can handle to monitor the battery status. ...
...e battery runs out in order to prevent data loss. The Battery Status API extends window.navigator with a navigator.getBattery() method returning a battery promise, which is resolved in a BatteryManager object providing also some new events you can handle to monitor the battery status. Example In this example, we watch for changes both to the
charging status (whether or not we're plugged in and
charging) and for changes to the battery level and timing. ...
...And 13 more matches
TextEncoder.prototype.encodeInto() - Web APIs
an s.length bytes and never greater than s.length * 3 bytes. If the output allocation (typically within Wasm heap) is expected to be short-lived, it makes sense to simply allocate s.length * 3 bytes for the output, in which case the first conversion attempt is guaranteed to convert the whole string. Note that the s.length * 3 is rare because the string would have to be packed with some of the few
characters that expant into 3 bytes. It is unlikely that long text will exceed s.length * 2 bytes in length. Thus, a more optimistic approach might be to allocate s.length * 2 + 5 bytes, and perform reallocation in the rare circumstance that the optimistic prediction was wrong. If the output is expected to be long-lived, it makes sense to compute minimum allocation roundUpToBucketSize(s.length), the...
...terminator. That is, on the Wasm side you are working with Rust strings or a non-zero-terminating C++ class. If you are working with C++ std::string, even though the logical length is shown to you, you need to take the extra terminator byte into account when computing rounding up to allocator bucket size. See the next section about C strings. No Zero-Termination If the input string contains the
character U+0000 in the input, encodeInto() will write a 0x00 byte in the output. encodeInto() does not write a C-style 0x00 sentinel byte after the logical output. If your Wasm program uses C strings, it's your responsibility to write the 0x00 sentinel and you can't prevent your Wasm program from seeing a logically truncated string if the JavaScript string contained U+0000. Observe: var encoder = n...
...yfill The polyfill below may be a bit long because of the switch cases and utilization of native TextEncoder.prototype.encode in Safari when available, but it is well worth the length because of the gains in performance. ...
...And 13 more matches
Architecture - Accessibility
ntainer with more embedded objects. However in accessibility hierarchies such as ATK and IAccessible2, text is not exposed in leaf nodes as it is in a W3C DOM. The text is actually exposed via a special text interface in the parent of the text nodes. It is concatenated together with all its sibling text nodes, and embedded objects between the text nodes are exposed as the unicoded embedded object
character '\xfffc'. One reason for this is that there are fewer nodes to pass across process, and that improves performance. Node types Text content (ROLE_TEXT) objects are implemented by nsTextAccessible. Their text is actually exposed in their parent nsHyperTextAccessible via nsIAccessibleText. When the hierarchy is finally exposed to ATK they are stripped out. They are in the nsIAccessible hiera...
... When the hierarchy is finally exposed to ATK they are stripped out as leaf nodes, but the \n remains in the containing text. They are in the nsIAccessible hierarchy to make it easy for nsHyperTextAccessible to piece its text representation together. Everything else uses whatever nsAccessible-derived implementation that's appropriate. If it has text siblings, then it gets exposed as the unicode
char for an embedded object, which is '\xfffc' within the parent nsHyperTextAccessible. In addition, nsIAccessibleHyperLink is implemented on any non-text child inside a container that also has text. This allows AT's to find its position within that text, because the hyperlink interface exposes a start and end index. In fact, the end index will always be 1 larger than the start index, because the obje...
...hin the parent nsHyperTextAccessible. In addition, nsIAccessibleHyperLink is implemented on any non-text child inside a container that also has text. This allows AT's to find its position within that text, because the hyperlink interface exposes a start and end index. In fact, the end index will always be 1 larger than the start index, because the object is always represented by a single '\xfffc'
character. If you want to know that something is really a link, check to see if it is ROLE_LINK. HTML containers are implemented by nsHyperTextAccessible. They support the nsIAccessibleHyperText is implemented on any container element that has both text and embedded objects for accessible children. Why HyperLink is often not a link As explained above, anything that is embedded in text implements th...
...And 13 more matches
<input type="password"> - HTML: Hypertext Markup Language
<input> elements of type password provide a way for the user to securely enter a password. The element is presented as a one-line plain text editor control in which the text is obscured so that it cannot be read, usually by replacing each
character with a symbol such as the asterisk ("*") or a dot ("o"). This
character will vary depending on the user agent and OS. The source for this interactive example is stored in a GitHub repository. ...
...ll vary depending on the user agent and OS. 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. Specifics of how the entry process works may vary from browser to browser; mobile devices, for example, often display the typed
character for a moment before obscuring it, to allow the user to be sure they pressed the key they meant to press; this is helpful given the small size of keys and the ease with which the wrong one can be pressed, especially on virtual keyboards. Note: Any forms involving sensitive information like passwords (e.g. login forms) should be served over HTTPS; Many browsers now implement mechanisms to wa...
...ing 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 pattern attribute is specified, the content of a password control is only considered valid if the value passes validation; see Validation for more information. Note: The line feed (U+000A) and carriage return (U+000D)
characters are not permitted in a password value. When setting the value of a password control, line feed and carriage return
characters are stripped out of the value. Additional attributes In addition to the attributes that operate on all <input> elements regardless of their type, password field inputs support the following attributes: Attribute Description maxlength T...
...And 13 more matches
<input type="text"> - HTML: Hypertext Markup Language
ls), the value may be an empty string (""). ...
... to the attributes that operate on all <input> elements regardless of their type, text inputs support the following attributes: Attribute Description list The id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength The maximum number of
characters the input should accept minlength The minimum number of
characters long the input can be and still be considered valid pattern A regular expression the input's contents must match in order to be valid placeholder An exemplar value to display in the input field whenever it is empty readonly A Boolean attribute indicating whether or not the contents of the input should be read-only size A number indicating how ...
...The <datalist> provides a list of predefined values to suggest to the user for this input. Any va...
...And 13 more matches
Regular expressions - JavaScript
In JavaScript, regular expressions are also objects. These patterns are used with the exec() and test() methods of RegExp, and with the match(), matchAll(), replace(), replaceAll(), search(), and split() methods of String. This chapter describes JavaScript regular expressions. Creating a regular expression You construct a regular expression in one of two ways: Using a regular expression literal, which consists of a pattern enclosed between slashes, as follows: let re = /ab+c/; Regular expression literals provide compilation of the regular expression when the script is loaded. ...
...: let re = new RegExp('ab+c'); Using the constructor function provides runtime compilation of the regular expression. Use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and are getting it from another source, such as user input. Writing a regular expression pattern A regular expression pattern is composed of simple
characters, such as /abc/, or a combination of simple and special
characters, such as /ab*c/ or /Chapter (\d+)\.\d*/. The last example includes parentheses, which are used as a memory device. The match made with this part of the pattern is remembered for later use, as described in Using groups. Note: If you are already familiar with the forms of a regular expression, you may also read the cheatsheet...
...The last example includes parentheses, which are used as a memory device. The match made with this part of the pattern is remembered for later use, as described in Using groups. Note: If you are already familiar with the forms of a regular expression, you may also read the cheatsheet for a quick lookup for a specific pattern/construct. Using simple patterns Simple patterns are constructed of
characters for which you want to find a direct match. For example, the pattern /abc/ matches
character combinations in strings only when the exact sequence "abc" occurs (all
characters together and in that order). Such a match would succeed in the strings "Hi, do you know your abc's?" and "The latest airplane designs evolved from slabcraft." In both cases the match is with the substring "abc". There i...
...And 13 more matches
SVG documentation index - SVG: Scalable Vector Graphics
VG elements. 18 SVG Styling Attributes Attribute, Beginner, NeedsExample, Reference, SVG The SVG styling attributes are all the attributes that can be specified on any SVG element to apply CSS styling effects. 19 accent-height Deprecated, NeedsExample, SVG, SVG Attribute The accent-height attribute defines the distance from the origin to the top of accent
characters, measured by a distance within the font coordinate system. 20 accumulate NeedsCompatTable, NeedsExample, SVG, SVG Attribute This attribute controls whether or not the animation is cumulative. 21 additive NeedsCompatTable, NeedsExample, SVG, SVG Attribute No summary! 22 alignment-baseline SVG, SVG Attribute The alignment-baseline...
... Deprecated, SVG, SVG Attribute The cap-height attribute defines the height of uppercase glyphs of the font within the font coordinate system. 39 class Reference, SVG, SVG Attribute Assigns a class name or set of class names to an element. You may assign the same class name or names to any number of elements, however, multiple class names must be separated by whitespace
characters. 40 clip SVG, SVG Attribute The clip attribute is a presentation attribute defining the visible region of an element. 41 clip-path SVG, SVG Attribute The clip-path presentation attribute defines or associates a clipping path with the element it is related to. 42 clip-rule SVG, SVG Attribute The clip-rule attribute only applies t...
...ibute represents the kd value in the Phong lighting model. In SVG, this can be any non-negative number. 58 direction SVG, SVG Attribute The direction attribute specifies the inline-base direction of a <text> or <tspan> element. It defines the start and end points of a line of text as used by the text-anchor and inline-size properties. It also may affect the direction in which
characters are positioned if the unicode-bidi property's value is either embed or bidi-override. 59 display SVG, SVG Attribute The display attribute lets you control the rendering of graphical or container elements. 60 divisor Filters, SVG, SVG Attribute The divisor attribute specifies the value by which the resulting number of applying the kernelMatrix of a <...
...And 13 more matches
Index - Archive of obsolete content
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 data. In the past, this had to be simulated by treating the raw data as a string and using the
charCodeAt() method to read the bytes from the data buffer. 213 Tabbox No summary! 214 Toolbar Add-ons, Code snippets, Extensions, Toolbars No summary! 215 Tree Code snippets No summary! 216 URI parsing No summary! 217 View Source for XUL Applications No summary! 218 Windows Add-o...
...ared to the old xpinstall/-style extensions. 241 Firefox addons developer guide The original document is in Japanese and distributed via the xuldev.org website. So there may be still some reference to the xuldev website (we want to host source code on MDC, not on xuldev), and to Japanese things (like some specific locales, which have been translated to French since non-latin
characters are not well supported). 242 Hiding browser chrome Add-ons, Extensions, XUL, XULBrowserWindow There are times in which an extension may find it useful to hide browser chrome (that is, toolbars, the location bar, and so forth), in order to reduce clutter when presenting a particular user interface. This is done, for example, by the about:addons page. 243 Hotfi...
... 411 install.rdf Copy the following text and paste it into a text file, then save that file as "install.rdf": 412 Creating a hybrid CD Developing Mozilla, Outdated_articles No summary! 413 Creating regular expressions for a microsummary generator Microsummaries, Obsolete A regular expression is a special kind of string (i.e. a sequence of
characters) that matches patterns of
characters in other strings. Microsummary generators use them to identify the pages that the generators know how to summarize by matching patterns in those pages' URLs. 414 DTrace Archive, DTrace, Performance, Profiling, QA, Testing DTrace is Sun Microsystem's dynamic tracing framework that allows developers to instrument a program with probes...
...And 12 more matches
The new nsString class implementation (1999) - Archive of obsolete content
mizations, internationalization and usage patterns. Disclaimer: I absolutely hate string classes. No one has ever devised one that more than 2 programmers can agree on. So, why then am I proposing this? Well, nsString has served us well so far, but it's in need of a facelift. And XPCOM has really taken off, so nsString needs to be brought into alignment. Justification The nsString class is a wide
character string class used throughout all of Gecko (and other modules) as the default implementation. However, it suffers from a few implementation details which need to be addressed and that are the subject of this document. The deficiencies of the current implementation are: Class based -- making it unsuitable for cross-dll usage due to fragility Little intrinsic i18n support Few efficiencies, ...
...o (and other modules) as the default implementation. However, it suffers from a few implementation details which need to be addressed and that are the subject of this document. ...
...cies of the current implementation are: Class based -- making it unsuitable for cross-dll usage due to fragility Little intrinsic i18n support Few efficiencies, notably a lack of support for narrow (1-byte)
character strings No support for external memory management policy Lack of XPCOM interface Notable features of the new nsStrImpl implementation are: Intrinsic support for 1 and 2 byte
character widths Provides automatic conversion between strings with different
character sizes Inviolate base structure eliminates class fragility problem; safe across DLL boundaries Offers C-style function API to manipulate nsStrImpl Offers simple memory allocator API for specialized memory policy Shares binary format with BString Coming soon: a new XPCOM (nsIString) interface Non-templatized; ...
...And 12 more matches
IME handling guide
t. It handles native key events before or after focused application (depending on the platform) and creates a composition string (a.k.a. preedit string), suggests a list of what the user attempts to input, commits composition string as a selected item off the list and commits composition string without any conversion. IME is used by Chinese, Japanese, Korean and Taiwan users for inputting Chinese
characters because the number of them is beyond thousands and cannot be input from the keyboard directly. However, especially on mobile devices nowadays, IME is also used for inputting Latin languages like autocomplete. Additionally, IME may be used for handwriting systems or speech input systems on some platforms. If IME is available on focused elements, we call that state "enabled". If IME is not f...
...s also used for inputting Latin languages like autocomplete. Additionally, IME may be used for handwriting systems or speech input systems on some platforms. If IME is available on focused elements, we call that state "enabled". If IME is not fully available(i.e., user cannot enable IME), we call this state "disabled". If IME is enabled but users use direct input mode (e.g., for inputting Latin
characters), we call it "IME is closed". Otherwise, we call it "IME is open". (FYI: "open" is also called "active" or "turned on". "closed" is also called "inactive" or "turned off") So, this document is useful when you're try to fix a bug for text input in Gecko. Composition string and clauses Typical Japanese IME can input two or more words into a composition string. When a user converts from Hir...
...), we call it "IME is closed". Otherwise, we call it "IME is open". (FYI: "open" is also called "active" or "turned on". "closed" is also called "inactive" or "turned off") So, this document is useful when you're try to fix a bug for text input in Gecko. Composition string and clauses Typical Japanese IME can input two or more words into a composition string. When a user converts from Hiragana
characters to Chinese
characters the composition string, Japanese IME separates the composition string into multiple clauses. For example, if a user types "watasinonamaehanakanodesu", it's converted to Hiragana
characters, "?????????????", automatically (In the following screenshots, the composition string has a wavy underline and the only one clause is called "raw input clause"). When a user pre...
...And 12 more matches
Internationalized Domain Names (IDN) Support in Mozilla Browsers
Introduction Netscape 7.1 is the first commercial browser that has built-in support for Internationalized Domain Name under the new IETF RFC's established in 2003. An Internationalized Domain Name (IDN) is a domain/host name which uses non-ASCII
characters. Until recently domain names allowed only a subset of 7-bit ASCII
characters. As the Internet has spread to non-English speaking people around the world, it has become increasingly clear that forcing them to use domain names written only in a subset of the Latin Alphabet is not ideal. Many of the European languages use the basic Latin Alphabet with additional accented
characters for writing but they were not able to use them in domain names. There are many languages whose writing scripts are not based on Latin Alphabet at all. Spe...
...re not able to use them in domain names. There are many languages whose writing scripts are not based on Latin Alphabet at all. Speakers of these languages were not able to use familiar names in their native languages as part of Internet domain/host names. For the past few years, there have been a flurry of IETF activities to standardize the protocols involved in domain names to handle non-ASCII
characters. In March of 2003, three important RFC's were approved by IETF. (Cf. RFC's 3490, 3491, 3492.) These new RFC's now make it possible for domain name servers to register non-ASCII domain names and application/client vendors to implement standardized support for handling non-ASCII
characters in domain names. How IDN Works When a browser sees a host name such as http://developer.mozilla.org, i...
... How IDN Works When a browser sees a host name such as http://developer.mozilla.org, it passes a request to the DNS resolver service (usually built into an OS), which in turn sends a request to a nearest domain name server to return an IP address that corresponds to the host name. This IP address is then used to connect to the web server in question. ...
...And 12 more matches
NSS Sample Code Sample_2_Initialization of NSS
NSS Sample Code 2: Initializing NSS This example program demonstrates how to initialize the NSS Database. This program illustrates password handling. ...
... " [-f <passwdffile>]\n\n", progName); fprintf(stderr, "%-15s Specify a DB directory path\n\n", "-d <dbdirpath>"); fprintf(stderr, "%-15s Specify a plaintext password\n\n", "-p <plainpasswc>"); fprintf(stderr, "%-15s Specify a password file\n\n", "-f <plainpasswc>"); exit(-1); } /* Initialize the slot password */
char *InitSlotPassword(PK11SlotInfo *slot, PRBool retry, void *arg) { FILE *input; FILE *output;
char *p0 = NULL;
char *p1 = NULL; secuPWData *pwdata = (secuPWData *) arg; if (pwdata->source == PW_FROMFILE) { return FilePasswd(slot, retry, pwdata->data); } if (pwdata->source == PW_PLAINTEXT) { return PL_strdup(...
...pwdata->data); } /* open terminal */ input = fopen("/dev/tty", "r"); if (input == NULL) { PR_fprintf(PR_STDERR, "Error opening input terminal for read\n"); return NULL; } /* we have no password, so initialize database with one */ PR_fprintf(PR_STDERR, "Enter a password which will be used to encrypt your keys.\n" "The password should be at least 8
characters long,\n" "and should contain at least one non-alphabetic
character.\n\n"); output = fopen("/dev/tty", "w"); if (output == NULL) { PR_fprintf(PR_STDERR, "Error opening output terminal for write\n"); return NULL; } for (;;) { if (p0) PORT_Free(p0); p0 = GetPassword(input, output, "Enter new password: ", ...
...And 12 more matches
Initialize NSS database - sample 2
NSS sample code 2: initialize the NSS database. The NSS sample code below demonstrates how to initialize the NSS database. ...
... { fprintf(stderr, "\nUsage: %s -d [-p ]" " [-f ]\n\n", progName); fprintf(stderr, "%-15s Specify a DB directory path\n\n", "-d "); fprintf(stderr, "%-15s Specify a plaintext password\n\n", "-p "); fprintf(stderr, "%-15s Specify a password file\n\n", "-f "); exit(-1); } /* * InitSlotPassword */
char * InitSlotPassword(PK11SlotInfo *slot, PRBool retry, void *arg) { FILE *input; FILE *output;
char *p0 = NULL;
char *p1 = NULL; secuPWData *pwdata = (secuPWData *) arg; if (pwdata->source == PW_FROMFILE) { return FilePasswd(slot, retry, pwdata->data); } if (pwdata->source == PW_PLAINTEXT) { return PL_strdup...
...pwdata->data); } /* open terminal */ input = fopen("/dev/tty", "r"); if (input == NULL) { PR_fprintf(PR_STDERR, "Error opening input terminal for read\n"); return NULL; } /* we have no password, so initialize database with one */ PR_fprintf(PR_STDERR, "Enter a password which will be used to encrypt your keys.\n" "The password should be at least 8
characters long,\n" "and should contain at least one non-alphabetic
character.\n\n"); output = fopen("/dev/tty", "w"); if (output == NULL) { PR_fprintf(PR_STDERR, "Error opening output terminal for write\n"); return NULL; } for (;;) { if (p0) PORT_Free(p0); p0 = GetPassword(input, output, "Enter new password: ", ...
...And 12 more matches
Index
t Manager, Embedding Mozilla, NeedsUpdate, XPCOM Sometimes it's necessary for XPCOM components to receive notifications as to the progress of the application's startup process, so they can start new services at appropriate times, for example. 119 XPCOM Stream Guide Guide, NeedsContent, XPCOM In Mozilla code, a stream is an object which represents access to a sequence of
characters. It is not that sequence of
characters, though: the
characters may not all be available when you read from the stream. 120 XPCOM array guide Guide, NeedsContent, NeedsMarkupWork, XPCOM Mozilla has many array classes because each array is optimized for a particular usage pattern. This guide describes the available arrays as well as the enumerator classes that can be use...
...ed in conjunction with the IAccessibleText interface and complements that interface with the additional capability of clipboard operations. Note that even a read only text object can support the copy capability so this interface is not limited to editable objects. The substrings used with this interface are specified as follows: If startOffset is less than endOffset, the substring starts with the
character at startOffset and ends with the
character just before endOffset. If endOffset is lower than startOffset, the result is the same as a call with the two arguments exchanged. The whole text can be defined by passing the indices zero and IAccessibleText.n
Characters(). If both indices have the same value, an empty string is defined. Refer to the @ref _specialOffsets "Special Offsets for use in t...
... 388 nsIChannelPolicy Interfaces, Interfaces:Scriptable, XPCOM, XPCOM Interface Reference This interface exists to allow the content policy mechanism to function properly during channel redirects. Channels can be created with this interface placed in the property bag and upon redirect, the interface can be transferred from the old channel to the new channel. 389 nsI
CharsetResolver Interfaces, Interfaces:Scriptable, Obsolete, XPCOM, XPCOM Interface Reference Some implementations may request that they be notified when the
charset is actually detected. 390 nsIChromeFrameMessageManager Interfaces, Interfaces:Scriptable, XPCOM, XPCOM Interface Reference Loads a script into the remote frame. 391 nsIChromeRegistry Interface...
...And 12 more matches
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
problems and make manipulation of the content tree difficult in unexpected ways, depending on where it is located. This article explores when difficulties can occur, and looks at what can be done to mitigate resulting problems. What is whitespace? Whitespace is any string of text composed only of spaces, tabs or line breaks (to be precise, CRLF sequences, carriage returns or line feeds). These
characters allow you to format your code in a way that will make it easily readable by yourself and other people. In fact, much of our source code is full of these whitespace
characters, and we only tend to get rid of it in a production build step to reduce code download sizes. HTML largely ignores whitespace? In the case of HTML, whitespace is largely ignored -- whitespace in between words is treat...
...u to format your code in a way that will make it easily readable by yourself and other people. In fact, much of our source code is full of these whitespace
characters, and we only tend to get rid of it in a production build step to reduce code download sizes. HTML largely ignores whitespace? ...
...res whitespace? In the case of HTML, whitespace is largely ignored -- whitespace in between words is treated as a single
character, and whitespace at the start and end of elements and outside elements is ignored. Take the following minimal example: <!DOCTYPE html> <h1> Hello World! </h1> This source code contains a couple of line feeds after the DOCTYPE and a bunch of space
characters before, after, and inside the <h1> element, but the browser doesn't seem to care at all and just shows the words "Hello World!" as if these
characters didn't exist at all: This is so that whitespace
characters don't impact the layout of your page. Creating space around and inside elements is the job of CSS. What does happen to whitespace? They don't just disappear, however. Any white...
...And 12 more matches
<input type="search"> - HTML: Hypertext Markup Language
ext string or an empty string (""). ...
...attributes that operate on all <input> elements regardless of their type, search field inputs support the following attributes: Attribute Description list The id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength The maximum number of
characters the input should accept minlength The minimum number of
characters long the input can be and still be considered valid pattern A regular expression the input's contents must match in order to be valid placeholder An exemplar value to display in the input field whenever it is empty readonly A Boolean attribute indicating whether or not the contents of the input should be read-only size A number indicating how ...
...The <datalist> provides a list of predefined values to suggest to the user for this input. Any va...
...And 12 more matches
The "codecs" parameter in common media types - Web media technologies
codec, the type used for the audio tracks, and so forth. This guide briefly examines the syntax of the media type codecs parameter and how it's used with the MIME type string to provide details about the contents of audio or video media beyond simply indicating the container type. General syntax A basic MIME media type is expressed by stating the type of media (audio, video, etc), then a slash
character (/), then the container format used to contain the media: audio/mpeg An audio file using the MPEG file type, such as an MP3. video/ogg A video file using the Ogg file type. video/mp4 A video file using the MPEG-4 file type. video/quicktime A video file in Apple's QuickTime format. As noted elsewhere, this format was once commonly used on the web but no longer is, since it required ...
... by separating them with commas. audio/ogg; codecs=vorbis An Ogg file containing a Vorbis audio track. video/webm; codecs="vp8, vorbis" A WebM file containing VP8 video and/or Vorbis audio. video/mp4; codecs="avc1.4d002a" An MPEG-4 file containing AVC (H.264) video, Main Profile, Level 4.2. As is the case with any MIME type parameter, codecs must be changed to codecs* (note the asterisk
character, *) if any of the properties of the codec use special
characters which must be percent-encoded per RFC 2231, section 4: MIME Parameter Value and Encoded Word Extensions. You can use the JavaScript encodeURI() function to encode the parameter list; similarly, you can use decodeURI() to decode a previously encoded parameter list. When the codecs parameter is used, the specified list of codec...
... on ISO Base Media File Format (ISO BMFF), so they share the same syntax. AV1 The syntax of the codecs parameter for AV1 is defined the AV1 Codec ISO Media File Format Binding specification, section 5: Codecs Parameter String. av01.P.LLT.DD[.M[.CCC[.cp[.tc[.mc[.F]]]]]] This codec parameter string's components are described in more detail in the table below. Each component is a fixed number of
characters long; if the value is less than that length, it must be padded with leading zeros. AV1 codec parameter string components Component Details P The one-digit profile number: AV1 profile numbers Profile number Description 0 "Main" profile; supports YUV 4:2:0 or monochrome bitstreams ...
...And 12 more matches
Useful string methods - Learn web development
Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. ...
...n your learning journey. But there are a few that you'll potentially use quite often that we'll look at here. Let's enter some examples into the browser developer console. Finding the length of a string This is easy -- you simply use the length property. ...
...e = 'mozilla'; browserType.length; This should return the number 7, because "mozilla" is 7
characters long. This is useful for many reasons; for example, you might want to find the lengths of a series of names so you can display them in order of length, or let a user know that a username they have entered into a form field is too long if it is over a certain length. Retrieving a specific string
character On a related note, you can return any
character inside a string by using square bracket notation -- this means you include square brackets ([]) on the end of your variable name. ...
...And 11 more matches
JS::CompileOptions
via a window.onerror handler) for juicy morsels of its contents. To counter this attack, HTML5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded. Callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in JSErrorReports. const
char *filename() const Returns filename of the source code. const
char *introducerFilename() const Returns filename of the file which introduces the file. const
char16_t *sourceMapURL() const Returns the URL of the source map. Methods of JS::OwningCompileOptions Method Description JSObject *element() const Returns the DOM element to which...
...ribute, this returns the name of that attribute, a string. Otherwise, this returns NULL. JSScript *introductionScript() const Returns a pointer to JSScript which introduces the file. bool copy(JSContext *cx, const ReadOnlyCompileOptions &rhs) Copy compile options from rhs. Returns false if it failed to duplicate owning properties. ...
...r to JSScript which introduces the file. bool copy(JSContext *cx, const ReadOnlyCompileOptions &rhs) Copy compile options from rhs. Returns false if it failed to duplicate owning properties. bool setFile(JSContext *cx, const
char *f) Duplicate null-terminated string f for filename(). Returns false if it failed to duplicate. bool setFileAndLine(JSContext *cx, const
char *f, unsigned l) Duplicate null-terminated string f for filename() and set lineno property. Returns false if it failed to duplicate. ...
...And 11 more matches
<input type="url"> - HTML: Hypertext Markup Language
d to ensure that they're formatted properly. ...
...n to the attributes that operate on all <input> elements regardless of their type, url inputs support the following attributes: Attribute Description list The id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength The maximum number of
characters the input should accept minlength The minimum number of
characters long the input can be and still be considered valid pattern A regular expression the input's contents must match in order to be valid placeholder An exemplar value to display in the input field whenever it is empty readonly A Boolean attribute indicating whether or not the contents of the input should be read-only size A number indicating how ...
...The <datalist> provides a list of predefined values to suggest to the user for this input. Any va...
...And 11 more matches
Reading from Files - Archive of obsolete content
e to a file and then creating an input stream to read from it. An input stream provides a means of reading bytes, strings or other values from the file. While there is only one method to create an input stream, it provides a number of options to control exactly how reading is performed. For instance, there are options to read a file as if it were text or a binary file. Using the former will cause
characters in the stream to be interpreted with a particular
character encoding. In addition, lines may be read by reading the file up until a linefeed
character is detected. A binary stream would be used to read bytes or numbers encoded within the file. To create an input stream, first get a reference to a nsIFile, and then use nsIScriptableIO.newInputStream() to open a stream for reading from it. To...
...that you expect this file to be text file. This method actually takes a number of additional arguments, however they are optional so they do not need to be specified if they aren't needed. These extra arguments will be discussed later. You can also specify to read from a binary file by using the flag 'binary' instead of 'text'. The difference is that text streams process the bytes being read into
characters in a particular
character encoding whereas binary streams always read bytes. First, let's look at reading form text files. Reading Text Files
Characters are interpreted from a text input stream using a specified
character encoding. This means that if a
character within the file occupies several bytes, it will converted into a single
character when read. This is done automatically as long as...
...ytes. First, let's look at reading form text files. Reading Text Files
Characters are interpreted from a text input stream using a specified
character encoding. This means that if a
character within the file occupies several bytes, it will converted into a single
character when read. This is done automatically as long as you specify the 'text' flag to nsIScriptableIO.newInputStream(). The default
character encoding is UTF-8 which means that
characters below value 128 will occupy a single byte whereas
characters above value 128 will occupy multiple bytes, depending on their value. However, a number of other
character encodings are available; see Reading Other
Character Encodings below for details about reading text in other encodings. There are several methods available to read from an input st...
...And 10 more matches
textbox - Archive of obsolete content
s are clicked(or scales are dragged). The default value is 1. label Type: string If present and not empty, this will be exposed to screen readers through the label property. Type: integer The maximum value that the scale or number box may be set to. The default value is 100 for scales and Infinity for number boxes. maxlength Type: integer The maximum number of
characters that the textbox allows to be entered. min Type: integer The minimum value the textbox's value may take. The default value is 0. multiline Type: boolean If true, the textbox displays multiple lines. If the user presses Enter, a new line is started. If false, the textbox only allows entry of one line. newlines Type: one of the values below How the te...
...al number of rows in the element, use the getRowCount method. searchbutton Type: boolean If true, the search field will only fire a command event when the user presses the search button or presses the Enter key. Otherwise, the command event is fired whenever the user modifies the value. This attribute only applies to textboxes with the type search. size Type: integer The number of
characters that can be displayed in the textbox. spellcheck Type: boolean If true, spell checking is enabled by default for the text box; if false, spell checking is disabled by default. If not specified, this defaults to false The HTML The spellcheck attribute uses values of true or false (you cannot simply add the spellcheck attribute to a given element): <!-- spellcheck everything! -...
...plete textboxes, the number of milliseconds before the textbox starts searching for completions. The default is 50 milliseconds. For search textboxes, the number of milliseconds before the timer fires a command event. The default is 500 milliseconds. For timed textboxes, the number of milliseconds before the timer fires a command event. There is no default. The timer starts after the user types a
character. If the user types another
character, the timer resets. type Type: one of the values below You can set the type attribute to one of the values below for a more specialized type of textbox. Don't set the type if you wish to use a regular textbox. autocomplete A textbox that supports autocomplete. For more information about autocomplete textboxes, see the autocomplete documenta...
...And 10 more matches
nsINavHistoryService
This can be used in UI to determine whether the "clear history" button should be enabled or not. This is much better than using BrowserHistory.count since that can be ve...
...This can be used in UI to determine whether the "clear history" button should be enabled or not. This is much better than using BrowserHistory.count since that can be very slow if there is a lot of history (it must enume...
...This can be used in UI to determine whether the "clear history" button should be enabled or not. This is much better than using BrowserHistory.count since that can be very slow if there is a lot of history (it must enumerate each item). This is pretty fast. ...
...And 10 more matches
String - JavaScript
Description Strings are useful for holding data that can be represented in text form. Some of the most-used operations on strings are to check their length, to build and concatenate them using the + and += string operators, checking for the existence or location of substrings with the indexOf() method, or extracting substrings with the substring() method. ...
...ive"; const string2 = 'Also a string primitive'; const string3 = `Yet another string primitive`; const string4 = new String("A String object"); String primitives and string objects can be used interchangeably in most situations. See "String primitives and String objects" below. ...
...ing4 = new String("A String object"); String primitives and string objects can be used interchangeably in most situations. See "String primitives and String objects" below. String literals can be specified using single or double quotes, which are treated identically, or using the backtick
character `. This last form specifies a template literal: with this form you can interpolate expressions.
Character access There are two ways to access an individual
character in a string. The first is the
charAt() method: return 'cat'.
charAt(1) // returns "a" The other way (introduced in ECMAScript 5) is to treat the string as an array-like object, where individual
characters correspond to a numerical index: return 'cat'[1] // returns "a" When using bracket notation for
character access, attemptin...
...And 10 more matches
Encodings for localization files
ant to be aware of the encoding of the files that you generate. In general, files in the Mozilla repositories are UTF-8 encoded. There are a few exceptions, though. Installer The Windows installer can't handle UTF-8, but only the codepages provided by Windows. ...
...les that you generate. In general, files in the Mozilla repositories are UTF-8 encoded. There are a few exceptions, though. Installer The Windows installer can't handle UTF-8, but only the codepages provided by Windows. ...
...are a few exceptions, though. Installer The Windows installer can't handle UTF-8, but only the codepages provided by Windows. This is tricky to hook up in the build process, so here it goes: File Encoding Notes toolkit/installer/windows/
charset.mk ASCII The WIN_INSTALLER_
CHARSET variable must be set to an encoding which matches toolkit/installer/windows/install.it
CHARSET= parameter. See the table below for appropriate values. toolkit/installer/windows/install.it A Windows codepage. This must match the
CHARSET= parameter in this file, and the WIN_INSTALLER_
CHARSET parameter in
charset.mk The FONTNAME/FONTSIZE/
CHARSET parameters in this file must be set to good values. For most Western scripts, 'MS Sans Serif' and '8' are good defaults for the fon...
...And 9 more matches
Mozilla Web Developer FAQ
ted markup may cause strange 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 property name and the value is the colon--not the equal sign. HTML markup, such as <style>, does not belong in .css files. font-face is not a real CSS property. The property is font-family and @font-face is an at-rule. If @import is used, it should be the first thing in a CSS file. CSS parsing errors are reported to the JavaScript console. Is the server s...
...ince Firefox 3.5. The fonts have to be served from the same origin (protocol, host, port) as the content that uses them unless the fonts are served with the appropriate Cross-Origin Resource Sharing HTTP headers. Downloadable fonts in the EOT format are not supported. If you use downloadable fonts, please make sure the fonts have the right Unicode mappings and the content uses the right Unicode
characters. The past practice of displaying non-Latin text by assigning non-Latin glyphs to Latin code points breaks copying and pasting, breaks searching on the page, breaks indexing by search engines and breaks readability in browsers that do not support downloadable fonts (e.g. legacy browsers or mobile browsers that opt not to download fonts due to file size). Why aren't symbol/dingbat fonts work...
...e of displaying non-Latin text by assigning non-Latin glyphs to Latin code points breaks copying and pasting, breaks searching on the page, breaks indexing by search engines and breaks readability in browsers that do not support downloadable fonts (e.g. legacy browsers or mobile browsers that opt not to download fonts due to file size). Why aren't symbol/dingbat fonts working? They are working.
Characters in HTML 4 and XML documents are Unicode
characters (even if the document has been encoded using a legacy encoding for transfer)--not font glyph indexes. <font face="Symbol">a</font> means the
character LATIN SMALL LETTER A (U+0061) preferably displayed using the Symbol font. Since the Symbol font does not have glyph for that
character, another font is used. If you mean ?, you should use GR...
...And 9 more matches
Mail composition back end
Warning: The content of this article may be out of date. It was imported from mozilla.org and last updated in 2000. by Ri
chard H. Pizzarro <rhp@netscape.com> Contents Overview Sending Messages nsIMsgSend Sending Listener Interfaces nsIMsgSendListener nsIMsgCopyServiceListener Copy Operations Copy to Sent Folder Drafts Templates "Send Later" Sending Unsent Messages Sending Unsent Messages Listener Quoting Sample Programs Overview I've done considerable work in the past few weeks reorganizing the Mail Composition back end, so I thought it would be helpful to put together a small doc on the new interfaces and how one can use them. The Mail Composition back end is responsible for the assembly and creation of...
...set for the various modes of delivery. These can include nsMsgDeliverNow, nsMsgQueueForLater, nsMsgSave, nsMsgSaveAs, nsMsgSaveAsDraft, nsMsgSaveAsTemplate. nsIMessage *msgToReplace, - if the delivery mode is set to nsMsgSaveAsDraft, this is a pointer to the the nsIMessage object for the message that needs to be replaced const
char *attachment1_type, const
char *attachment1_body, PRUint32 attachment1_body_length, - the full text of the first attachment is provided via `attachment1_type' `attachment1_body' and `attachment1_body_length'. These may all be 0 if all attachments are provided externally. ...
... nsIMsgSendListener The following describes the methods of the nsIMsgSendListener interface: OnStartSending The OnStartSending interface is called when the sending operation has begun. This is called after messages creation has completed. If message creation fails, the nsIMsgSend operation will return an NS_FAILED() return code. ...
...And 9 more matches
<input type="tel"> - HTML: Hypertext Markup Language
s an empty string (""). ...
...The <datalist> provides a list of predefined values to suggest to the user for this input. Any values in the list that are not compatible with the type are not included in the suggested options. The values provided are suggestions, not require...
...ist> element located in the same document. The <datalist> provides a list of predefined values to suggest to the user for this input. Any values in the list that are not compatible with the type are not included in the suggested options. The values provided are suggestions, not requirements: users can select from this predefined list or provide a different value. maxlength The maximum number of
characters (as UTF-16 code units) the user can enter into the telephone number field. This must be an integer value 0 or higher. If no maxlength is specified, or an invalid value is specified, the telephone number field has no maximum length. This value must also be greater than or equal to the value of minlength. The input will fail constraint validation if the length of the text entered into the fi...
...And 9 more matches
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
failing directory, adding the /showIncludes directive to figure out what is being included incorrectly: make -C directory/that/failed OS_CPPFLAGS=-showIncludes The frozen string API is similar but not identical to the nonfrozen string API. The frozen string API does not have (or need) nsXPIDLString: - nsXPIDLString value; + nsString value; ptr->GetterMethod(getter_Copies(value)); - const PRUni
char *strvalue = value; + // nsString doesn't cast directly to PRUni
char*, use .get()+ const PRUni
char *strvalue = value.get(); The frozen string API doesn't accept a length for .Truncate(). Use .SetLength() instead: nsString myString = someString; - myString.Truncate(4); + myString.SetLength(4); The frozen string API doesn't support the iterator or const_iterator classes, but you can use pointer...
...ept a length for .Truncate(). ...
...en string API doesn't support the iterator or const_iterator classes, but you can use pointers the same way: nsString myString = someString; - nsString::const_iterator begin, end;- myString.BeginReading(begin); myString.EndReading(end); + const PRUni
char *begin, *end;+ myString.BeginReading(&begin, &end); The frozen string API uses comparator functions instead of a virtual comparator class. uni
charutils has been modified to provide a frozen-linkage comparator: nsString myString = someString; - if (myString.Equals(otherString, nsCaseInsensitiveStringComparator())) + if (myString.Equals(otherString, CaseInsensitiveCompare)) return NS_OK; // woot, we're equal in all things but case When using uni
charutils from frozen-linkage code, link against the uni
charutil_external_s static library. ...
...And 8 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
autocompletepopup Type: id The id of a popup element used to hold autocomplete results for the element. autocompletesearch New in Thunderbird 2Requires SeaMonkey 1.1 Type: space-separa...
... autocompletepopup Type: id The id of a popup element used to hold autocomplete results for the element. autocompletesearch New in Thunderbird 2Requires SeaMonkey 1.1 Type: space-separated list of values A space-s...
...ageColumn,size, tabIndex, tabScrolling, textLength, textValue, timeout, type, value Methods getSearchAt, onSearchComplete, onTextEntered, onTextReverted, select, setSelectionRange Examples <textbox type="autocomplete" autocompletesearch="history"/> 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. autocompletepopup Type: id The id of a popup element used to hold autocomplete results for the element. autocompletesearch New in Thunderbird 2Requires SeaMonkey 1.1 Type: space-separated list of values A space-separated list of search component names, each of which implements th...
...And 8 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
alwaysopenpopup Obsolete since Gecko 1.9.1 Type: boolean Note: Applies to: Thunderbird and SeaMonkeyIf true, the autocomplete popup will be displayed even when there are no matches. If false, the default value, the popup ...
... alwaysopenpopup Obsolete since Gecko 1.9.1 Type: boolean Note: Applies to: Thunderbird and SeaMonkeyIf true, the autocomplete popup will be displayed even when there are no matches. If false, the default value, the popup will be hidden. This attribute is o...
...dSession, clearResults, getDefaultSession, getResultAt, getResultCount, getResultValueAt, getSession, getSessionByName, getSessionResultAt, getSessionStatusAt, getSessionValueAt, removeSession, select, setSelectionRange, syncSessions Examples (example needed) 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. alwaysopenpopup Obsolete since Gecko 1.9.1 Type: boolean Note: Applies to: Thunderbird and SeaMonkeyIf true, the autocomplete popup will be displayed even when there are no matches. If false, the default value, the popup will be hidden. This attribute is obsolete as of Gecko 1.9.1; to control the display of the popup, use ...
...And 8 more matches
NSS Sample Code Sample_1_Hashing
ing a file. This is an example program that demonstrates how to compute the hash of a file and save it to another file. This program illustrates the use of NSS message APIs. Sample Code 1 /* NSPR Headers */ #include <prprf.h> #include <prtypes.h> #include <plgetopt.h> #include <prio.h> /* NSS headers */ #include <secoid.h> #include <secmodt.h> #include <sechash.h> typedef struct { const
char *hashName; SECOidTag oid; } NameTagPair; /* The hash algorithms supported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* * Maps a hash name to a SECOidTag. * Returns NULL if the name is not a supporte...
...sh algorithms supported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* * Maps a hash name to a SECOidTag. ...
...AMES); SECOidTag hashtag = SEC_OID_UNKNOWN; for (i = 0; i < nhashes; i++) { if (PORT_Strcasecmp(hashName, HASH_NAMES[i].hashName) == 0) { hashtag = HASH_NAMES[i].oid; break; } } return hashtag; } /* * Newline */ static void Newline(PRFileDesc* out) { PR_fprintf(out, "\n"); } /* * PrintAsHex */ void PrintAsHex(PRFileDesc* out, unsigned
char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i != len - 1) { PR_fprintf(out, "%02x:", data[i]); column += 3; } else { PR_fprintf(out, "%02x",...
...And 8 more matches
Hashing - sample 1
ject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* NSPR Headers */ #include <prprf.h> #include <prtypes.h> #include <plgetopt.h> #include <prio.h> /* NSS headers */ #include <secoid.h> #include <secmodt.h> #include <sechash.h> #include <nss.h> typedef struct { const
char *hashName; SECOidTag oid; } NameTagPair; /* The hash algorithms supported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* * Maps a hash name to a SECOidTag. * Returns NULL if the name if not a supporte...
...sh algorithms supported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* * Maps a hash name to a SECOidTag. ...
...); SECOidTag hashtag = SEC_OID_UNKNOWN; for (i = 0; i < nhashes; i++) { if (PORT_Strcasecmp(hashName, HASH_NAMES[i].hashName) == 0) { hashtag = HASH_NAMES[i].oid; break; } } return hashtag; } /* * Newline */ static void Newline(PRFileDesc* out) { PR_fprintf(out, "\n"); } /* * PrintAsHex */ void PrintAsHex(PRFileDesc* out, unsigned
char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i != len - 1) { PR_fprintf(out, "%02x:", data[i]); column += 3; } else { PR_fprintf(out, "%02x",...
...And 8 more matches
sample1
1. A program to compute the hash of a file and save it to another file. ...
...hms supported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* Maps a hash name to a SECOidTag. ...
...ag hashtag = SEC_OID_UNKNOWN; for (i = 0; i < nhashes; i++) { if (PORT_Strcasecmp(hashName, HASH_NAMES[i].hashName) == 0) { hashtag = HASH_NAMES[i].oid; break; } } return hashtag; } /* Newline */ static void Newline(PRFileDesc* out) { PR_fprintf(out, "\n"); } /* PrintAsHex */ void PrintAsHex(PRFileDesc* out, unsigned
char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i != len - 1) { PR_fprintf(out, "%02x:", data[i]); column += 3; } else { PR_fpr...
...And 8 more matches
sslfnc.html
ionSetDefault SSL_OptionGetDefault SSL_CipherPrefSetDefault SSL_CipherPrefGetDefault SSL_ClearSessionCache SSL_ConfigServerSessionIDCache SSL_ConfigMPServerSIDCache SSL_InheritMPServerSIDCache NSS_Init Sets up configuration files and performs other tasks required to run Network Security Services. Database files are opened read-only. Syntax #include "nss.h" SECStatus NSS_Init(
char *configdir); Parameter This function has the following parameter: configdir A pointer to a string containing the pathname of the directory where the certificate, key, and security module databases reside. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailure. Use PR_GetError to retrieve the...
...ul if you have an export license that permits more or fewer capabilities than those allowed by the other export policy functions. NSS_InitReadWrite Sets up configuration files and performs other tasks required to run Network Security Services. Unlike NSS_Init, NSS_InitReadWrite provides both read and write access to database files. Syntax #include "nss.h" SECStatus NSS_InitReadWrite(
char *configdir); Parameter This function has the following parameter: configdir A pointer to a string containing the pathname of the directory where the certificate, key, and security module databases reside. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailure. Use PR_GetError to retrieve the...
...after it enables appropriate cipher suites by calling one of the SSL Export Policy Functions. NSS_NoDB_Init Performs tasks required to run Network Security Services without setting up configuration files. Important: This NSS function is not intended for use with SSL, which requires that the certificate and key database files be opened. Syntax #include "nss.h" SECStatus NSS_NoDB_Init(
char *reserved); Parameter This function has the following parameter: reserved Should be NULL.. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailure. Use PR_GetError to retrieve the error code. Description NSS_NoDB_Init opens only the temporary database and the internal PKCS #112 module.
...And 8 more matches
nsIMsgCompFields
<< XPCOM API Reference Summary The nsIMsgCompFields interface provides properties for an composition of an outgoing message. ...
...tion of an outgoing message. ...
...ing message. ...
...And 8 more matches
nsIURI
See the following RFCs for details: RFC3490: Internationalizing Domain Names in Applications (IDNA) RFC3986: Uniform Resource Identifier (URI): Generic Syntax RFC3987: Internationalized Resource Identifiers Subclasses of nsIURI, such as nsIURL, impose further structure on the URI. ...
... Identifiers Subclasses of nsIURI, such as nsIURL, impose further structure on the URI. ...
...n (the part after the "#") of the URI. host AUTF8String The host is the Internet domain name to which this URI refers. It could be an IPv4 (or IPv6) address literal. If supported, it could be a non-ASCII internationalized domain name. Exceptions thrown NS_ERROR_FAILURE If host is not applicable to the URI scheme (e.g. ...
...And 8 more matches
Type conversion
Implicit convert In js-ctypes, data could be converted implicitly when passing to or returning from a FunctionType call, or setting pointer content, an array element or a struct field. ...
... Implicit convert In js-ctypes, data could be converted implicitly when passing to or returning from a FunctionType call, or setting pointer content, an array element or a struct field. ...
... Implicit convert In js-ctypes, data could be converted implicitly when passing to or returning from a FunctionType call, or setting pointer content, an array element or a struct field. ...
...And 8 more matches
HTMLTextAreaElement - Web APIs
ce" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLTextAreaElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties accessKey string: Returns / Sets the element's accesskey attribute. autocapitalize string: Returns / Sets the element's capitalization behavior for user input. Valid values are: none, off,
characters, words, sentences. autocomplete autofocus boolean: Returns / Sets the element's autofocus attribute, indicating that the control should have input focus when the page loads cols unsigned long: Returns / Sets the element's cols attribute, indicating the visible width of the text area. defaultValue string: Returns / Sets the control's default...
...trol is not available for interaction. form Read only object: Returns a reference to the parent form element. If this element is not contained in a form element, it can be the id attribute of any <form> element in the same document or the value null. inputMode maxLength long: Returns / Sets the element's maxlength attribute, indicating the maximum number of
characters the user can enter. This constraint is evaluated only when the value changes. minLength long: Returns / Sets the element's minlength attribute, indicating the minimum number of
characters the user can enter. This constraint is evaluated only when the value changes. name string: Returns / Sets the element's name attribute, containing the name of the control. ...
...ing: Returns / Sets the direction in which selection occurred. This is "forward" if selection 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. On being set, the control behaves as if setSelectionRange() had been called with this as the second argument, and selectionStart as the first argument. selectionStart unsigned long: Returns / Sets the index of the beginning of selected text. If no text is selected, contains the index of the
character that follows the input cursor. On being set, the ...
...And 8 more matches
encodeURIComponent() - JavaScript
The encodeURIComponent() function encodes a URI by replacing each instance of certain
characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the
character (will only be four escape sequences for
characters composed of two "surrogate"
characters). 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 encodeURIComponent(str); Parameters str String. A component of a URI. Return value A new string representing the provided string encoded as a URI component. Description encodeURIComponent() escapes all
characters except: Not Escaped: A-Z a-z 0-9 - _ . ! ~ * ' ( ) e...
...ull request. Syntax encodeURIComponent(str); Parameters str String. A component of a URI. Return value A new string representing the provided string encoded as a URI component. Description encodeURIComponent() escapes all
characters except: Not Escaped: A-Z a-z 0-9 - _ . ...
...rameters str String. A component of a URI. Return value A new string representing the provided string encoded as a URI component. Description encodeURIComponent() escapes all
characters except: Not Escaped: A-Z a-z 0-9 - _ . ...
...And 8 more matches
Lexical grammar - JavaScript
This page describes JavaScript's lexical grammar. The source text of ECMAScript scripts gets scanned from left to right and is converted into a sequence of input elements which are tokens, control
characters, line terminators, comments or white space. ECMAScript also defines certain keywords and literals and has rules for automatic insertion of semicolons to end statements. Control
characters Control
characters have no visual representation but are used to control the interpretation of the text. Unicode format-control
characters Code point Name Abbreviation Description U+200C Zero width non-joiner <ZWNJ> Placed between
characters to prevent being connected into ligatures in certain languages (Wikipedia). U+200D Zero width joiner <ZWJ>...
...no visual representation but are used to control the interpretation of the text. Unicode format-control
characters Code point Name Abbreviation Description U+200C Zero width non-joiner <ZWNJ> Placed between
characters to prevent being connected into ligatures in certain languages (Wikipedia). U+200D Zero width joiner <ZWJ> Placed between
characters that would not normally be connected in order to cause the
characters to be rendered using their connected form in certain languages (Wikipedia). U+FEFF Byte order mark <BOM> Used at the start of the script to mark it as Unicode and the text's byte order (Wikipedia). ...
...edia). U+200D Zero width joiner <ZWJ> Placed between
characters that would not normally be connected in order to cause the
characters to be rendered using their connected form in certain languages (Wikipedia). U+FEFF Byte order mark <BOM> Used at the start of the script to mark it as Unicode and the text's byte order (Wikipedia). White space White space
characters improve the readability of source text and separate tokens from each other. These
characters are usually unnecessary for the functionality of the code. Minification tools are often used to remove whitespace in order to reduce the amount of data that needs to be transferred. ...
...And 8 more matches
Creating regular expressions for a microsummary generator - Archive of obsolete content
Microsummary generators use them to identify the pages that the generators know how to summarize by matching patterns in those pages' URLs. In this tutorial, we'll explain how to make regular expressions that match the URLs for eBay auction item pages. ...
... a domain name, a file path, and some query parameters. Here's a URL for an auction item page on eBay: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=280018439106 In this URL, the domain name is "cgi.ebay.com", the file path is "/ws/eBayISAPI.dll", and the query parameters are "?ViewItem&item=280018439106". Matching an eBay URL To match this URL with a regular expression, we need to put
characters into the regular expression that match the
characters in the URL. Most of the time, we can match a
character in the URL by putting the same
character into the regular expression. For example, the following regular expression matches--and looks exactly like--the beginning of the URL: http:// But some
characters are special in regular expressions. For example, a period (.) matches any cha...
... Here's a regular expression that matches our example URL: http://cgi\.ebay\.com/ws/eBayISAPI\.dll\?ViewItem&item=280018439106 It looks almost the same as the URL. ...
...And 7 more matches
String Quick Reference - Archive of obsolete content
nd nsCString& void MyMethod(const nsString& input, nsString& output); New way: use nsAString& and nsACString& void MyMethod(const nsAString& input, nsAString& output); Substrings What: Get direct references to string fragments Why: Avoid making multiple copies of the string Old way: use a bunch of nsAutoStrings, and use Left(), Right() and Mid() to grab a segment of a string: // get an 8-
character string starting at the 4th position nsAutoString leftside; str.Left(leftside, 12); nsAutoString middle; leftside.Right(middle, 8); New way: use Substring() to grab a direct reference to those
characters: // get an 8-
character string starting at the 4th position const nsAString& middle = Substring(str, 4, 8); Unicode literals What: Use macro tricks to make wide-
character literal string...
...ring leftside; str.Left(leftside, 12); nsAutoString middle; leftside.Right(middle, 8); New way: use Substring() to grab a direct reference to those
characters: // get an 8-
character string starting at the 4th position const nsAString& middle = Substring(str, 4, 8); Unicode literals What: Use macro tricks to make wide-
character literal strings. Why: Avoid copying and conversion from literal
char-based strings to UTF16 strings. ...
...e = Substring(str, 4, 8); Unicode literals What: Use macro tricks to make wide-
character literal strings. Why: Avoid copying and conversion from literal
char-based strings to UTF16 strings. ...
...And 7 more matches
LiveConnect Overview - Archive of obsolete content
method to create an array. // JavaScript 1.3 var theClass = java.lang.Class.forName("java.lang.String"); var theArray = java.lang.reflect.Array.newInstance(theClass, 5); In JavaScript 1.4 and later, you can pass a JavaClass object directly to a method, as shown in the following example: // JavaScript 1.4 var theArray = java.lang.reflect.Array.newInstance(java.lang.String, 5); Arguments of Type
char In JavaScript 1.4 and later, you can pass a one-
character string to a Java method which requires an argument of type
char. For example, you can pass the string "H" to the
Character constructor as follows: var c = new java.lang.
Character("H"); In JavaScript 1.3 and earlier, you must pass such methods an integer which corresponds to the Unicode value of the
character. For example, the following co...
...If your JavaScript code accesses a Java data member or method and fails, the Java exception is passed on to JavaScript for you to handle. ...
...uble java.lang.Object A new instance of java.lang.Double is created, and the exact value is transferred to Java without rounding and without a loss of magnitude or sign. float Values are rounded to float precision. Values which are too large or small to be represented are rounded to +infinity or -infinity. NaN is converted to NaN. byte
char int long short Values are rounded using round-to-negative-infinity mode. Values which are too large or small to be represented result in a run-time error. NaN can not be converted and results in a run-time error. java.lang.String Values are converted to strings. For example: 237 becomes "237" boolean ...
...And 7 more matches
Index
eroperability between software and devices that perform cryptographic operations, NSS conforms to a standard called PKCS#11. (Note that it's important to look at the number 11, as there are other PKCS standards with different numbers that define quite different topics.) A software or hardware module conforming to the PKCS#11 standard implements an interface of C calls, which allow querying the
characteristics and offered services of the module. Multiple elements of NSS's own modules have been implemented with this interface, and NSS makes use of this interface when talking to those modules. This strategy allows NSS to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and soft...
...tools and other NSS test applications. 187 sample1 Example, NSS 1. A program to compute the hash of a file and save it to another file. /* NSPR Headers */ #include <prprf.h> #include <prtypes.h> #include <plgetopt.h> #include <prio.h> #include <prprf.h> /* NSS headers */ #include <secoid.h> #include <secmodt.h> #include <sechash.h> typedef struct { const
char *hashName; SECOidTag oid; } NameTagPair; /* The hash algorithms supported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* Maps a hash name to a SECOidTag. * Returns NULL if the name is no...
...hms supported */ static const NameTagPair HASH_NAMES[] = { { "MD2", SEC_OID_MD2 }, { "MD5", SEC_OID_MD5 }, { "SHA1", SEC_OID_SHA1 }, { "SHA256", SEC_OID_SHA256 }, { "SHA384", SEC_OID_SHA384 }, { "SHA512", SEC_OID_SHA512 } }; /* Maps a hash name to a SECOidTag. ...
...And 7 more matches
How to embed the JavaScript engine
might be needed in some case // #define __STDC_LIMIT_MACROS // #include <stdint.h> #include "jsapi.h" /* The class of the global object. */ static JSClass global_class = { "global", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, }; int main(int argc, const
char *argv[]) { JSRuntime *rt = JS_NewRuntime(8L * 1024 * 1024, JS_USE_HELPER_THREADS); if (!rt) return 1; JSContext *cx = JS_NewContext(rt, 8192); if (!cx) return 1; { // Scope for our various stack objects (JSAutoRequest, RootedObject), so they all go // out of scope before we JS_DestroyContext. JSAutoRequest ar(cx); // In practice, you would want t...
...ce, you would want to exit this any // time you're spinning the event loop JS::RootedObject global(cx, JS_NewGlobalObject(cx, &global_class, nullptr)); if (!global) return 1; JS::RootedValue rval(cx); { // Scope for JSAutoCompartment JSAutoCompartment ac(cx, global); JS_InitStandardClasses(cx, global); const
char *script = "'hello'+'world, it is '+new Date()"; const
char *filename = "noname"; int lineno = 1; bool ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, rval.address()); if (!ok) return 1; } JSString *str = rval.toString(); printf("%s\n", JS_EncodeString(cx, str)); } JS_DestroyContext(cx); JS_Destr...
...> #include "jsapi.h" /* The class of the global object. */ static JSClass global_class = { "global", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr, nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook }; int main(int argc, const
char *argv[]) { JS_Init(); JSRuntime *rt = JS_NewRuntime(8L * 1024 * 1024, JS_USE_HELPER_THREADS); if (!rt) return 1; JSContext *cx = JS_NewContext(rt, 8192); if (!cx) return 1; { // Scope for our various stack objects (JSAutoRequest, RootedObject), so they all go // out of scope before we JS_DestroyContext. JSAutoRequest ar(cx); // In practice, ...
...And 7 more matches
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* num
charsp = 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. ...
... Description JS::DeflateStringToUTF8Buffer encodes src as UTF8. ...
...e 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. num
charsp size_t* The pointer to receive the number of Unicode
characters written to the buffer. Description JS::DeflateStringToUTF8Buffer encodes src as UTF8. The caller must either ensure dst has enough space to encode the entire string, or pass the length of the buffer as dstlenp. In which case, the function will encode
characters from the string until the buffer is exhausted. Does not w...
...And 7 more matches
Add to iPhoto
rform typical string operations. The first declaration to be done here is to actually declare the CFStringRef data type; this is an opaque pointer to a CFString object. this.CFStringRef = new ctypes.PointerType("CFStringRef"); Now that we've declared the core type, we can declare the methods we use that work with CFString objects. Let's take a look at one of these. ...
...ration to be done here is to actually declare the CFStringRef data type; this is an opaque pointer to a CFString object. this.CFStringRef = new ctypes.PointerType("CFStringRef"); Now that we've declared the core type, we can declare the methods we use that work with CFString objects. Let's take a look at one of these. ...
... with CFString objects. Let's take a look at one of these. this.CFStringCreateWith
Characters = this.lib.declare("CFStringCreateWith
Characters", ctypes.default_abi, this.CFStringRef, // returns a new CFStringRef ctypes.voidptr_t, // allocator ctypes.js
char.ptr, // pointer to the Unicode string ctypes.int32_t); // length of the string CFStringCreateWith
Characters() is used to create a new CFString object using a Unicode string as the source string, which is copied into the new CFString object. It returns a CFStringRef, which is a pointer to the new string, and accepts, as input, three parameters: an ...
...And 7 more matches
Using Objective-C from js-ctypes
the NSSpeechSynthesizer class definition. Register the alloc selector for the message. Send a message to the class, with the selector. Get a reference to a class Class definitions are retrieved with the objc_getClass function, declared in /usr/include/objc/runtime.h. The objc_getClass function receives the name of the class, looks up the definition, and returns it. ...
...e need the classNSSpeechSynthesizer, which is retrieved with the following code: Class NSSpeechSynthesizer = objc_getClass("NSSpeechSynthesizer"); Registering a selector Selectors can be registered and retrieved with sel_registerName function, also declared in /usr/include/objc/runtime.h. sel_registerName receives the name of the selector, and returns the selector. SEL sel_registerName(const
char *str); SEL is defined as follows, in /usr/include/objc/objc.h. It's also an opaque type. typedef struct objc_selector *SEL; In this example, we need to send alloc, its selector can be retrieved with the following code: SEL alloc = sel_registerName("alloc"); Sending a message Once target class and selector are ready, you can send a message. This message can be sent using the objc_msgSend ...
...w we have working C code, it can be converted into js-ctypes in a relatively straightforward manner. Types and Functions In addition to the above code, we need to declare function and types. Types Types can be readily declared. BOOL is defined in /usr/include/objc/objc.h. let id = ctypes.StructType("objc_object").ptr; let SEL = ctypes.StructType("objc_selector").ptr; let BOOL = ctypes.signed_
char; Functions All functions in our example are exported by /usr/lib/libobjc.dylib. let lib = ctypes.open(ctypes.libraryName("objc")); Function definition is the more tricky part. In this example, objc_msgSend is used in 3 ways. We need to declare three different FunctionType CDatas: Returns id or compatible type. Returns BOOL. Returns nothing. let objc_msgSend_id = lib.declare("objc_msg...
...And 7 more matches
ctypes
lue. This is done for compatibility's sake. long_long A integer type at least 64 bits wide. unsigned_long_long An unsigned integer type at least 64 bits wide. float A floating point value that behaves like the float type on the platform. double A double-precision floating point value that behaves like the double type on the platform.
Character types
Character types are 8-bit values that behave like their C counterparts. They're similar to the int8_t and uint8_t types, except conversion is handled differently. For example, ctypes.
char.array(30)(str) converts the string str to UTF-8 and returns a new CData object of array type. Type Description
char A
character type that behaves like the
char C type o...
...it values that behave like their C counterparts. They're similar to the int8_t and uint8_t types, except conversion is handled differently. For example, ctypes.
char.array(30)(str) converts the string str to UTF-8 and returns a new CData object of array type. Type Description
char A
character type that behaves like the
char C type on the platform. signed_
char A signed
character that behaves like the
char type on the platform. unsigned_
char An unsigned
character that behaves like the unsigned
char type on the platform. Types whose size varies depending on platform Because it's unknown whether these values will be 32-bit or 64-bit, they are not automatically converted into JavaScript numbers. Instead, these convert into ctypes.Int...
...ypes.Int64 or ctypes.UInt64 JavaScript objects; see 64-bit integers for details. Type Description size_t A platform-dependent size type. ssize_t A platform-dependent size type. intptr_t A platform-dependent integer representation of a pointer. uintptr_t A platform-dependent unsigned integer representation of a pointer. JavaScript
characters 16-bit C Unicode
characters are handled by js-ctypes using the js
char type. Type Description js
char A 16-bit unsigned
character. This is different from uint16_t in that C js
char values are automatically converted into 1-
character JavaScript strings. These are Unicode
characters. Special C types These types represent C types that have special meanings. ...
...And 7 more matches
text-transform - CSS: Cascading Style Sheets
digraph becomes IJ, even with text-transform: capitalize, which only puts the first letter of a word in uppercase. In Greek (el), vowels lose their accent when the whole word is in uppercase (?/?), except for the disjunctive eta (?/?). Also, diphthongs with an accent on the first vowel lose the accent and gain a diaeresis on the second vowel (??/??). In Greek (el), the lowercase sigma
character has two forms: ? and ?. ? is used only when sigma terminates a word. When applying text-transform: lowercase to an uppercase sigma (?), the browser needs to choose the right lowercase form based on context. in Irish (ga), certain prefixed letters remain in lowercase when the base initial is capitalized, so for example text-transform: uppercase will change ar aon tsli to AR AON tSLI and no...
...tibility table. Syntax /* Keyword values */ text-transform: none; text-transform: capitalize; text-transform: uppercase; text-transform: lowercase; text-transform: full-width; text-transform: full-size-kana; /* Global values */ text-transform: inherit; text-transform: initial; text-transform: unset; capitalize Is a keyword that converts the first letter of each word to uppercase. Other
characters remain unchanged (they retain their original case as written in the element's text). A letter is defined as a
character that is part of Unicode's Letter or Number general categories ; thus, any punctuation marks or symbols at the beginning of a word are ignored. Authors should not expect capitalize to follow language-specific title casing conventions (such as skipping articles in English...
... like (a) to be real letters. Internet Explorer 9 was the closest to the CSS 2 definition, but with some weird cases.) By precisely defining the correct behavior, CSS Text Level 3 cleans this mess up. The capitalize line in the browser compatibility table contains the version the different engines started to support this now precisely-defined behavior. uppercase Is a keyword that converts all
characters to uppercase. lowercase Is a keyword that converts all
characters to lowercase. none Is a keyword that prevents the case of all
characters from being changed. full-width Is a keyword that forces the writing of a
character -- mainly ideograms and Latin scripts -- inside a square, allowing them to be aligned in the usual East Asian scripts (like Chinese or Japanese). full-size-kana Ge...
...And 7 more matches
Assertions - JavaScript
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). Types The following section is also duplicated on this cheatsheet. Do not forget to edit it as well, thanks! Boundary-type assertions
Characters Meaning ^ Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break
character. For example, /^A/ does not match the "A" in "an A", but does match the first "A" in "An A". This
character has a different meaning when it appears at the start of a group. $ Matches the end of input. If the multiline flag ...
...line flag is set to true, also matches immediately after a line break
character. For example, /^A/ does not match the "A" in "an A", but does match the first "A" in "An A". This
character has a different meaning when it appears at the start of a group. $ Matches the end of input. If the multiline flag is set to true, also matches immediately before a line break
character. For example, /t$/ does not match the "t" in "eater", but does match it in "eat". \b Matches a word boundary. This is the position where a word
character is not followed or preceded by another word-
character, such as between a letter and a space. Note that a matched word boundary is not included in the match. In other words, the length of a matched word boundary is zero.
... \B Matches a non-word boundary. ...
...And 7 more matches
Content type - SVG: Scalable Vector Graphics
must be in lower case. When angles are used in an SVG attribute, <angle> is instead defined as follows: angle ::= number ("deg" | "grad" | "rad")? The unit identifiers in such <angle> values must be in lower case. In the SVG DOM, <angle> values are represented using SVGAngle or SVGAnimatedAngle objects. Anything <anything> The basic type <anything> is a sequence of zero or more
characters. Specifically: anything ::=
Char* where
Char is the production for a
character, as defined in XML 1.0 , section 2.2. Clock-value <clock-value> Clock values have the same syntax as in SMIL Animation specification. The grammar for clock values is repeated here: Clock-val ::= Full-clock-val | Partial-clock-val | Timecount-val Full-clock-val ::= ...
...itive number Minutes ::= 2DIGIT; range from 00 to 59 Seconds ::= 2DIGIT; range from 00 to 59 Fraction ::= DIGIT+ Timecount ::= DIGIT+ 2DIGIT ::= DIGIT DIGIT DIGIT ::= [0-9] For Timecount values, the default metric suffix is "s" (for seconds). 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 values: 02:30:03 = 2 hours, 30 minutes and 3 seconds 50:00:10.25 = 50 hours, 10 seconds and 250 milliseconds Partial clock value: 02:33 = 2 minutes and 33 seconds 00:10.5 = 10.5 seconds = 10 seconds and 500 milliseconds Timecount values: 3.2h = 3.2 hours = 3 hours and 12 minutes 45min = ...
...ord or a numerical RGB specification. In addition to these color keywords, users may specify keywords that correspond to the colors used by objects in the user's environment. The normative definition of these keywords is found in User preferences for colors (CSS2, section 18.2). The format of an RGB value in hexadecimal notation is a "#" immediately followed by either three or six hexadecimal
characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display. The format of an RGB value in the functional notation is an RGB start-function, follo...
...And 7 more matches
Creating Reusable Modules - Archive of obsolete content
e... } return path; } Hash function Firefox has built-in support for hash functions, exposed via the nsICryptoHash XPCOM interface The documentation page for that interface includes an example of calculating an MD5 hash of a file's contents, given its path. ...
...ash function Firefox has built-in support for hash functions, exposed via the nsICryptoHash XPCOM interface The documentation page for that interface includes an example of calculating an MD5 hash of a file's contents, given its path. ...
...sICryptoHash); // we want to use the MD5 algorithm ch.init(ch.MD5); // this tells updateFromStream to read the entire file const PR_UINT32_MAX = 0xffffffff; ch.updateFromStream(istream, PR_UINT32_MAX); // pass false here to get binary data back var hash = ch.finish(false); // convert the binary hash data to a hex string. ...
...And 6 more matches
Examples - Archive of obsolete content
<!-- This file should have a .xhtml extension and will generate an error when parsed. --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Problem 1 - < in XHTML</title> <meta http-equiv="Content-Type" content="application/xhtml+xml;
charset=utf-8" /> <script type="text/javascript"> var i = 0; while (++i > 10) { // ... } </script> </head> <body> <h1>Problem 1 - < in XHTML</h1> <p> This document is not well formed due to the use of a raw <. </p> </body> </html> Back to the article Problem 2 <!-- This file should have a .xhtml extension --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict...
.../html> Back to the article Problem 2 <!-- This file should have a .xhtml extension --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Problem 2 - Comments in XHTML</title> <meta http-equiv="Content-Type" content="application/xhtml+xml;
charset=utf-8" /> <style type="text/css"> <!-- body {background-color: blue; color: yellow; } --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> </head> <body> <h1>Problem 2 - Comments in XHTML</h1> <p> This document is valid XHTML 1.0 Strict serv...
...-- This file should have a .xhtml extension and will generate an error when parsed. --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Problem 3 - Comments in XML</title> <meta http-equiv="Content-Type" content="application/xhtml+xml;
charset=utf-8" /> <script type="text/javascript"> var i; var sum = 0; for (i = 10; i > 0; --i) { sum += i; } </script> </head> <body> <h1>Problem 3 - Comments in XHTML</h1> <p> This document is not well formed XHTML due to the double dash contained in the Comment. </p> </body> </html> Back to the article Examples for "Using CSS rules in inline style within comme...
...And 6 more matches
PKCS #11 Module Specs
currently implements this proposal internally. The file format consists of name/value pairs of the form name=value. Each name/value pair is separated by a blank value. A single line, terminated by a '\n', '\r\n', or '\r' represents a single pkcs #11 library. Names can be any alpha/numeric combination, and are parsed case-insensitive. Values can contain any printable ASCII value, including UTF8
characters. Values can contain embedded blanks either through quoting the entire value, or by escaping the embedded blanks with '\'. The value is considered quoted if the first
character after the '=' is ', ", {, [, or <. If the value is quoted, then the value is terminated with and ending quote of the form ', ", ), ], }, or > matching the respective starting quote. Ending quotes can be escaped. Embed...
...Note that case must be preserved in the values. These modules specs can be passed by the application directly to NSS via the SECMOD_LoadUserModule() call. ...
...Note that case must be preserved in the values. These modules specs can be passed by the application directly to NSS via the SECMOD_LoadUserModule() call. To initialize a PKCS #11 module 'on-the-fly'. ...
...And 6 more matches
JS::CompileFunction
This article covers features introduced in SpiderMonkey 17 Create a JavaScript function from a text string. ...
... This article covers features introduced in SpiderMonkey 17 Create a JavaScript function from a text string. ...
... This article covers features introduced in SpiderMonkey 17 Create a JavaScript function from a text string. ...
...And 6 more matches
JS_DefineProperty
Create a new property on an object. ...
... Create a new property on an object. ...
...dleValue value, unsigned attrs, JSNative getter = nullptr, JSNative setter = nullptr); bool JS_DefineProperty(JSContext *cx, JS::HandleObject obj, const
char *name, JS::HandleObject value, unsigned attrs, JSNative getter = nullptr, JSNative setter = nullptr); bool JS_DefineProperty(JSContext *cx, JS::HandleObject obj, const
char *name, JS::HandleString value, unsigned attrs, JSNative getter = nullptr, JSNative setter = nullptr); bool JS_DefineProperty(JSContext *cx, JS::HandleObject obj, const
char *name, int32_t value, unsigned attrs, JSNative getter = nullptr, JSNative setter = nullptr); bool JS_DefineProperty(JSContext *cx, JS::HandleObject obj,...
...And 6 more matches
XPCOM Stream Guide
Think of a water tank with a spout: the tank may be full, or it may be half-full, or it may be empty. The spout controls how much water you can get out of the tank at a time. The spout is a source of water. If we think of the water as data, then the spout represents an input stream: a controller for data coming out of something. At the same time, there may be some way to put water into the tank - say, a main water line. ...
...l. Primitive streams There are streams for several different types of data storage. Each of these implements nsIInputStream. ...
...on of nsIChannel will have an input stream as well, but unless you own the channel, you shouldn't try to read from the input stream. There are two ways of getting the input stream: by calling the channel's .open() method for a synchronous read, or by calling the channel's .asyncOpen() method with an nsIStreamListener object. You can get an nsIChannel object from the IO Service's newChannel(spec,
charset, baseURI) method or its .newChannelFromURI(uri) method. The "safe file output stream" Mozilla provides a "safe file output stream" implementation. This implementation actually writes the contents of the file you're trying to create to a temporary file. If everything goes well, calling the stream's .finish() method overwrites the original file with the new file. Using Streams in C++ Using S...
...And 6 more matches
nsILocalFile
covered. This string is not intended for display to users. Note: The value of the followLinks attribute is not encoded in the persistent descriptor. Constants Constant Value Description DELETE_ON_CLOSE 0x80000000 Optional parameter used by openNSPRFileDesc(). Methods Native code only! appendRelativeNativePath Appends a relative, native
character encoding, path to the current path of the nsILocalFile object. void appendRelativeNativePath( in ACString relativeFilePath ); Parameters relativeFilePath A native relative path. For security reasons, this cannot contain '..' or cannot start with a directory separator '/'. Must be in the native file system
character set. Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicat...
...t. void appendRelativeNativePath( in ACString relativeFilePath ); Parameters relativeFilePath A native relative path. For security reasons, this cannot contain '..' or cannot start with a directory separator '/'. Must be in the native file system
character set. Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that relativeFilePath incorrectly begins with a path separator
character or otherwise contains invalid
characters. appendRelativePath() Appends a relative native path to the current path of the nsILocalFile object. void appendRelativePath( in AString relativeFilePath ); Parameters relativeFilePath A native relative path. For security reasons, this cannot contain '..' or cannot start with a directory separator '/' . Exceptions thrown NS_ERROR_FILE...
...tive path to the current path of the nsILocalFile object. void appendRelativePath( in AString relativeFilePath ); Parameters relativeFilePath A native relative path. For security reasons, this cannot contain '..' or cannot start with a directory separator '/' . Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that relativeFilePath incorrectly begins with a path separator
character or otherwise contains invalid
characters. getRelativeDescriptor() Returns a relative file path in an opaque, cross platform format. It is therefore not a native path. ACString getRelativeDescriptor( in nsILocalFile fromFile ); Parameters fromFile The file from which the descriptor is relative. There is no defined result if this parameter is null. Return value An opaque string ...
...And 6 more matches
nsIMsgIncomingServer
id configureTemporaryReturnReceiptsFilter(in nsIMsgFilterList filterList); Obsolete since Gecko 1.8 void displayOfflineMsg(in nsIMsgWindow aWindow); boolean equals(in nsIMsgIncomingServer server); void forgetPassword(); void forgetSessionPassword(); AString generatePrettyNameForMigration(); boolean getBoolAttribute(in string name); boolean getBoolValue(in string attr); ACString get
CharAttribute(in string name); ACString get
CharValue(in string attr); nsILocalFile getFileValue(in string relpref, in string abspref); nsIMsgFilterList getFilterList(in nsIMsgWindow aMsgWindow); long getIntAttribute(in string name); long getIntValue(in string attr); nsIMsgFolder getMsgFolderFromURI(in nsIMsgFolder aFolderResource, in ACString aURI); void getNewMessages(in nsIMsgFolder aF...
...te(in string name); long getIntValue(in string attr); nsIMsgFolder getMsgFolderFromURI(in nsIMsgFolder aFolderResource, in ACString aURI); void getNewMessages(in nsIMsgFolder aFolder, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener); ACString getPasswordWithUI(in AString aPromptString, in AString aPromptTitle, in nsIMsgWindow aMsgWindow, out boolean okayValue); AString getUni
charAttribute(in string name); AString getUni
charValue(in string attr); boolean isNewHdrDuplicate(in nsIMsgDBHdr aNewHdr); void onUserOrHostNameChanged(in ACString oldName, in ACString newName); void performBiff(in nsIMsgWindow aMsgWindow); void performExpand(in nsIMsgWindow aMsgWindow); void removeFiles(); void setBoolAttribute(in string name, in boolean value); void setBoolValue(in ...
...i
charValue(in string attr); boolean isNewHdrDuplicate(in nsIMsgDBHdr aNewHdr); void onUserOrHostNameChanged(in ACString oldName, in ACString newName); void performBiff(in nsIMsgWindow aMsgWindow); void performExpand(in nsIMsgWindow aMsgWindow); void removeFiles(); void setBoolAttribute(in string name, in boolean value); void setBoolValue(in string attr, in boolean value); void set
CharAttribute(in string name, in ACString value); void set
CharValue(in string attr, in ACString value); void setDefaultLocalPath(in nsILocalFile aDefaultLocalPath); void setFileValue(in string relpref, in string abspref, in nsILocalFile aValue); void setFilterList(in nsIMsgFilterList aFilterList); void setIntAttribute(in string name, in long value); void setIntValue(in string attr, in long...
...And 6 more matches
nsIVariant
ACString getAsACString(); Native code only! nsresult getAsArray(out PRUint16 type, out nsIID iid, out PRUint32 count, out voidPtr ptr); Violates the XPCOM interface guidelines AString getAsAString(); Native code only! AUTF8String getAsAUTF8String(); Native code only! PRBool getAsBool(); Native code only!
char getAs
Char(); Native code only! DOMString getAsDOMString(); Native code only! double getAsDouble(); Native code only! float getAsFloat(); Native code only! nsresult getAsID(out nsID retval); Violates the XPCOM interface guidelines PRInt16 getAsInt16(); Native code only! PRInt32 getAsInt32(); Native code...
...Native code only! Methods Native code only!getAs...
...Native code only! Methods Native code only!getAsACString AC...
...And 6 more matches
Using js-ctypes
in32 API. Components.utils.import("resource://gre/modules/ctypes.jsm"); var lib = ctypes.open("C:\\WINDOWS\\system32\\user32.dll"); /* Declare the signature of the function we are going to call */ var msgBox = lib.declare("MessageBoxW", ctypes.winapi_abi, ctypes.int32_t, ctypes.int32_t, ctypes.js
char.ptr, ctypes.js
char.ptr, ctypes.int32_t); var MB_OK = 0; var ret = msgBox(0, "Hello world", "title", MB_OK); lib.close(); In line 3, the user32.dll system library is loaded. Line 6 declares msgBox() to be a method that calls the Windows function MessageBoxW. Line 15 calls the msgBox() routine, which displays the alert. The last thing we do is c...
... Or even without the extension. var lib = ctypes.open("user32"); Calling Carbon routines on Mac OS X This example demonstrates how to use ctypes to call a Carbon function on Mac OS X. ...
...ules/ctypes.jsm"); var carbon = ctypes.open("/System/Library/Frameworks/Carbon.framework/Carbon"); stdAlert = carbon.declare("StandardAlert", /* function name */ ctypes.default_abi, /* ABI type */ ctypes.int16_t, /* return type */ ctypes.int16_t, /* alert type */ ctypes.
char.ptr, /* primary text */ ctypes.
char.ptr, /* secondary text */ ctypes.uint32_t, /* alert param */ ctypes.int16_t); /* item hit */ var hit = 0; var msgErr = makeStr("Carbon Says..."); var msgExp = makeStr("We just called the StandardAlert Carbon function from JavaScript!"); var err = stdAlert(1, ...
...And 6 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Whether to allow multiple values name all Name of the form control. Submitted with the form as part of a name/value pair. pattern password, text, tel Patter...
...Whether to allow multiple values name all Name of the form control. ...
...n the element has no maximum value. There is a special case: if the data type is periodic (such as for dates or times), the value of max may be lower than the value of min, which indicates that the range may wrap around; for example, this allows you to specify a time range from 10 PM to 4 AM. maxlength Valid for text, search, url, tel, email, and password, it defines the maximum number of
characters (as UTF-16 code units) the user can enter into the field. This must be an integer value 0 or higher. If no maxlength is specified, or an invalid value is specified, the field has no maximum length. This value must also be greater than or equal to the value of minlength. The input will fail constraint validation if the length of the text entered into the field is greater than maxlength UTF...
...And 6 more matches
HTML documentation index - HTML: Hypertext Markup Language
ce, Web Global attributes are attributes common to all HTML elements; they can be used on all elements, though they may have no effect on some elements. 8 accesskey Global attributes, HTML, Reference, accesskey The accesskey global attribute provides a hint for generating a keyboard shortcut for the current element. The attribute value must consist of a single printable
character (which includes accented and other
characters that can be generated by the keyboard). 9 autocapitalize Autocapitalize, Global attributes, HTML, Reference The autocapitalize global attribute is an enumerated attribute that controls whether and how text input is automatically capitalized as it is entered/edited by the user. 10 class Global attributes, HTML, ...
...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. 41 HTML attribute: maxlength Attribute, Attributes, Constraint validation The maxlength attribute defines the maximum number of
characters (as UTF-16 code units) the user can enter into an <input> or <textarea>. This must be an integer value 0 or higher. 42 HTML attribute: min Attribute, Attributes, Constraint validation, min The min attribute defines the minimum value that is acceptable and valid for the input containing the attribute. If the value of the element is less than this, the element fails const...
...e 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. 43 HTML attribute: minlength Attribute, Input, Reference, minlength, textarea The minlength attribute defines the minimum number of
characters (as UTF-16 code units) the user can enter into an <input> or <textarea>. This must be an integer value 0 or higher. If no minlength is specified, or an invalid value is specified, the input has no minimum length. This value must be less than or equal to the value of maxlength, otherwise the value will never be valid, as it is impossible to meet both criteria. 44 HTML attribute: m...
...And 6 more matches
JXON - Archive of obsolete content
Obj[sName]; if (sName === "keyValue") { if (vValue !== null && vValue !== true) { oParentEl.appendChild(oNewDoc.createTextNode(vValue.constructor === Date ? ...
... "animal": true myObject.animal 2 <animal>Deka</animal> "animal": "Deka" myObject.animal 3 <animal name="Deka" /> "animal": {"@name": "Deka"} myObject.animal["@name"] 4 <animal name="Deka">is my cat</animal> "animal": { "@name": "Deka", "keyValue": "is my cat" } myObject.animal["@name"], myObject.animal.keyValue 5 <animal> <dog>
Charlie</dog> <cat>Deka</cat> </animal> "animal": { "dog": "
Charlie", "cat": "Deka" } myObject.animal.dog, myObject.animal.cat 6 <animal> <dog>
Charlie</dog> <dog>Mad Max</dog> </animal> "animal": { "dog": ["
Charlie", "Mad Max"] } myObject.animal.dog[0], myObject.animal.dog[1] 7 <animal> in my house <dog>
Charlie</dog> </animal> "animal": { "keyValue": "in my house...
...cat>Deka</cat> </animal> "animal": { "dog": "
Charlie", "cat": "Deka" } myObject.animal.dog, myObject.animal.cat 6 <animal> <dog>
Charlie</dog> <dog>Mad Max</dog> </animal> "animal": { "dog": ["
Charlie", "Mad Max"] } myObject.animal.dog[0], myObject.animal.dog[1] 7 <animal> in my house <dog>
Charlie</dog> </animal> "animal": { "keyValue": "in my house", "dog": "
Charlie" } myObject.animal.keyValue, myObject.animal.dog 8 <animal> in my ho <dog>
Charlie</dog> use </animal> "animal": { "keyValue": "in my house", "dog": "
Charlie" } myObject.animal.keyValue, myObject.animal.dog Code considerations In these examples we chose to use a property named keyValue for the text content. The lack of standards for XML to JSON conversion leads deve...
...And 5 more matches
Editor Embedding Guide - Archive of obsolete content
changes to the content on the browser. Below is the sequence of steps that need to be followed for the same: 1. Get the nsICommandManager from the nsIWebBrowser using do_GetInterface: nsCOMPtr<nsICommandManager> commandManager; nsIWebBrowser->do_GetInterface(getter_AddRefs(commandMgr)); 2. Call a command -- DoCommand: commandManager->DoCommand(aCommand, aCommandParams); aCommand is a const
char * to a supported command name (see list below). aCommandParams could possibly be a null pointer or a pointer to a valid structure filled with relative parameters to aCommand (see list below for legal params). 3. Verify if a command is enabled -- IsCommandEnabled: commandManager->IsCommandDisabled(aCommand, retval) 4. Get the current command state of a given command -- GetCommandState: comma...
...hould be considered examples of base functionality and in no way imply that this command won't handle other fonts. cmd_align Sets the alignment for the lines contained in the current selection. GetCommandState "state_attribute" (cstring) DoCommand "state_attribute" (cstring) "left", "right", "center", "justify" cmd_insertHTML cmd_insertLinkNoUI cmd_insertImageNoUI cmd_insertHR cmd_
charSet Sets the
charset for the document. GetCommandState "state_attribute" (cstring) DoCommand "state_attribute" (cstring) Note There must be a clear undo stack or this will not work. cmd_copy Copies current selection. GetCommandState "state_enabled" (boolean) DoCommand no parameter Note GetCommandState in these cases will return whether or not it is possible to call DoCommand. T...
... will not really give you any concrete information on the state of the command. cmd_cutOrDelete Cuts or deletes current selection. GetCommandState "state_enabled" (boolean) DoCommand no parameter Note GetCommandState in these cases will return whether or not it is possible to call DoCommand. This will not really give you any concrete information on the state of the command. ...
...And 5 more matches
accesskey - Archive of obsolete content
For example, when a menu labeled 'File' has an accesskey of 'F', the generated label will be 'File'. ...
...For example, when a menu labeled 'File' has an accesskey of 'F', the generated label will be 'File'. ...
...For example, when a menu labeled 'File' has an accesskey of 'F', the generated label will be 'File'. ...
...And 5 more matches
Following the Android Toasts Tutorial from a JNI Perspective
saved" toast to let you know that you can continue editing later. Toasts automatically disappear after a timeout. Toasts do not have to be created with JNI; they are exposed by the NativeWindow feature on Firefox for Android, see toast documentation. Java code Let's start with the following Java code, which invokes a toast and says "Hello, Firefox!". Context context = getApplicationContext();
CharSequence text = "Hello, Firefox!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); NativeWindow code As mentioned earlier, toasts are a very popular feature, so Mozilla developers chose to bring it to the privileged JavaScript scope via the NativeWindow object. The Java code example above can be done with privileged JavaScript from Firefox...
...The Java code example above can be done with privileged JavaScript from Firefox for Android with the following code: window.NativeWindow.toast.show("Hello, Firefox!", "short"); Converting Java to JNI.jsm The first step is to look at the Java code and see all the different types, methods, constructors, and fields that are being used. In the toast code we have the following: Types - Context,
CharSequence, int, Toast, and void Methods - makeText, show Fields - LENGTH_SHORT No constructors are used. Declare the types We will start by declaring the types needed. In JNI, there is the all-important property called sig. When something is declared, we are stating the sig and the name. The sig's will be represented as JavaScript strings in JNI.jsm, and the sig's of the types are as follows:...
...structors are used. Declare the types We will start by declaring the types needed. In JNI, there is the all-important property called sig. When something is declared, we are stating the sig and the name. The sig's will be represented as JavaScript strings in JNI.jsm, and the sig's of the types are as follows: Java Type Signature boolean Z byte B
char C class/object Lclass name in slash notation here; double D float F int I long J short S void V array of type [sig here method format (sig of type of each argument here)sig of the return type here Declaring a class/object is done in a special way. For example, if the class is blah...
...And 5 more matches
NSS PKCS11 Functions
NSS reference main page. SECMOD_LoadUserModule SECMOD_UnloadUserModule SECMOD_OpenUserDB SECMOD_CloseUserDB PK11_FindCertFromNickname PK11_FindKeyByAnyCert PK11_GetSlotName PK11_GetTokenName PK11_IsHW PK11_IsPresent PK11_IsReadOnly PK11_SetPasswordFunc SECMOD_LoadUserModule Load a new PKCS #11 module based on a moduleSpec. Syntax #include "secmod.h" extern SECMODModule *SECMOD_LoadUserModule(
char *moduleSpec, SECMODModule *parent, PRBool recurse); Parameters This function has the following parameters: moduleSpec is a pkcs #11 moduleSpec. parent is the moduleDB that presented this module spec. For applications this value should be NULL. recurse is a boolean indicates whether or not the module should also launch additional pkcs #11 modules. This is only applicable if the loaded module is ...
...is function has the following parameter: slot A pointer to a slot info structure. This slot must a a slot created by SECMOD_OpenUserDB() at some point in the past. Returns The function returns one of these values: If successful, SECSuccess). If unsuccessful, SECFailure. SECMOD_OpenUserDB Open a new database using the softoken. Syntax #include "pk11pub.h" PK11SlotInfo *SECMOD_OpenUserDB(const
char *moduleSpec) Parameters This function has the following parameters: moduleSpec is the same data that you would pass to softoken at initialization time under the 'tokens' options. Returns The function returns one of these values: If successful, a pointer to a slot. If unsuccessful, NULL. Description Open a new database using the softoken. The caller is responsible for making sure the module spe...
...ified, and noCertDB and noKeyDB is not specified, the load will fail. certPrefix Cert prefix for this token. keyPrefix Prefix for the key database for this token. (if not specified, certPrefix will be used). tokenDescription The label value for this token returned in the CK_TOKEN_INFO structure with an internationalize string (UTF8). ...
...And 5 more matches
JS::Compile
s article covers features introduced in SpiderMonkey 17 Compile a script for execution. ...
... const JS::ReadOnlyCompileOptions &options, JS::SourceBufferHolder &srcBuf, JS::MutableHandleScript script); bool JS::Compile(JSContext *cx, const JS::ReadOnlyCompileOptions &options, const
char *bytes, size_t length, JS::MutableHandleScript script); bool JS::Compile(JSContext *cx, const JS::ReadOnlyCompileOptions &options, const
char16_t *
chars, size_t length, JS::MutableHandleScript script); bool JS::Compile(JSContext *cx, const JS::ReadOnlyCompileOptions &options, FILE *file, JS::MutableHandleScript script); bool JS::Compile(JSContext *cx, const JS::ReadOnlyCompileOptions &options, const
char *filename, JS::MutableHandleScript script); // Obsolete since JSAPI 39 bool JS::C...
... *filename, JS::MutableHandleScript script); // Obsolete since JSAPI 39 bool JS::Compile(JSContext *cx, JS::HandleObject obj, const JS::ReadOnlyCompileOptions &options, JS::SourceBufferHolder &srcBuf, JS::MutableHandleScript script); bool JS::Compile(JSContext *cx, JS::HandleObject obj, const JS::ReadOnlyCompileOptions &options, const
char *bytes, size_t length, JS::MutableHandleScript script); bool JS::Compile(JSContext *cx, JS::HandleObject obj, const JS::ReadOnlyCompileOptions &options, const
char16_t *
chars, size_t length, JS::MutableHandleScript script); bool JS::Compile(JSContext *cx, JS::HandleObject obj, const JS::ReadOnlyCompileOptions &options, FILE *file, JS::MutableHandl...
...And 5 more matches
JS_CompileFunctionForPrincipals
Obsolete since JSAPI 28This 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 a security-enabled JS function from a text string. ...
...solete since JSAPI 28This 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 a security-enabled JS function from a text string. ...
...is 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 a security-enabled JS function from a text string. ...
...And 5 more matches
JS_ConvertArguments
Obsolete since JSAPI 38This 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. Converts a series of JS values, passed in an argument array, to their corresponding JS types. Syntax bool JS_ConvertArguments(JSContext *cx, const JS::CallArgs &args, const
char *format, ...); // Added in SpiderMonkey 31 bool JS_ConvertArguments(JSContext *cx, unsigned argc, jsval *argv, const
char *format, ...); // Obsolete since JSAPI 30 Name Type Description cx JSContext * The context in which to perform any necessary conversions. cx also affects the interpretation of format, if JS_AddArgumentFormatter has been called. ...
...ngine 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 converted values. There must be one pointer for each parameter described in format. Variables for optional parameters must already be initialized, because if an optional parameter is not in a...
...S values for use with your own functions. cx is the context for the call. argc indicates the number of JS values you are passing in for conversion. argv is a pointer to the array of JS values to convert. format is a null-terminated C string. Each element of the array indicates the C type into which to convert the next available JS value. ...
...And 5 more matches
nsIConverterInputStream
xpcom/io/nsIConverterInputStream.idlScriptable A uni
char input stream that wraps an input stream. This allows reading unicode strings from a stream, automatically converting the bytes from a selected
character encoding. 1.0 66 Introduced Gecko 1.8 Inherits from: nsIUni
charInputStream Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Implemented by: @mozilla.org/intl/converter-input-stream;1. ...
...n Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Implemented by: @mozilla.org/intl/converter-input-stream;1. ...
... 1.5 / SeaMonkey 1.0) Implemented by: @mozilla.org/intl/converter-input-stream;1. ...
...And 5 more matches
nsIMimeConverter
The nsIMimeConverter service allows you to convert headers into and out of MIME format. Inherits from: nsISupports Implemented by: @mozilla.org/messenger/mimeconverter;1. ...
... convert headers into and out of MIME format. Inherits from: nsISupports Implemented by: @mozilla.org/messenger/mimeconverter;1. ...
...@mozilla.org/messenger/mimeconverter;1. ...
...And 5 more matches
URLs - Plugins
N_GetURL is typically asynchronous: it returns immediately and only later handles the request, such as displaying the URL or creating the stream for the instance and writing the data. For this reason as well, calling NPN_GetURLNotify may be more useful than NPN_GetURL; the plug-in is notified upon either successful or unsuccessful completion of the request. NPError NPN_GetURL(NPP instance, const
char *url, const
char *target); The instance parameter represents the current plug-in instance. The url parameter is the URL of the request, which can be of any type, including HTTP, FTP, news, or mailto. The target parameter represents the destination where the URL will be displayed, a window or frame. If target refers to the window or frame containing the plug-in instance, it is destroyed and the ...
...he notifyData value, which may be used to track multiple requests. NPN_GetURLNotify handles the URL request asynchronously. It returns immediately and only later handles the request and calls NPP_URLNotify. Without this notification, the plug-in cannot tell whether a request with a null target failed or a request with a non-null target was completed. NPError NPN_GetURLNotify(NPP instance, const
char* url, const
char* target, void* notifyData); The instance, url, and target parameters have the same definitions as those of NPN_GetURL. The notifyData parameter contains private plug-in data that can be used to associate the request with the subsequent NPP_URLNotify call (which returns this value) and/or to pass a pointer to some request-related payload. If a request is...
...alls NPP_URLNotify after calling NPP_DestroyStream to close the stream. Both the NPN_GetURLNotify and NPN_PostURLNotify functions call the NPP_URLNotify method to notify the plug-in of the result of a request. Both functions pass the notifyData value to NPP_URLNotify, which tells the plug-in that the URL request was completed and the reason for completion. void NPP_URLNotify(NPP instance, const
char* url, NPReason reason, void* notifyData); The instance and url parameters have the same definitions as those of NPN_GetURL. The notifyData parameter contains the private plug-in data passed to the corresponding call to NPN_GetURLNotify and NPN_PostURLNotify. Warning: In Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), NPN_GetURLNotify() does not notify the plug-in if...
...And 5 more matches
BluetoothRemoteGATTService - Web APIs
The BluetoothRemoteGATTService interface of the Web Bluetooth API represents a service provided by a GATT server, including a device, a list of referenced services, and a list of the
characteristics of this service. ...
... interface of the Web Bluetooth API represents a service provided by a GATT server, including a device, a list of referenced services, and a list of the
characteristics of this service. ...
...eb Bluetooth API represents a service provided by a GATT server, including a device, a list of referenced services, and a list of the
characteristics of this service. ...
...And 5 more matches
WindowOrWorkerGlobalScope.btoa() - Web APIs
The WindowOrWorkerGlobalScope.btoa() method creates a Base64-encoded ASCII string from a binary string (i.e., a String object in which each
character in the string is treated as a byte of binary data). You can use this method to encode data which may otherwise cause communication problems, transmit it, then use the atob() method to decode the data again. For example, you can encode control
characters such as ASCII values 0 through 31. Syntax var encodedData = scope.btoa(stringToEncode); Parameters stringToEncode The binary string to encode. Return value An ASCII string containing the Base64 representation of stringToEncode. Exceptions Invalid
CharacterError The string contained a
character that did not fit in a single byte. See "Unicode strings" below for more detail. Example...
...ror The string contained a
character that did not fit in a single byte. See "Unicode strings" below for more detail. Example const encodedData = window.btoa('Hello, world'); // encode a string const decodedData = window.atob(encodedData); // decode the string Unicode strings The btoa() function takes a JavaScript string as a parameter. In JavaScript strings are represented using the UTF-16
character encoding: in this encoding, strings are represented as a sequence of 16-bit (2 byte) units. Every ASCII
character fits into the first byte of one of these units, but many other
characters don't. Base64, by design, expects binary data as its input. In terms of JavaScript strings, this means strings in which each
character occupies only one byte. So if you pass a string into btoa() containing...
...cter encoding: in this encoding, strings are represented as a sequence of 16-bit (2 byte) units. Every ASCII
character fits into the first byte of one of these units, but many other
characters don't. Base64, by design, expects binary data as its input. In terms of JavaScript strings, this means strings in which each
character occupies only one byte. ...
...And 5 more matches
Event reference
Fired When beforeprint The print dialog is opened afterprint The print dialog is closed Text Composition events Event Name Fired When compositionstart The composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition). compositionupdate A
character is added to a passage of text being composed. compositionend The composition of a passage of text has been completed or canceled. View events Event Name Fired When fullscreenchange An element was toggled to or from fullscreen mode. fullscreenerror It was impossible to switch to fullscreen mode for technical reasons or because th...
...VG events SVGAbort SVGError SVGLoad SVGResize SVGScroll SVGUnload SVGZoom Database events abort blocked complete error success upgradeneeded versionchange Script events afterscriptexecute beforescriptexecute Menu events DOMMenuItemActive DOMMenuItemInactive Window events close Popup events popuphidden popuphiding popupshowing popupshown Tab events visibilitychange Battery events
chargingchange
chargingtimechange dis
chargingtimechange levelchange Call events alerting busy callschanged cfstatechange connecting dialing disconnected disconnecting error held, holding incoming resuming statechange voicechange Sensor events compassneedscalibration devicemotion deviceorientation orientationchange Smartcard events icccardlockerror iccinfochange smartcard-insert smartcard-remove ...
...tksessionend cardstatechange SMS and USSD events delivered received sent ussdreceived Frame events mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserlocationchange mozbrowserloadend mozbrowserloadstart mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange DOM mutation events DOMAttributeNameChanged DOMAttrModified DOM
CharacterDataModified DOMContentLoaded DOMElementNameChanged DOMNodeInserted DOMNodeInsertedIntoDocument DOMNodeRemoved DOMNodeRemovedFromDocument DOMSubtreeModified Touch events touchcancel touchend touchmove touchstart Pointer events pointerover pointerenter pointerdown pointermove pointerup pointercancel pointerout pointerleave gotpointercapture lostpointercapture Standard events These events...
...And 5 more matches
The Unicode Bidirectional Text Algorithm - Developer guides
The Unicode(R) Bidirectional Algorithm (also known as the BiDi Algorithm) is part of the Unicode text standard that describes how the user agent should order
characters while rendering Unicode text. Understanding this algorithm in at least basic terms is helpful when you're striving to produce localization-ready web content or apps. ...
...'re striving to produce localization-ready web content or apps. In this guide, we'll take a look at the BiDi Algorithm and learn in general what it does and how it applies to your content, so that you'll be better prepared when using the features of HTML and CSS to which the algorithm applies while determining the order and directionality of text during rendering. ...
...eady web content or apps. In this guide, we'll take a look at the BiDi Algorithm and learn in general what it does and how it applies to your content, so that you'll be better prepared when using the features of HTML and CSS to which the algorithm applies while 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 t...
...And 5 more matches
Date and time formats used in HTML - HTML: Hypertext Markup Language
on of the ISO 8601 standard for its date and time strings. It's worth reviewing the descriptions of the formats you're using in order to ensure that your strings are in fact compatible with HTML, as the HTML specification includes algorithms for parsing these strings that is actually more precise than ISO 8601, so there can be subtle differences in how date and time strings are expected to look.
Character set Dates and times in HTML are always strings which use the ASCII
character set. Year numbers In order to simplify the basic format used for date strings in HTML, the specification requires that all years be given using the modern (or proleptic) Gregorian calendar. While user interfaces may allow entry of dates using other calendars, the underlying value always uses the Gregorian calenda...
... 04 April 30 05 May 31 06 June 30 07 July 31 o8 August 31 09 September 30 10 October 31 11 November 30 12 December 31 Week strings A week string specifies a week within a particular year. A valid week string consists of a valid year number, followed by a hyphen
character ("-", or U+002D), then the capital letter "W" (U+0057), followed by a two-digit week of the year value. The week of the year is a two-digit string between 01 and 53. Each week begins on Monday and ends on Sunday. That means it's possible for the first few days of January to be considered part of the previous week-year, and for the last few days of December to be considered part of the foll...
...e year padded to four digits and the week to two. Month strings A month string represents a specific month in time, rather than a generic month of the year. That is, rather than representing simply "January," an HTML month string represents a month and year paired, like "January 1972." A valid month string consists of a valid year number (a string of at least four digits), followed by a hyphen
character ("-", or U+002D), followed by a two-digit numeric month number, where 01 represents January and 12 represents December. Examples of valid month strings Month string Month and year 17310-09 September, 17310 2019-01 January, 2019 1993-11 November, 1993 0571-04 April, 571 0001-07 July, 1 C.E. Notice that all ye...
...And 5 more matches
<thead>: The Table Head element - HTML: Hypertext Markup Language
in HTML 4, in HTML5 This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell
char, aligning the textual content on a special
character with a minimal offset, defined by the
char and
charoff attributes Unimplemented (see bug 2212). If this attribute is not set, the left value is assumed. Note: Do not use this attribute as it is obsolete (not supported) in the latest standard. To achieve the same effect as the left, center, right or justify values, use the CSS text-al...
... bgcolor This attribute defines the background color of each cell of the column. It is one of the 6-digit hexadecimal code as defined in sRGB, prefixed by a '#'. ...
...ff attributes Unimplemented (see bug 2212). If this attribute is not set, the left value is assumed. Note: Do not use this attribute as it is obsolete (not supported) in the latest standard. To achieve the same effect as the left, center, right or justify values, use the CSS text-align property on it. To achieve the same effect as the
char value, in CSS3, you can use the value of the
char as the value of the text-align property Unimplemented. bgcolor This attribute defines the background color of each cell of the column. It is one of the 6-digit hexadecimal code as defined in sRGB, prefixed by a '#'. One of the sixteen predefined color strings may be used: black = "#000000" green = "#008000" silver = "#C0C0C0" lime ...
...And 5 more matches
Text formatting - JavaScript
sent textual data. It is a set of "elements" of 16-bit unsigned integer values (UTF-16 code units). Each element in the String occupies a position in the String. The first element is at index 0, the next at index 1, and so on. The length of a String is the number of elements in it. You can create strings using string literals or string objects. CAUTION: if you edit this page, do not include any
characters above U+FFFF, until MDN bug 857438 is fixed ( https://bugzilla.mozilla.org/show_bug.cgi?id=857438 ). String literals You can create simple strings using either single or double quotes: 'foo' "bar" More advanced strings can be created using escape sequences: Hexadecimal escape sequences The number after \x is interpreted as a hexadecimal number. '\xA9' // "(C)" Unicode escape sequen...
...o' "bar" More advanced strings can be created using escape sequences: Hexadecimal escape sequences The number after \x is interpreted as a hexadecimal number. '\xA9' // "(C)" Unicode escape sequences The Unicode escape sequences require at least four hexadecimal digits following \u. '\u00A9' // "(C)" Unicode code point escapes New in ECMAScript 2015. With Unicode code point escapes, any
character can be escaped using hexadecimal numbers so that it is possible to use Unicode code points up to 0x10FFFF. With simple Unicode escapes it is often necessary to write the surrogate halves separately to achieve the same result. See also String.fromCodePoint() or String.prototype.codePointAt(). '\u{2F804}' // the same with simple Unicode escapes '\uD87E\uDC04' String objects The String obj...
...; // Creates a string literal value const secondString = new String('2 + 2'); // Creates a String object eval(firstString); // Returns the number 4 eval(secondString); // Returns the string "2 + 2" A String object has one property, length, that indicates the number of UTF-16 code units in the string. ...
...And 5 more matches
SyntaxError: JSON.parse: bad parsing - JavaScript
The JavaScript exceptions thrown by JSON.parse() occur when string failed to be parsed as JSON. ...
... The JavaScript exceptions thrown by JSON.parse() occur when string failed to be parsed as JSON. ...
... The JavaScript exceptions thrown by JSON.parse() occur when string failed to be parsed as JSON. ...
...And 5 more matches
Intl.Locale.prototype.collation - JavaScript
It is used whenever strings must be sorted and placed into a certain order, from search query results to ordering records in a database. While the idea of placing strings in order might seem trivial, the idea of order can vary from region to region and language to language. ...
...rom region to region and language to language. The collation property helps to make it easier for JavaScript programmers to access the collation type used by a particular locale. Below is a table with the available collation types, taken from the Unicode collation specification. Valid collation types Collation Type Description big5han Pinyin ordering for Latin, big5
charset ordering for CJK
characters (used in Chinese) compat A previous version of the ordering, for compatibility dict Dictionary style ordering (such as in Sinhala) The direct collation type has been deprected. Do not use. direct Binary code point order (used in Hindi) ducet The default Unicode collation element table order ...
...ese) compat A previous version of the ordering, for compatibility dict Dictionary style ordering (such as in Sinhala) The direct collation type has been deprected. Do not use. ...
...And 5 more matches
Preferences - Archive of obsolete content
erences-service;1"] .getService(Components.interfaces.nsIPrefService); prefs = prefs.getBranch("extensions.myext."); Simple types There are three types of preferences: string, integer, and boolean. Each entry in the preferences database (prefs.js) has one of those types. There are six methods in nsIPrefBranch that read and write preferences: getBoolPref(), setBoolPref(), get
CharPref(), set
CharPref(), getIntPref(), and setIntPref(). Using them is as easy as: // Get the "accessibility." branch var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService).getBranch("accessibility."); // prefs is an nsIPrefBranch. // Look in the above section for examples of getting one. var value = prefs.getBoolP...
...ing aPrefName, in nsIIDRef aType, in nsISupports aValue); As you can see, both of them take a parameter, aType, which can have one of the following values (to be precise, you should pass Components.interfaces.nsIWhatever instead of just nsIWhatever, which is undefined). nsISupportsString Used to handle Unicode strings in preferences. Use this when the preference value may contain non-ASCII
characters (for example, a user's name). nsIPrefLocalizedString Almost the same as nsISupportsString, but it is handled differently in getComplexValue() when there's no user value for the given preference; see below for details. nsILocalFile and nsIRelativeFilePref Store paths in preferences. nsILocalFile is used to store absolute paths, while nsIRelativeFilePref is used to store paths relative to...
...se false. In particular, when no default value exists for a preference, prefHasUserValue() indicates whether a preference exists. Attempting to read a nonexistent preference using one of the get*Pref methods will throw an exception. Using prefHasUserValue() lets you check if the preference exists before attempting to read it. ...
...And 4 more matches
Documentation for BiDi Mozilla - Archive of obsolete content
h was chosen after comparing and testing the available open-source implementations. As far as we could discover, ICU is the only one which is 100% compatible with UBA, including support for explicit directional controls (LRO, RLO, etc, and their HTML equivalents). Bidi processing for a given HTML document will only take place if one of the following is true: The page includes a Hebrew or Arabic
character or a Hindi digit. This is determined in nsTextFragment::SetTo The page includes a element with the attribute dir=rtl, either explicitly (nsGenericHTMLElement::MapCommonAttributesInto), or as a consequence of a style rule (MapDeclarationTextInto in nsCSSStyleRule.cpp) All these cases use nsDocument::EnableBidi to set the flag mBidiEnabled. In a Bidi-enabled document, the following things hap...
...cument". We have also tested behaviour of all controls with dir=rtl and added support where necessary. Some support added for alignment in tables and lists, and fixes for problems with different combinations of dir and align. ...
...iour of all controls with dir=rtl and added support where necessary. Some support added for alignment in tables and lists, and fixes for problems with different combinations of dir and align. ...
...And 4 more matches
tabbrowser - Archive of obsolete content
n other XUL windows by third-party applications or extensions. ...
...ocument. contentWindow Type: TODO Use the contentWindow.wrappedJSObject to obtain a DOM(html) window object currentURI Type: nsIURI This read-only property contains the currently loaded URL. To change the URL, use the loadURI method. docShell Type: nsIDocShell This read-only property contains the nsIDocShell object for the document. document
CharsetInfo Obsolete since Gecko 12.0 Type: nsIDocument
CharsetInfo This read-only property contains the nsIDocument
CharsetInfo object for the document which is used to handle which
character set should be used to display the document. The properties of the nsIDocument
CharsetInfo object were merged into the docshell in Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9). ...
...d(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addProgressListener( listener ) Return type: no return value Add a progress listener to the browser which will monitor loaded documents. The progress listener should implement the nsIWebProgressListener interface. addTab( URL, referrerURI,
charset, postData, owner, allowThirdPartyFixup ) addTab( URL, {referrerURI: ...,
charset: ..., postData: ..., owner: ..., allowThirdPartyFixup: ..., relatedToCurrent: ... }) Return type: tab element Opens a new tab that loads a page with the specified URL. The rest of the parameters are optional. The row of tabs will appear if needed. Firefox 3.6 note The second form of this method was ad...
...And 4 more matches
XForms Input Element - Archive of obsolete content
of type xsd:gDay (xhtml only) number field - used to represent data of numeric type (fx 3.0 only, xul only) More detail about each of these widgets follows below. text field Displaying a text field is the default presentation. XForms inputs are most often used when a form author needs to allow for the input/output of simple text into an instance node. Allows for free-form data entry (xhtml/xul).
Characteristics A text field is presented to the user when there is no type given for the bound node or a type is specified that is not handled by one of the other widgets (as documented below). analogous widgets are <xhtml:input type="text"/> and <xul:textbox/> Specific handling of attributes incremental - if "true", the bound instance node will be updated on each
character typed by the user. If "...
...ing of attributes incremental - if "true", the bound instance node will be updated on each
character typed by the user. If "false", or the incremental attribute is omitted on this element then the bound instance node will be updated when the control loses the focus. checkbox Most often used when the form author only needs a simple 'true', 'false', '1', or '0' response from the user (xhtml/xul).
Characteristics used when the instance node is of type xsd:boolean or a type derived from it analogous widgets are <xhtml:input type="checkbox"/> and <xul:checkbox/> The corresponding label can be displayed before or after the checkbox by using the labelposition attribute. Specific handling of attributes incremental - if "true" or this attribute is omitted from this element, then the instance node ...
...en the checkbox. Since the introduction of labelposition, the behavior changed as described above to better match other implementations as well as commonly used GUI guidelines. datepicker This widget is similar to a combobox. It consists of a text field for direct user input next to a button that when activated will 'drop down' a calender widget that the user can also interact with (xhtml/xul).
Characteristics used when the instance node is of type xsd:date or a type derived from it. will not work with xsd:dateTime (behavior defaults to text input). Specific handling of attributes incremental - if "true", the bound instance node will be updated on each
character typed by the user or when the user clicks on a date from the calendar widget. If "false" or the incremental attribute is omitted...
...And 4 more matches
Client-side form validation - Learn web development
ter your data in the format they are expecting. You'll get messages such as: "This field is required" (You can't leave this field blank). "Please enter your phone number in the format xxx-xxxx" (A specific data format is required for it to be considered valid). "Please enter a valid email address" (the data you entered is not in the right format). "Your password needs to be between 8 and 30
characters long and contain one uppercase letter, one symbol, and a number." (A very specific data format is required for your data). This is called form validation. When you enter data, the browser and/or the web server will check to see that the data is in the correct format and within the constraints set by the application. Validation done in the browser is called client-side validation, while va...
..., it is required by WCAG accessibility guidelines. Also, only require users to input data you actually need: For example, why do you really need to know someone's gender or title? Validating against a regular expression Another useful validation feature is the pattern attribute, which expects a Regular Expression as its value. A regular expression (regex) is a pattern that can be used to match
character combinations in text strings, so regexs are ideal for form validation and serve a variety of other uses in JavaScript. Regexs are quite complex, and we don't intend to teach you them exhaustively in this article. Below are some examples to give you a basic idea of how they work. a -- Matches one
character that is a (not b, not aa, and so on). abc -- Matches a, followed by b, followed by...
... abc|xyz -- Matches exactly abc or exactly xyz (but not abcxyz or a or y, and so on). There are many more possibilities that we don't cover here. For a complete list and many examples, consult our Regular expressions documentation. Let's implement an example. ...
...And 4 more matches
Advanced text formatting - Learn web development
amentals, we walked through how to mark up basic lists in HTML, but we didn't mention the third type of list you'll occasionally come across -- description lists. The purpose of these lists is to mark up a set of items and their associated descriptions, such as terms and definitions, or questions and answers. Let's look at an example of a set of terms and definitions: soliloquy In drama, where a
character speaks to themselves, representing their inner thoughts or feelings and in the process relaying them to the audience (but not to other
characters.) monologue In drama, where a
character speaks their thoughts out loud to share them with the audience and any other
characters present. aside In drama, where a
character shares a comment only with the audience for humorous or dramatic effect. This...
...ect. This is usually a feeling, thought or piece of additional background information Description lists use a different wrapper than the other list types -- <dl>; in addition each term is wrapped in a <dt> (description term) element, and each description is wrapped in a <dd> (description definition) element. ...
...ist types -- <dl>; in addition each term is wrapped in a <dt> (description term) element, and each description is wrapped in a <dd> (description definition) element. Let's finish marking up our example: <dl> <dt>soliloquy</dt> <dd>In drama, where a
character speaks to themselves, representing their inner thoughts or feelings and in the process relaying them to the audience (but not to other
characters.)</dd> <dt>monologue</dt> <dd>In drama, where a
character speaks their thoughts out loud to share them with the audience and any other
characters present.</dd> <dt>aside</dt> <dd>In drama, where a
character shares a comment only with the audience for humorous or dramatic effect. This is usually a feeling, thought, or piece of additional background information.</dd> </dl> The brows...
...And 4 more matches
Looping code - Learn web development
ferent calculations to do, you want to do each different one, not the same one over and over again! Let's look at an example to perfectly illustrate why loops are such a good thing. ...
... look at a real example so we can visualize what these do more clearly. ...
...'; input.focus(); for (let i = 0; i < contacts.length; i++) { let splitContact = contacts[i].split(':'); if (splitContact[0].toLowerCase() === searchName) { para.textContent = splitContact[0] + '\'s number is ' + splitContact[1] + '.'; break; } else { para.textContent = 'Contact not found.'; } } }); Hidden code 3 <!DOCTYPE html> <html> <head> <meta
charset="utf-8"> <title>Simple contact search example</title> <style> </style> </head> <body> <label for="search">Search by contact name: </label> <input id="search" type="text"> <button>Search</button> <p></p> <script> const contacts = ['Chris:2232322', 'Sarah:3453456', 'Bill:7654322', 'Mary:9998769', 'Dianne:9384975']; const para = document.querySelector('p')...
...And 4 more matches
Client-Server Overview - Learn web development
The targ...
...cludes an id for managing sessions (Cookie: sessionid=6ynxs23n521lu21b1t136rhbv7ezngie; ...). The remaining lines contain information about the browser used and the sort of responses it can handle. For example, you can see here that: My browser (User-Agent) is Mozilla Firefox (Mozilla/5.0). It can accept gzip compressed information (Accept-Encoding: gzip). It can accept the specified set of
characters (Accept-
Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7) and languages (Accept-Language: de,en;q=0.7,en-us;q=0.3). The Referer line indicates the address of the web page that contained the link to this resource (i.e. the origin of the request, https://developer.mozilla.org/). HTTP requests can also have a body, but it is empty in this case. The response The first part of the response for this ...
...TP requests can also have a body, but it is empty in this case. The response The first part of the response for this request is shown below. The header contains information like the following: The first line includes the response code 200 OK, which tells us that the request succeeded. We can see that the response is text/html formatted (Content-Type). ...
...And 4 more matches
Strategies for carrying out testing - Learn web development
reach it can be expected to have. By coding defensively, we mean trying to build in intelligent fallbacks so that if a feature or style doesn't work in a browser, the site will be able to downgrade to something less exciting that still provides an acceptable user experience -- the core information is still accessible, for example, even if it doesn't look quite as nice. The aim is to build up a
chart of browsers/devices you can refer to as you test. You can make this as simple or as complex as you like -- for example a common approach is to have multiple grades of support level, something like: A grade: Common/modern browsers -- Known to be capable. Test thoroughly and provide full support. B grade: Older/less capable browsers -- known not to be capable. Test, and provide a more basic ex...
...ade: Older/less capable browsers -- known not to be capable. Test, and provide a more basic experience that gives full access to core information and services. C grade: Rare/unknown browsers -- don't test, but assume they are capable. Serve the full site, which should work, at least with the fallbacks provided by our defensive coding. Throughout the following sections, we'll build up a support
chart in this format. Note: Yahoo first made this approach popular, with their Graded browser Support approach. Educated guesses You could call these "assumptions", or "gut feelings". This is not an accurate, scientific approach, but as someone who has experience with the web industry you'll have a pretty good idea of at least some of the browsers you should test. This can form a good basis for a...
... format. Note: Yahoo first made this approach popular, with their Graded browser Support approach. Educated guesses You could call these "assumptions", or "gut feelings". This is not an accurate, scientific approach, but as someone who has experience with the web industry you'll have a pretty good idea of at least some of the browsers you should test. This can form a good basis for a support
chart. For example, if you live in Western Europe or North America, you will know that a lot of people use Windows and Mac desktops/laptops, where the main browsers are Chrome, Firefox, Safari, IE, and Edge. You probably want to just test the latest versions of the first three, as these browsers receive regular updates. For Edge and IE, you probably want to test the last couple of versions; these sho...
...And 4 more matches
Localization content best practices
for grammar errors, capitalization or inconsistencies. For example, use the single Unicode ..., and not three dots. If you have any doubts about the quality of strings, ask a copywriter to do a copy review of this text. Ideally, all strings landing in code should originate from approved UX wireframes, any copy review should be part of the initial stage of creating these wireframes. Use Unicode
characters over their ASCII counterparts when possible Strings should use directional quotation marks when possible. U+2018 and U+2019 (\u2018 and \u2019 in JavaScript) are the left and right single quotation marks, respectively. The right single quotation mark should be used as an apostrophe. U+201C and U+201D (\u201c and \u201d in JavaScript) are the left and right double quotation marks, respe...
...the left and right double quotation marks, respectively. The pair should be used to surround statements and references to user input. Example: You have chosen a keyword that is currently in use by "%S". Please select another. ...
... Create localizable strings Don't assume grammar structures You need to consider the need for different grammar structures in different locales, and add switching mechanisms to present them appropriately. ...
...And 4 more matches
Midas
ection. 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 bold will be removed. Otherwise, all selected
characters will become bold. contentReadOnly This command will make the editor readonly(true)or editable(false). Anticipated usage is for temporarily disabling input while something else is occurring elsewhere in the web page. copy If...
...nces note: the shortcut key will automatically trigger this command (typically accel-X) with or without the signed JS or any code on the page to handle it. decreasefontsize This command will add a <small> tag around selection or at insertion point. delete This command will delete all text and objects that are selected. If no text is selected it deletes one
character to the right. This is similar to the Delete button on the keyboard. fontname A font name This command will set the font face for a selection or at the insertion point if there is no selection. The given string is such as would be used in the "face" attribute of the font tag, i.e., a comma-separated list of font names. fontsize A number This command will ...
... item. insertunorderedlist Depends on the selection. If the caret is not inside a non-LI block, that block becomes the first LI and UL. If the caret is inside a numbered item, the numbered item becomes a bulleted item. insertparagraph Inserts a new paragraph. italic If there is no selection, the insertion point will set italic for subsequently typed
characters. If there is a selection and all of the
characters are already italic, the italic will be removed. Otherwise, all selected
characters will become italic. justifycenter Center-aligns the current block. justifyfull Fully-justifies the current block. justifyleft Left-aligns the current block. justifyright Right aligns the ...
...And 4 more matches
NSS 3.12.4 release notes
RegExpSearch PORT_RegExpCaseSearch These functions will match a string with a shell expression. The expressions accepted are based loosely on the expressions accepted by zsh. Expected return values: NON_SXP if exp is a standard string INVALID_SXP if exp is a shell expression, but invalid VALID_SXP if exp is a valid shell expression Expression matching rules: * matches anything ? matches one
character \ 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. ...
...These forms cannot be combined, e.g [a-gp-z] does not work. ...
...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 match the expression foo, provided it does not also match the expression bar. Either expression or both may be a union. ...
...And 4 more matches
NSS API Guidelines
rules that (ideally) should be followed for naming and identifying new files, functions, and data types. CVS ID Each file should include a CVS ID string for identification. The preferred format is: "@(#) $RCSfile: nss-guidelines.html, v $ $Revision: 48936 $ $Date: 2009-08-11 07:45:57 -0700 (Tue, 11 Aug 2009) $ $Name$" You can put the string in a comment or in a static
char array. Use #ifdef DEBUG to include the array in debug builds only. The advantage of using an array is that you can use strings(1) to pull the ID tags out of a (debug) compiled library. You can even put them in header files; the header files are protected from double inclusion. The only catch is that you have to determine the name of the array. Here is an example from lib/base/baset.h: #ifde...
...to include the array in debug builds only. The advantage of using an array is that you can use strings(1) to pull the ID tags out of a (debug) compiled library. You can even put them in header files; the header files are protected from double inclusion. The only catch is that you have to determine the name of the array. Here is an example from lib/base/baset.h: #ifdef DEBUG static const
char BASET_CVS_ID[] = "@(#) $RCSfile: nss-guidelines.html, v $ $Revision: 48936 $ $Date: 2009-08-11 07:45:57 -0700 (Tue, 11 Aug 2009) $ $Name$"; #endif /* DEBUG */ The difference, between this and Id, is that Id has some useless information (every file is "experimental"), and doesn't have Name. Name is the tag (if any) from which this file was pulled. If you're good with tagging your...
...a row include the files directly above them. Header files always include what they need; the files are protected against double inclusion (and even double opening by the compiler). Note: It's not necessary all eight files exist. Further, this is a simple ideal, and often reality is more complex. We would like to keep names to 8.3, even if we no longer support win16. This usually gives us four
characters to identify a module of NSS. In short: Header files for consumption outside NSS start with "nss." Header files with types have a trailing "t", header files with prototypes don't. "extern" declarations of data also go in the prototypes files. "Friend" headers are for things that we really wish weren't used by non-NSS code, but which are. Those files have a trailing "f," and their use s...
...And 4 more matches
NSS Sample Code Sample1
The secondary host may store the wrapped value that was received // from the primary in a file, and unwrap it each time the key is required // (such as at server startup). // NSS actually has some support for permanent symmetric keys. However this // example will need to be modified somewhat in order to demonstrate it. // Utility function to print hex data static void printBuffer(unsigned
char *digest, unsigned int len) { int i; cout << "length: " << len << endl; for(i = 0;i < len;i++) printf("%02x ", digest[i]); cout << endl; } // XXX Data protection // - takes an input buffer, applies the encryption // and MAC, and generates a buffer with the result. // - the application sends or uses the result (possibly // after base64 encoding it. // // Server - an instance of a...
...ut down the server. (For completeness) int Shutdown(); // Compare keys in two server instances. Use this in the // example to make sure the keys are transferred correctly. ...
... - the name distiguish the keys in the // shared database in this example Server(const
char *serverName); ~Server(); private: int getPrivateKey(SECKEYPrivateKey **prvKey); int getPublicKey(SECKEYPublicKey **pubKey); int wrapKey(PK11SymKey *key, SECKEYPublicKey *pubKey, SECItem **data); // export raw key (unwrapped) DO NOT USE int rawExportKey(PK11SymKey *key, SECItem **data);
char *mServerName; // These items represent data that might be stored // in files or in a configuration file SECItem *mWrappedEncKey; SECItem *mWrappedMacKey; // These are the runtime keys as loaded from the files PK11SymKey *mEncKey; PK11SymKey *mMacKey; }; Server::Server(const
char *serverName) : mServerName(0), mWrappedEncKey(0), mWrappedMacKey(0), mEncKey(0), mMacKey(0) { // C...
...And 4 more matches
nss tech note4
*fd); If SSL client, this will get you the client cert's handle, IF client auth happened If SSL server, this will get you the server's cert handle Don't forget to clean up the cert handle when you're done with it void CERT_DestroyCertificate(CERTCertificate *cert); Some info is readily available cert->subjectName (
char*) cert->issuerName (
char*) cert->emailAddr (
char*) OR
char *CERT_GetCertificateEmailAddress(CERTCertificate *cert); cert->keyUsage (unsigned int) To break the issuer and subject names into components Pass &(cert->issuer) or &(cert->subject) to the following functions
char *CERT_GetCommonName(CERTName *name);
char *CERT_GetCer...
... cert->emailAddr (
char*) OR
char *CERT_GetCertificateEmailAddress(CERTCertificate *cert); cert->keyUsage (unsigned int) To break the issuer and subject names into components Pass &(cert->issuer) or &(cert->subject) to the following functions
char *CERT_GetCommonName(CERTName *name);
char *CERT_GetCertEmailAddress(CERTName *name);
char *CERT_GetCountryName(CERTName *name);
char *CERT_GetLocalityName(CERTName *name);
char *CERT_GetStateName(CERTName *name);
char *CERT_GetOrgName(CERTName *name);
char *CERT_GetOrgUnitName(CERTName *name);
char *CERT_GetDomainComponentName(CERTName *name);
char *CERT_GetCertUid(CERTName *name); Example code to illustrate acces...
... } /* critical attribute of the extension */ ...
...And 4 more matches
JS::Evaluate
rticle covers features introduced in SpiderMonkey 17 Compile and execute a script. ...
...ers features introduced in SpiderMonkey 17 Compile and execute a script. ...
... const JS::ReadOnlyCompileOptions &options, JS::SourceBufferHolder &srcBuf, JS::MutableHandleValue rval); bool JS::Evaluate(JSContext *cx, const JS::ReadOnlyCompileOptions &options, const
char16_t *
chars, size_t length, JS::MutableHandleValue rval); bool JS::Evaluate(JSContext *cx, const JS::ReadOnlyCompileOptions &options, const
char *bytes, size_t length, JS::MutableHandleValue rval); bool JS::Evaluate(JSContext *cx, const JS::ReadOnlyCompileOptions &options, const
char *filename, JS::MutableHandleValue rval); bool JS::Evaluate(JSContext *cx, JS::AutoObjectVector &scopeChain, const ReadOnlyCompileOptions &options, const
char16_t *
chars, size_t length, JS::MutableHandleVal...
...And 4 more matches
JS_CompileScript
Compiles a script for execution. ...
... Compiles a script for execution. ...
... Compiles a script for execution. ...
...And 4 more matches
JS_CompileScriptForPrincipals
Obsolete since JSAPI 28This 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. Compile a security-enabled script for execution. ...
... Obsolete since JSAPI 28This 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. Compile a security-enabled script for execution. ...
...e removed at any time. Try to avoid using it. Compile a security-enabled script for execution. ...
...And 4 more matches
JS_EvaluateScriptForPrincipals
Obsolete since JSAPI 30This 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. Compile and execute a security-enabled script. ...
... Obsolete since JSAPI 30This 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. Compile and execute a security-enabled script. ...
...any time. Try to avoid using it. Compile and execute a security-enabled script. ...
...And 4 more matches
JS_PushArguments
Obsolete since JavaScript 1.8.5This 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. Convert any number of arguments to jsvals and store the resulting jsvals in an array. Syntax jsval * JS_PushArguments(JSContext *cx, void **markp, const
char *format, ...); jsval * JS_PushArgumentsVA(JSContext *cx, void **markp, const
char *format, va_list ap); Name Type Description cx JSContext * The context in which to perform any necessary conversions. cx also affects the interpretation of format, if JS_AddArgumentFormatter has been called. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. markp void ** ...
...orm any necessary conversions. cx also affects the interpretation of format, if JS_AddArgumentFormatter has been called. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. markp void ** Out parameter. On success, *markp receives the internally allocated stack mark which should be passed to JS_PopArguments. format const
char * Null-terminated string holding a list of format types to convert the following arguments to. ... various (in JS_PushArguments) A variable number of arguments to be converted to jsvals. There must be one argument for each argument described in format. ap va_list (in JS_PushArgumentsVA) The list of arguments to be converted to jsvals. There must be one argument fo...
...a_list is a standard feature of the C programming language. It is defined in <stdarg.h>. Description JS_PushArguments provides a convenient way to translate a series of native C/C++ values to jsvals with a single function call. cx is the context for the call. markp points to a void * to hold the internally allocated stack frame pointer to pass back to JS_PopArguments. ...
...And 4 more matches
JSAPI reference
s JSAutoByteString Added in SpiderMonkey 17 JS_NewStringCopyN JS_NewStringCopyZ JS_NewUCString JS_NewUCStringCopyN JS_NewUCStringCopyZ JS_NewDependentString JS_GetEmptyStringValue JS_GetEmptyString Added in SpiderMonkey 1.8.5 JS_ConcatStrings JS_CompareStrings JS_StringEqualsAscii Added in SpiderMonkey 1.8.5 JS_FlatStringEqualsAscii Added in SpiderMonkey 1.8.5 JS_StringHasLatin1
Chars Added in SpiderMonkey 38 JS_GetString
CharAt Added in SpiderMonkey 38 JS_GetFlatString
CharAt Added in SpiderMonkey 38 JS_GetStringLength JS_EncodeString Added in SpiderMonkey 1.8 JS_EncodeStringToUTF8 Added in SpiderMonkey 24 JS_EncodeStringToBuffer Added in SpiderMonkey 1.8.5 JS_GetStringEncodingLength Added in SpiderMonkey 1.8.5 JS_GetLatin1FlatString
Chars Added in SpiderMonkey 38 JS_G...
...nkey 38 JS_GetString
CharAt Added in SpiderMonkey 38 JS_GetFlatString
CharAt Added in SpiderMonkey 38 JS_GetStringLength JS_EncodeString Added in SpiderMonkey 1.8 JS_EncodeStringToUTF8 Added in SpiderMonkey 24 JS_EncodeStringToBuffer Added in SpiderMonkey 1.8.5 JS_GetStringEncodingLength Added in SpiderMonkey 1.8.5 JS_GetLatin1FlatString
Chars Added in SpiderMonkey 38 JS_GetTwoByteFlatString
Chars Added in SpiderMonkey 38 JS_GetLatin1String
CharsAndLength Added in SpiderMonkey 38 JS_GetTwoByteString
CharsAndLength Added in SpiderMonkey 38 JS::GetDeflatedUTF8StringLength Added in SpiderMonkey 38 JS::DeflateStringToUTF8Buffer Added in SpiderMonkey 38 JS_FileEscapedString Added in SpiderMonkey 1.8.5 JS_PutEscapedString Added in SpiderMonkey 1.8.5 JS_PutEscapedFlatString Added in Spid...
...uffer Added in SpiderMonkey 38 JS_FileEscapedString Added in SpiderMonkey 1.8.5 JS_PutEscapedString Added in SpiderMonkey 1.8.5 JS_PutEscapedFlatString Added in SpiderMonkey 1.8.5 JS_FORGET_STRING_FLATNESS Added in SpiderMonkey 1.8.5 JS_StringIsFlat Added in SpiderMonkey 38 JS_ASSERT_STRING_IS_FLAT Added in SpiderMonkey 1.8.5 JS_FlattenString Added in SpiderMonkey 1.8.5 typedef js
char Obsolete since JSAPI 35 JS_NewString Obsolete since JSAPI 1.8.5 JS_NewGrowableString Obsolete since JSAPI 27 JS_GetStringBytes Obsolete since JSAPI 1.8.5 JS_GetStringBytesZ Obsolete since JSAPI 1.8.5 JS_GetString
Chars Obsolete since JSAPI 1.8.5 JS_GetString
CharsZ Obsolete since JSAPI 33 JS_GetString
CharsAndLength Added in JSAPI 1.8.5 Obsolete since JSAPI 33 JS_GetString
CharsZ Added in Spi...
...And 4 more matches
Creating the Component Code
u write a XPCOM component, you implement nsIModule to do all of the necessary registration, unregistration, and object creation. nsIModule has four methods that must be implemented. The Registration Methods Two closely related registration methods are declared below. NS_IMETHOD RegisterSelf(nsIComponentManager *aCompMgr, nsIFile *aLocation, const
char *aLoaderStr, const
char *aType) = 0; NS_IMETHOD UnregisterSelf(nsIComponentManager *aCompMgr, nsIFile *aLocation, const
char *aLoaderStr) = 0; RegisterSelf is called when a component is first registered with XPCOM. It is only called once, which gives you a chance to add any one time setup functionality. The RegisterSel...
...e it has just loaded and called RegisterSelf on, passing this value to the registration methods is a shortcut for determining what kind of component is being registered. nsIComponentRegistrar Methods To tell XPCOM what implementation is in the component library, call this method from RegisterSelf: NS_IMETHOD RegisterFactoryLocation(const nsCID & aClass, const
char *aClassName, const
char *aContractID, nsIFile *aFile, const
char *aLoaderStr, const
char *aType) = 0; The last three parameters are the same as the three passed into the RegisterSelf method of nsIModule objects. All you have to do is forward these parameter...
...nterface also as an IID which is the same for both implementations. When specifying implementation A, the two required pieces of information are the CID of A and the IID of the interface that A supports. ...
...And 4 more matches
nsIDOMWindowUtils
CompositionEvent(in AString aType); Obsolete since Gecko 9 void sendCompositionEvent(in AString aType, in AString aData, in AString aLocale); Obsolete since Gecko 38.0 void sendContentCommandEvent(in AString aType, [optional] in nsITransferable aTransferable); void getClassName(in object aObj); boolean sendKeyEvent(in AString aType, in long aKeyCode, in long a
CharCode, in long aModifiers, [optional] in boolean aPreventDefault); Obsolete since Gecko 15.0 boolean sendKeyEvent(in AString aType, in long aKeyCode, in long a
CharCode, in long aModifiers, [optional] in unsigned long aAdditionalFlags); Deprecated since Gecko 38.0 void sendMouseEvent(in AString aType, in float aX, in float aY, in long aButton, in long aClickCount, in long aModifi...
...rs); Obsolete since Gecko 17.0 void sendWheelEvent(in float aX, in float aY, in double aDeltaX, in double aDeltaY, in double aDeltaZ, in unsigned long aDeltaMode, in long aModifiers, in long aLineOrPageDeltaX, in long aLineOrPageDeltaY, in unsigned long aOptions); void sendNativeKeyEvent(in long aNativeKeyboardLayout, in long aNativeKeyCode, in long aModifierFlags, in AString a
Characters, in AString aUnmodified
Characters); void sendNativeMouseEvent(in long aScreenX, in long aScreenY, in long aNativeMessage, in long aModifierFlags, in nsIDOMElement aElement); nsIQueryContentEventResult sendQueryContentEvent(in unsigned long aType, in unsigned long aOffset, in unsigned long aLength, in long aX, in long aY); Obsolete since Gecko 31.0 nsIQueryConte...
...IDOMFile wrapDOMFile(nsIFile aFile); Attributes Attribute Type Description currentInnerWindowID unsigned long long The ID of the window's current inner window. Read only. Exceptions thrown NS_ERROR_NOT_AVAILABLE There is no current inner window displayDPI float The DPI of the display. Read only. doc
CharsetIsForced boolean Whether the
charset of the window's current document has been forced by the user. Cannot be accessed from unprivileged context (not content-accessible) Read only. elementsRestyled Read only unsigned long long The number of elements which have been restyled for the current document. Keep in mind that during a restyle operation, an element may be restyled m...
...And 4 more matches
nsIIOService
.getService(Components.interfaces.nsIIOService); Method overview boolean allowPort(in long aPort, in string aScheme); ACString extractScheme(in AUTF8String urlString); unsigned long getProtocolFlags(in string aScheme); nsIProtocolHandler getProtocolHandler(in string aScheme); nsIChannel newChannel(in AUTF8String aSpec, in string aOrigin
Charset, in nsIURI aBaseURI); Obsolete since Gecko 48 nsIChannel newChannel2(in AUTF8String aSpec, in string aOrigin
Charset, in nsIURI aBaseURI, in nsIDOMNode aLoadingNode, in nsIPrincipal aLoadingPrincipal, in nsIPrincipal aTriggeringPrincipal, in uint32_t aSecurityFlags, in uint32_t aContentPolicyType); nsIChannel newChannelFromURI(in nsIURI aURI); Obsolete since Gecko 48 ...
...When in offline mode, attempts to access the network will fail (although this does not necessarily correlate with whether there is actually a network available -- that's hard to detect without causing the dialer to come up). Observer...
...a given URI scheme. nsIProtocolHandler getProtocolHandler( in string aScheme ); Parameters aScheme The URI scheme for which to get a protocol handler. Return value An nsIProtocolHandler for the scheme. newChannel() Obsolete since Gecko 48 A shortcut method to avoid repeated calls of newURI() and newChannelFromURI(). nsIChannel newChannel( in AUTF8String aSpec, in string aOrigin
Charset, in nsIURI aBaseURI ); Parameters aSpec The spec for the desired uri. aOrigin
Charset The
charset for the uri. May be null. aBaseURI The base URI for the spec. May be null. If aSpec is an absolute URL, this parameter is ignored. Return value Returns an nsIChannel based on aSpec and aBaseURI. newChannel2() A shortcut method to avoid repeated calls of newURI() and newChannelFromU...
...And 4 more matches
nsIMsgIdentity
The nsIMsgIdentity interface contains all the personal outgoing mail information for a given person. Each identity is identified by a key, which is the id string in the identity preferences, such as in mail.identity.<id>.replyTo. ...
...ontains all the personal outgoing mail information for a given person. Each identity is identified by a key, which is the id string in the identity preferences, such as in mail.identity.<id>.replyTo. ...
... Each identity is identified by a key, which is the id string in the identity preferences, such as in mail.identity.<id>.replyTo. ...
...And 4 more matches
Component; nsIPrefBranch
age", or "homepage_override" to the various Get/Set methods. ...
... long getPrefType(in string aPrefName); void lockPref(in string aPrefName); boolean prefHasUserValue(in string aPrefName); boolean prefIsLocked(in string aPrefName); void removeObserver(in string aDomain, in nsIObserver aObserver); void resetBranch(in string aStartingAt); void setBoolPref(in string aPrefName, in long aValue); void set
CharPref(in string aPrefName, in string aValue); Requires Gecko 58 void setStringPref(in string aPrefName, in utf8string aValue); void setComplexValue(in string aPrefName, in nsIIDRef aType, in nsISupports aValue); void setIntPref(in string aPrefName, in long aValue); void unlockPref(in string aPrefName); Attributes Attribute Type Description ...
...e of an individual boolean preference. boolean getBoolPref( in string aPrefName, [optional] in boolean aDefaultValue ); Parameters aPrefName The boolean preference to get the state of. aDefaultValue Requires Gecko 54 Optional - a default value to use if the preference does not exist (instead of throwing an exception). Return value The value of the requested boolean preference. get
CharPref() Called to get the state of an individual string preference. string get
CharPref( in string aPrefName, [optional] in string aDefaultValue ); Parameters aPrefName The string preference to retrieve. aDefaultValue Requires Gecko 54 Optional - a default value to use if the preference does not exist (instead of throwing an exception). Return value Returns string - The value of the...
...And 4 more matches
nsIScriptableIO
nts.classes["@mozilla.org/io/scriptable-io;1"] .getService(); scriptableIO.getFile("Profile", "cookies.txt"); Method overview nsIFile getFile(in AString aLocation, in AString aFileName); nsIFile getFileWithPath(in AString aFilePath); nsISupports newInputStream(in nsIVariant aBase, in AString aMode, [optional] in AString a
CharSet, [optional] in AString aReplace
Char, [optional] in unsigned long aBufferSize); nsISupports newOutputStream(in nsIVariant aBase, in AString aMode, [optional] in AString a
CharSet, [optional] in AString aReplace
Char, [optional] in unsigned long aBufferSize, [optional] in unsigned long aPermissions); nsIURI newURI(in nsIVariant aUri); Methods getFile() Retr...
...his parameter may be specified either as a URL string or as an nsIFile object. Return value Returns an nsIURI object corresponding to the specified string or file. Exceptions thrown NS_ERROR_INVALID_ARG aUri was null. newInputStream() Retrieves a stream from which data can be read. nsISupports newInputStream( in nsIVariant aBase, in AString aMode, [optional] in AString a
CharSet, [optional] in AString aReplace
Char, [optional] in unsigned long aBufferSize ); Parameters aBase The base object from which to read. This should be one of the following types: nsIFile: An object returned by getFile() or getFileWithPath(), or any object implementing the nsIFile interface. nsITransport: A transport object such as a socket. nsIInputStream: A stream ...
...t. nsIInputStream: A stream returned by a previous call to this method, or any other object that implements nsIInputStream. string: A string from which to read data. aMode A space-delineated string of mode terms controlling the manner in which the stream is accessed. If none of these modes are desired, specify an empty string. text: Read Unicode-converted text. The default
character set is UTF-8; to read text in another
character set, set the a
CharSet argument to the desired
character set. buffered: A stream that uses a buffer to hold a block of the next piece of the data to be read. This mode is generally used as a wrapper for other streams. By default, the buffer size is 1024 bytes; however, the size may be changed by specifying the aBufferSize parameter. If the tex...
...And 4 more matches
nsISelectionController
content/base/public/nsISelectionController.idlScriptable Please add a summary to this article. ...
... content/base/public/nsISelectionController.idlScriptable Please add a summary to this article. ...
... content/base/public/nsISelectionController.idlScriptable Please add a summary to this article. ...
...And 4 more matches
nsIUTF8ConverterService
intl/uconv/idl/nsIUTF8ConverterService.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 1.7 Method overview AUTF8String convertStringToUTF8(in ACString aString, in string a
Charset, in boolean aSkipCheck); AUTF8String convertURISpecToUTF8(in ACString aSpec, in string a
Charset); Methods convertStringToUTF8() Ensure that aString is encoded in UTF-8. If not, convert to UTF-8 assuming it's encoded in a
Charset and return the converted string in UTF-8. ...
... aSkipCheck Determines whether or not to skip 'ASCIIness' and 'UTF8ness' check. ...
... aSkipCheck Determines whether or not to skip 'ASCIIness' and 'UTF8ness' check. Set this to PR_TRUE only if you suspect that aString can be mistaken for ASCII / UTF-8 but is actually not in ASCII / UTF-8 so that aString has to go through the conversion. Skipping ASCIIness/UTF8ness check. ...
...And 4 more matches
XPIDL Syntax
expr ("<<" / ">>") expr expr /= expr ("+" / "-") expr expr /= expr ("*" / "/" / "%") expr expr /= ["-" / "+" / "~"] (scoped_name / literal / "(" expr ")" ) ; Numeric literals: quite frankly, I'm sure you know how these kinds of ; literals work, and these are annoying to specify in ABNF. ...
... / literal / "(" expr ")" ) ; Numeric literals: quite frankly, I'm sure you know how these kinds of ; literals work, and these are annoying to specify in ABNF. literal = octal_literal / decimal_literal / hex_literal / floating_literal literal /= string_literal /
char_literal literal /= "TRUE" / "FALSE" ; In regex: /"[^"\n]*["\n]/. Yes, newline terminates. ...
...re you know how these kinds of ; literals work, and these are annoying to specify in ABNF. literal = octal_literal / decimal_literal / hex_literal / floating_literal literal /= string_literal /
char_literal literal /= "TRUE" / "FALSE" ; In regex: /"[^"\n]*["\n]/. Yes, newline terminates. ...
...And 4 more matches
Using C struct and pointers
In this example, we show how to use C structs and pointers with js-ctypes. ...
... In this example, we show how to use C structs and pointers with js-ctypes. ...
... The first parameter of this method is the name of the type,...
...And 4 more matches
CSSStyleSheet.insertRule() - Web APIs
efore sending the arguments to the default native insertRule(). ...
...t native insertRule(). ...
...nction(Sheet_proto){ var originalInsertRule = Sheet_proto.insertRule; if (originalInsertRule.length === 2){ // 2 mandatory arguments: (selector, rules) Sheet_proto.insertRule = function(selectorAndRule){ // First, separate the selector from the rule a: for (var i=0, Len=selectorAndRule.length, isEscaped=0, new
CharCode=0; i !== Len; ++i) { new
CharCode = selectorAndRule.
charCodeAt(i); if (!isEscaped && (new
CharCode === 123)) { // 123 = "{".
charCodeAt(0) // Secondly, find the last closing bracket var openBracketPos = i, closeBracketPos = -1; for (; i !== Len; ++i) { new
CharCode = selectorAndRule.
charCodeAt(i); if (!isEscaped && (new
CharCode === 125)) { // 125 = "}".
charCodeAt(0) closeBracketP...
...And 4 more matches
HTMLInputElement - Web APIs
lete the value using previously stored value off: the user must explicity enter a value max string: Returns / Sets the element's max attribute, containing the maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value. maxLength long: Returns / Sets the element's maxlength attribute, containing the maximum number of
characters (in Unicode code points) that the value can have. (If you set this to a negative number, an exception will be thrown.) min string: Returns / Sets the element's min attribute, containing the minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value. minLength long: Returns / Sets the element's minlength attrib...
...he value can have. (If you set this to a negative number, an exception will be thrown.) min string: Returns / Sets the element's min attribute, containing the minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value. minLength long: Returns / Sets the element's minlength attribute, containing the minimum number of
characters (in Unicode code points) that the value can have. (If you set this to a negative number, an exception will be thrown.) pattern string: Returns / Sets the element's pattern attribute, containing a regular expression that the control's value is checked against. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attri...
...box, 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 offset of the
character immediately following the current text input cursor position. selectionDirection string: Returns / Sets the direction in which selection occurred. Possible values are: forward if selection was performed in the start-to-end direction of the current locale backward for the opposite direction none if the direction is unknown size unsigned long: Returns / Sets th...
...And 4 more matches
KeyboardEvent.shiftKey - Web APIs
The KeyboardEvent.shiftKey read-only property is a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred. ...
... The KeyboardEvent.shiftKey read-only property is a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred. ...
...eyboardEvent.shiftKey read-only property is a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred. ...
...And 4 more matches
KeyboardEvent.which - Web APIs
The which read-only property of the KeyboardEvent interface returns the numeric keyCode of the key pressed, or the
character code (
charCode) for an alphanumeric key pressed. Syntax var keyResult = event.which; Return value keyResult contains the numeric code for a particular key pressed, depending on whether an alphanumeric or non-alphanumeric key was pressed. Please see KeyboardEvent.
charCode and KeyboardEvent.keyCode for more details. ...
...keyCode of the key pressed, or the
character code (
charCode) for an alphanumeric key pressed. Syntax var keyResult = event.which; Return value keyResult contains the numeric code for a particular key pressed, depending on whether an alphanumeric or non-alphanumeric key was pressed. Please see KeyboardEvent.
charCode and KeyboardEvent.keyCode for more details. ...
...n alphanumeric or non-alphanumeric key was pressed. Please see KeyboardEvent.
charCode and KeyboardEvent.keyCode for more details. ...
...And 4 more matches
<th> - HTML: Hypertext Markup Language
HTML5 This enumerated attribute specifies how the cell content's horizontal alignment will be handled. Possible values are: left: The content is aligned to the left of the cell. center: The content is centered in the cell. right: The content is aligned to the right of the cell. justify (with text only): The content is stretched out inside the cell so that it covers its entire width.
char (with text only): The content is aligned to a
character inside the <th> element with minimal offset. This
character is defined by the
char and
charoff attributes. The default value when this attribute is not specified is left. Note: Do not use this attribute as it is obsolete in the latest standard. To achieve the same effect as the left, center, right or justify values, apply the CSS ...
...Unimplemented in CSS3. axis Obsolete since HTML5 This attribute contains a list of space-separated strings. Each string is the id of a group of cells that this header applies to. ...
...Unimplemented in CSS3. ...
...And 4 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
align on every cell in the row individually. Possible values are: left Align the content of each cell at its left edge. center Center the contents of each cell between their left and right edges. right Align the content of each cell at its right edge. justify Widen whitespaces within the text of each cell so that the text fills the full width of each cell (full justification).
char Align each cell in the row on a specific
character (such that each row in the column that is configured this way will horizontally align its cells on that
character). This uses the
char and
charoff to establish the alignment
character (typically "." or "," when aligning numerical data) and the number of
characters that should follow the alignment
character. This alignment type was never widely ...
... bgcolorObsolete since HTML5 A DOMString specifying a color to apply to the backgrounds of each of the row's cells. This can be either an hexadecimal #RRGGBB or #RGB value or a color keyword. ...
...acter. This alignment type was never widely supported. If no value is expressly set for align, the parent node's value is inherited. Instead of using the obsolete align attribute, you should instead use the CSS text-align property to establish left, center, right, or justify alignment for the row's cells. To apply
character-based alignment, set the CSS text-align property to the alignment
character (such as "." or ","). bgcolorObsolete since HTML5 A DOMString specifying a color to apply to the backgrounds of each of the row's cells. This can be either an hexadecimal #RRGGBB or #RGB value or a color keyword. Omitting the attribute or setting it to null in JavaScript causes the row's cells to inherit the row's parent element's background color. The <tr> element should be s...
...And 4 more matches
String length - JavaScript
The length property of a String object contains the length of the string, in UTF-16 code units. length is a read-only data property of string instances. Description This property returns the number of code units in the string. UTF-16, the string format used by JavaScript, uses a single 16-bit code unit to represent the most common
characters, but needs to use two code units for less commonly-used
characters, so it's possible for the value returned by length to not match the actual number of
characters in the string. ECMAScript 2016 (ed. 7) established a maximum length of 2^53 - 1 elements. Previously, no maximum length was specified. In Firefox, strings have a maximum length of 2**30 - 2 (~1GB). In versions prior to Firefox 65, the maximum length was 2**28 - 1 (~256MB). For an empty str...
...Firefox, strings have a maximum length of 2**30 - 2 (~1GB). In versions prior to Firefox 65, the maximum length was 2**28 - 1 (~256MB). For an empty string, length is 0. The static property String.length is unrelated to the length of strings, it's the arity of the String function (loosely, the number of formal parameters it has), which is 1. ...
...30 - 2 (~1GB). In versions prior to Firefox 65, the maximum length was 2**28 - 1 (~256MB). For an empty string, length is 0. The static property String.length is unrelated to the length of strings, it's the arity of the String function (loosely, the number of formal parameters it has), which is 1. ...
...And 4 more matches
Appendix: What you should know about open-source software licenses - Archive of obsolete content
ese for the Firefox Developers Conference Summer 2007. Any discussion of open-source software deserves an explanation of licensing-related issues. In this chapter, I'll explain some of the basics: what open-source software (OSS) licenses are, what types of licenses exist, and when they're appropriate. What is an OSS license? What are the different kinds of OSS licenses and what are their key
characteristics? Applying an OSS license OSS licensing today and in the future References What is an OSS license? An open-source software license is a statement that anyone is free to use your source code in whatever way they want. The Open Source Definition states what conditions the OSS license must satisfy. Perhaps surprisingly, these licenses enforce their terms through the exercise of copyr...
... additional licensing can be required when redistributing" rule means that you cannot prohibit the software's use from anyone who does not buy a separate license. Because the OSS license is intended to foster source-code reuse and mutual development, it avoids restrictions on source-code duplication, distribution, and modification to the greatest extent possible. Types of OSS licenses and their
characteristics The details of OSS licenses vary from one license to the next. I'll look at three representative licenses here, and explain some of their features and relevant points. Most attempts at explaining open source start with the GPL. This is the longest, most complicated, and hardest to understand. So instead, I'm going to start with the simplest, the Modified BSD license. The table below...
...nse (MPL) This is an OSS license created by Netscape and the Mozilla Organization. Netscape created it for its open-source web browser. The Common Public License (CPL) and Eclipse Public License (EPL) are similar in substance. Because the CPL is written in such a way that it does not mention any software or company by name, you can use the CPL if you plan to use this kind of licensing. License
characteristics If you modify source code that was published under this license, you are obliged to release it under the same license. However, if you develop an original module as an addition to it, that restriction does not apply. So plug-ins and the like can be released under different licenses. Also, because source code released under this license may include patented code, that fact must be dis...
...And 3 more matches
Using Dependent Libraries In Extension Components - Archive of obsolete content
(LIB_SUFFIX) \ $(XPCOM_FROZEN_LDOPTS) \ $(NSPR_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk DEFINES += -DMOZ_DLL_PREFIX=\"$(DLL_PREFIX)\" extensions/stub/bdsStubLoader.cpp // Copyright (c) 2005 Benjamin Smedberg <benjamin@smedbergs.us> #include "nscore.h" #include "nsModule.h" #include "prlink.h" #include "nsILocalFile.h" #include "nsStringAPI.h" #include "nsCOMPtr.h" static
char const *const kDependentLibraries[] = { // dependent1.dll on windows, libdependent1.so on linux MOZ_DLL_PREFIX "dependent1" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "dependent2" MOZ_DLL_SUFFIX, nsnull // NOTE: if the dependent libs themselves depend on other libs, the subdependencies // should be listed first. }; // component.dll on windows, libcomponent.so on linux static
char kRealComponent...
...We don't care about that either. } library->SetNativeLeafName(NS_LITERAL_CSTRING(kRealComponent)); PRLibrary ...
...amin Smedberg <benjamin@smedbergs.us> Copyright (c) 2005 * Adapted for OS X by Walter Johnson <zinkyu@gmail.com>, Sept. 2008 */ //Include the stuff from Mozilla Glue that we need #include "nsILocalFile.h" #include "nsStringAPI.h" #include "nsCOMPtr.h" //Include things from the mach-o libraries that we need for loading the libraries. #include <mach-o/loader.h> #include <mach-o/dyld.h> static
char const *const kDependentLibraries[] = { // dependent1.dll on windows, libdependent1.so on linux, libdependent1.dylib on Mac MOZ_DLL_PREFIX "dependent1" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "dependent2" MOZ_DLL_SUFFIX, nsnull // NOTE: if the dependent libs themselves depend on other libs, the subdependencies // should be listed first. }; // component.dll on windows, libcomponent.so on linux,...
...And 3 more matches
Adding preferences to an extension - Archive of obsolete content
prefs is configured by startup() to reference our extension's preferences, while tickerSymbol indicates the stock symbol to monitor. The first thing the startup() function does is to get a reference to the preferences for our ...
...ives notification. When events occur, such as a preference being altered, our observe() method will be called automatically. Now that we're monitoring the preferences, we can set up to watch the stock information and display it in the status bar panel. The first thing we need to do is get the currently configured stock symbol to watch from the preferences. To do so, we call the nsIPrefBranch.get
CharPref() method, specifying that we want the preference named "symbol", which is where we store the user's selection for the stock to watch. We forcibly convert the symbol to upper-case since that's the way stock symbols are normally displayed. Next, we call our own refreshInformation() method to immediately fetch and display the current information about the stock the extension is configured to mo...
...}, observe() The StockWatcher.observe() function is called whenever an event occurs on the preference branch we're watching. For details on how observers work, read up on the nsIObserver interface. observe: function(subject, topic, data) { if (topic != "nsPref:changed") { return; } switch(data) { case "symbol": this.tickerSymbol = this.prefs.get
CharPref("symbol").toUpperCase(); this.refreshInformation(); break; } }, The topic parameter indicates what type of event occurred. If it's not nsPref:changed, we simply ignore the event, since all we're interested in is changes to the values of our preferences. Once we've established that the event is in fact a preference change, we look at the data parameter, which contains...
...And 3 more matches
jspage - Archive of obsolete content
a={Array:Array,Date:Date,Function:Function,Number:Number,RegExp:RegExp,String:String};for(var h in a){new Native({name:h,initialize:a[h],protect:true}); }var d={"boolean":Boolean,"native":Native,object:Object};for(var c in d){Native.typize(d[c],c);}var f={Array:["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],String:["
charAt","
charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]}; for(var e in f){for(var b=f[e].length;b--;){Native.genericize(a[e],f[e][b],true);}}})();var Hash=new Native({name:"Hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getClean()); }for(var b in a){this[b]=a[b];}return this;}});Hash.imp...
...x","min","pow","sin","sqrt","tan"]);String.implement({test:function(a,b){return((typeof a=="string")?new RegExp(a,b):a).test(this); },contains:function(a,b){return(b)?(b+this+b).indexOf(b+a+b)>-1:this.indexOf(a)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim(); },camelCase:function(){return this.replace(/-\D/g,function(a){return a.
charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(a){return("-"+a.
charAt(0).toLowerCase()); });},capitalize:function(){return this.replace(/\b[a-z]/g,function(a){return a.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1"); },toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this);},h...
...(1).hexToRgb(b):null;},rgbToHex:function(b){var a=this.match(/\d{1,3}/g);return(a)?a.rgbToHex(b):null;},stripScripts:function(b){var a=""; var c=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){a+=arguments[1]+"\n";return"";});if(b===true){$exec(a);}else{if($type(b)=="function"){b(a,c); }}return c;},substitute:function(a,b){return this.replace(b||(/\\?{([^{}]+)}/g),function(d,c){if(d.
charAt(0)=="\\"){return d.slice(1);}return(a[c]!=undefined)?a[c]:""; });}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){for(var a in this){if(this.hasOwnProperty(a)&&this[a]===b){return a;}}return null; },hasValue:function(a){return(Hash.keyOf(this,a)!==null);},extend:function(a){Hash.each(a||{},function(c,b){Hash.set(this,b,c);},this);return this;},combine:function(a){Hash.e...
...And 3 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
created the title attribute, which is meant to contain a detailed description of the link. Modern browsers will use the title attribute to display tooltips, and Mozilla only supports showing tooltips for that attribute and not the alt attribute. Entities HTML markup can contain several entities, which the W3C web standards body has defined. ...
...ion of the link. Modern browsers will use the title attribute to display tooltips, and Mozilla only supports showing tooltips for that attribute and not the alt attribute. Entities HTML markup can contain several entities, which the W3C web standards body has defined. You can reference entities through their numerical or
character reference. For example, you can reference the non-breaking space
character with   or with its equivalent
character reference . Some older browsers, such as Internet Explorer, had such quirks as allowing you to use entities by replacing the ; (semi-colon)
character at the end with regular text content:   Foo    Foo Internet Explorer will render the above   as white spaces, even though that is against the W3C specification. The browser ...
...Always use the correct form ( ) to avoid browser discrepancies. ...
...And 3 more matches
Modularization techniques - Archive of obsolete content
our interfaces unless you're concerned with COM compatibility. All Mozilla interfaces inherit from nsISupports. Inheriting from nsISupports allows any interface to be interrogated about other interfaces that its instance may support, and insures that reference counting facilities are always available. The IID for nsISupports is defined as NS_ISUPPORTS_IID. QueryInterface() has several important
characteristics that must be maintained. If you perform a QueryInterface() on interface A and obtain interface B, you must be able to perform a QueryInterface() B and obtain interface A. If interfaces A and B are both implemented by the same instance, performing a QueryInterface() for nsISupports on either should return the exact same interface. This means that even though interface B inherits from ns...
... void **aResult); // Manually registry a factory for a class static nsresult RegisterFactory(const nsCID &aClass, nsIFactory *aFactory, PRBool aReplace); // Manually registry a dynamically loaded factory for a class static nsresult RegisterFactory(const nsCID &aClass, const
char *aLibrary, PRBool aReplace, PRBool aPersist); // Manually unregister a factory for a class static nsresult UnregisterFactory(const nsCID &aClass, nsIFactory *aFactory); // Manually unregister a dynamically loaded factory for a class static nsresult UnregisterFactory(const nsCID &aClass,...
...The most direct is through RegisterFactory(). RegisterFactory() supports two different registration mechanisms. The first takes a class ID and a pointer to a factory. This mechanism can be used on factories that are...
...And 3 more matches
Elements - Archive of obsolete content
cripting. (See bug 83830 for <table> specifics). CSS: div { -moz-binding: url(myBinding.xml#default); } DOM: elementReference.style.MozBinding = "url(myBinding.xml#default)"; In both cases above we are using binding with id="default" contained in file myBinding.xml Starting with Firefox 3, you can also use a data: URL to embed the binding inline: div { -moz-binding: url(data:text/xml;
charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cbindings%20id%3D%22xbltestBindings%22%20xmlns%3D%22http%3A//www.mozilla.org/xbl%22%3E%0A%20%20%3Cbinding%20id%3D%22xbltest%22%3E%3Ccontent%3EPASS%3C/content%3E%3C/binding%3E%0A%3C/bindings%3E%0A); } Since data: URLs don't support fragment identifiers, the first binding found in the embedded XML is used instead. Keep in mind that the binding is...
...t this binding inherits from (see Inheritance of Implementations). The URL specifies a particular binding document. The # notation must be used to point to a specific binding id within a binding document. Note that content cannot be inherited, only behavior. display - This attribute specifies how the tag is displayed. By setting this attribute, you can have an element have the layout and display
characteristics of an existing element. For example, use the value 'xul:button' to create an element that is displayed like a button. The part before the colon is a namespace prefix so you must declare the XUL namespace as well. Not all tags have a unique display type. The following XUL display types may be used: browser, button, checkbox, description, editor, grippy, iframe, image, label, menu, menui...
... default content will be ignored. If the element does not contain content, the default content will be added. id - The id attribute is a document-unique identifier. includes - The includes attribute can be used to indicate that only certain content should be placed at the insertion point specified by the children element. Its value can be a tag name or multiple tag names separated by the pipe
character ("|"). A child can only be placed within the insertion point if it is matched by the value in the includes attribute. Only immediate children are matched against the selector. For example, an XML fragment <customElement><foobar><hoge/></foobar></customElement> with an binding definition <binding id="customElement"><content><xul:box><children includes="hoge"/></xul:box></content></binding> fo...
...And 3 more matches
Writing to Files - Archive of obsolete content
File I/O, Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. To write to a file, an output stream is used. An output stream is an object which can be used to write bytes, strings and other values to a file. To create an output stream, use nsIScriptableIO.newOutputStream(). This method has a number of options to specify text or binary writing, the
character set, and whether to append to an existing file or create a new one. To create an input stream, first get a reference to a nsIFile, and then use nsIScriptableIO.newOutputStream() to open a stream for writing to it. To learn more about file objects, see Files and Streams. try { var file = IO.getFile("Desktop", "myinfo.txt"); var stream = IO.newOutputStream(file, "text"); } catch (ex) { ale...
...apture any errors that might occur during the process. See File Errors for a list of errors that might occur. The newOutputStream method takes two arguments in this example. The first argument is the file to write to, and the second is a set of flags which control the writing. In this case, the 'text' flag is used which indicates that you will be writing text to the file. When writing text files,
characters are writing using a chosen
character set, encoded automatically. The default
character set is 'UTF-8' but this can be changed using an additional, yet optional, argument to the newOutputStream method. See below for more details about this. Creating and Appending to Files A number of flags control whether a new file is created when writing or whether data is appended to an existing file. The...
... set these flags. However, here is an example of how they might be used: var stream = IO.newOutputStream(file, "text nocreate append"); The flags are specified in a space separated list as the second argument to the newOutputStream method. In this example, the nocreate flag is used to prevent the creation of new files, and the append flag is used to append to an existing file. ...
...And 3 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
plies to SeaMonkey 2, Firefox, Thunderbird and Sunbird, see: Custom Toolbar Button Earlier versions and other Mozilla applications also support extensions, but some parts of this tutorial are not appropriate for them. Required tools You will need two tools. Your operating system normally provides them: A way to create and work with files and directories A text editor for plain text files
Character encoding Some text editors have a setting for
character encoding. If your language uses only plain Latin (ASCII)
characters, set your text editor to use any encoding except Unicode. If your language uses accents or other non-Latin
characters, set your text editor to save files using the UTF-8 encoding. To check your text editor, create a plain text file named test.txt. In the file, type some...
...Save the file. Open the file in SeaMonkey (for example, by dragging it and dropping it in the Navigator window, or by choosing File - Open File... from SeaMonkey's menu bar). From SeaMonkey's menu bar, choose View -
Character Encoding - Unicode (UTF-8). Check that the text you typed looks OK with this setting. ...
...r to save files using the UTF-8 encoding. To check your text editor, create a plain text file named test.txt. In the file, type some of the special
characters that your language uses. Save the file. Open the file in SeaMonkey (for example, by dragging it and dropping it in the Navigator window, or by choosing File - Open File... from SeaMonkey's menu bar). From SeaMonkey's menu bar, choose View -
Character Encoding - Unicode (UTF-8). Check that the text you typed looks OK with this setting. If your text editor does not support UTF-8, search the Internet for a better one that you can download. Optional tools You can optionally use any image editor to customize the images. You can optionally use a jar tool or zip tool to package your button as a cross-platform installable (XPI) for other people ...
...And 3 more matches
Custom toolbar button - Archive of obsolete content
a similar tutorial for SeaMonkey 1.x on the page: Custom Toolbar Button:SeaMonkey Earlier versions and other Mozilla applications also support extensions, but some parts of this tutorial are not appropriate for them. Required tools You will need two tools. Your operating system normally provides them: A way to create and work with files and directories A text editor for plain text files
Character encoding Some text editors have a setting for
character encoding. If your language uses only plain Latin (ASCII)
characters, set your text editor to use any encoding except Unicode. If your language uses accents or other non-Latin
characters, set your text editor to save files using the UTF-8 encoding. To check your text editor, create a plain text file named test.txt. In the file, type ...
...Save the file. Open the file in Firefox (for example, by dragging it and dropping it in Firefox, or by choosing File - Open File... from Firefox's menu bar). From Firefox's menu bar, choose View -
Character Encoding - Unicode (UTF-8). Check that the text you typed looks OK with this setting. ...
... your text editor to save files using the UTF-8 encoding. To check your text editor, create a plain text file named test.txt. In the file, type some of the special
characters that your language uses. Save the file. Open the file in Firefox (for example, by dragging it and dropping it in Firefox, or by choosing File - Open File... from Firefox's menu bar). From Firefox's menu bar, choose View -
Character Encoding - Unicode (UTF-8). Check that the text you typed looks OK with this setting. If your text editor does not support UTF-8, search the Internet for a better one that you can download. Optional tools You can optionally use any image editor to customize the images. You can optionally use a jar tool or zip tool to package your button as a cross-platform installable (XPI) for other peo...
...And 3 more matches
NPN_GetAuthenticationInfo - Archive of obsolete content
<< Gecko Plugin API Reference << Browser Side Plug-in API Summary The function is called by plugins to get HTTP authentication information from the browser. ...
... << Gecko Plugin API Reference << Browser Side Plug-in API Summary The function is called by plugins to get HTTP authentication information from the browser. ...
...e << Browser Side Plug-in API Summary The function is called by plugins to get HTTP authentication information from the browser. ...
...And 3 more matches
Whitespace - MDN Web Docs Glossary: Definitions of Web-related terms
They are also used as a separator of an element name and its parameters, class names, and so on. ...
...They are also used as a separator of an element name and its parameters, class names, and so on. ...
...They are also used as a separator of an element name and its parameters, class names, and so on. ...
...And 3 more matches
What’s in the head? Metadata in HTML - Learn web development
Prerequisites: Basic HTML familiarity, as covered in Getting started with HTML. Objective: To learn about the HTML head, its purpose, the most important items it can contain, and what effect it can have on the HTML document. What is the HTML head? Let's revisit the simple HTML document we covered in the previous article: <!DOCTYPE html> <html> <head> <meta
charset="utf-8"> <title>My test page</title> </head> <body> <p>This is my page</p> </body> </html> The HTML head is the contents of the <head> element -- unlike the contents of the <body> element (which are displayed on the page when loaded in a browser), the head's content is not displayed on the page. Instead, the head's job is to contain metadata about the document. In the above exam...
... </head> <body> <p>This is my page</p> </body> </html> The HTML head is the contents of the <head> element -- unlike the contents of the <body> element (which are displayed on the page when loaded in a browser), the head's content is not displayed on the page. Instead, the head's job is to contain metadata about the document. In the above example, the head is quite small: <head> <meta
charset="utf-8"> <title>My test page</title> </head> In larger pages however, the head can get quite full. Try going to some of your favorite websites and use the developer tools to check out their head contents. Our aim here is not to show you how to use everything that can possibly be put in the head, but rather to teach you how to use the major elements that you'll want to include in the head, a...
...the other stuff we are talking about in this article could also be thought of as metadata too. There are a lot of different types of <meta> elements that can be included in your page's <head>, but we won't try to explain them all at this stage, as it would just get too confusing. Instead, we'll explain a few things that you might commonly see, just to give you an idea. Specifying your document's
character encoding In the example we saw above, this line was included: <meta
charset="utf-8"> This element simply specifies the document's
character encoding -- the
character set that the document is permitted to use. utf-8 is a universal
character set that includes pretty much any
character from any human language. This means that your web page will be able to handle displaying any language; it's...
...And 3 more matches
Mozilla’s UAAG evaluation report
look - all font sizes are increased the same percentage. Zooming can be controlled via hotkeys Ctrl+plus and Ctrl+minus The prefs are at Preferences, Appearances, Fonts There is also a hidden pref line that can be added to prefs.js, if you just want to change the minimum font size for a certain font: user_pref("font.minimum-size.x-western", newFontSizeInPoints); For other i18n
charsets, change x-western to x-central-euro, x-cyrillic, x-unicode, x-user-def, x-baltic, el, tr, he, ar, th, ja, zh-CN or zh-TW 4.2 Configure font family. (P1) C Can be changed through preferences or user style sheet The prefs are at Preferences, Appearances, Fonts 4.3 Configure text colors. (P1) VG Can be changed through preferences or by editing the prefs.js file ...
... images 4.8 Control other multimedia. (P2) NA 4.9 Global volume control. (P1) NA 4.10 Independent volume control. (P1) NA 4.11 Control other volume. (P2) NA 4.12 Configure synthesized speech rate. (P1) NA 4.13 Configure synthesized speech volume. (P1) NA 4.14 Configure synthesized speech
characteristics. (P1) NA 4.15 Specific synthesized speech
characteristics. (P2) NA 4.16 Configure synthesized speech features. (P2) NA 4.17 Choose style sheets. (P1) C Under View Menu, Use Style Sheet -- allows one user style sheet to be applied at a time Guideline 5. Ensure user control of user interface behavior. Checkpoint ...
...Do not support all Active Accessibility features for programmatic operation (put_accName, put_accValue not yet supported) 6.5 Programmatic alert of changes. (P1) G Uses Active Accessibility to generate change events to assistive technology 6.6 Conventional keyboard APIs. (P1) C Uses standard keyboard API, works with a number of assistive technologies 6.7 API
character encodings. (P1) ? We use 16 bit strings, not sure about UTF-16 6.8 DOM CSS access. (P2) G The DOM is available in-process, but not via an out-of-process (COM) interface. Out-of-process access is needed for it to be truly useful for assistive technology 6.9 Timely access. (P2) NR Too vague to measure. Rating Scale C: Complete Implem...
...And 3 more matches
NetUtil.jsm
e module into your JavaScript scope: Components.utils.import("resource://gre/modules/NetUtil.jsm"); Once you've imported the module, you can then use its methods. Method overview nsIAsyncStreamCopier asyncCopy(nsIInputStream aSource, nsIOutputStream aSink, [optional] aCallback) void asyncFetch(aSource, aCallback) nsIChannel newChannel(aWhatToLoad, [optional] aOrigin
Charset, [optional] nsIURI aBaseURI) nsIURI newURI(aTarget, [optional] aOrigin
Charset, [optional] nsIURI aBaseURI) String readInputStreamToString(aInputStream, aCount, aOptions) Attributes Attribute Type Description ioService nsIIOService Returns a reference to nsIIOService. Methods asyncCopy() The asyncCopy() method performs a simple as...
... return; } // Consume the input stream. }); Remarks Note: If you specify an nsIChannel as the input source, and its notification callbacks have already been set, callers are responsible for implementing nsIBadCertListener and nsISSLErrorListener. newChannel() Creates a new channel for the specified URI string, nsIURI, or nsIFile. nsIChannel newChannel( aWhatToLoad, [optional] aOrigin
Charset, [optional] aBaseURI ); Parameters Return value An nsIChannel allowing access to the specified data source. aWhatToLoad A string specifying a URI, or an nsIURI or nsIFile object. The returned method will allow access to the specified data. aOrigin
Charset The optional
character set to use when interpreting aWhatToLoad as a string; this is ignored if aWhatToLoad is not a string. Defa...
...e URI for the spec, specified as an nsIURI. Only used if aWhatToLoad is a string. newURI() The newURI() method creates a new nsIURI. This method wraps the nsIIOService.newURI(). Note: Starting in Gecko 2, this method supports specifying an nsIFile as the target of the URI. In previous versions of Gecko, you must use a string to specify the URI. nsIURI newURI( aTarget, [optional] aOrigin
Charset, [optional] aBaseURI ); Parameters aTarget Specifies the target of the URI as either a URI string or (starting in Gecko 2) as an nsIFile. aOrigin
Charset The optional
character set for the URI. Defaults to UTF-8 if not provided. aBaseURI The base URI for the spec, specified as an nsIURI. Return value Returns the nsIURI object representing the specified target. Exceptions thrown ...
...And 3 more matches
Creating localizable web applications
ure" category. You could easily use list($category, $tab, $page) = explode('/', $path); to get this information directly from the URL. After that, it is tempting to use the $category or $tab variables in the interface. However, this is problematic for localization. You probably don't want to localize the URLs to keep them uniform across locales as well as to avoid issues with non-Latin and/or RTL
characters. So in order to display a localized label of a category or a tab, you should create a mapping between the non-localizable English names used in the URLs and the localizable English strings used in the interface. Consider the following example: Snippet 1. Good: $tab_labels = array( "popular" => _('Popular'), "recent" => _('Recent'), "all" => _('Al...
...<div class="tut_left"><?printf("<b>« <a href=\"%s\">" . _("Back to Step 1") . "</a></b>", $locale_conf->url('/demo_create'));?></div> <div class="tut_right"><?printf("<b><a href=\"%s\">" . _("Continue to Step 3") . "</a> »</b>", $locale_conf->url('/demo_create_3'));?></div> Using « and » should be OK here for RTL languages (they are flipped correctly if there are no Latin
characters next to them, which there aren't any), so let's leave it as it is. In general though, we should consider implementing such decorations as CSS images (background-image or ::after's/::before's content) and then select them with "html[dir="rtl"] > ...". It a safer method. <?php if($showWearThis) { ?> $(".try-button").personasButton({ 'hasPersonas':'<span><?= _("wear this");?></span><spa...
.... Keep in mind that you should allow to localize the whole "for Firefox" part, not only the "for" preposition to which you'd concatenate the "Firefox" part. That's because some languages might require changing the word order, and others might require putting the word Firefox in the correct grammatical case. Image 4. Bad: Image 5 & Snippet 1. ...
...And 3 more matches
Fonts for Mozilla 2.0's MathML engine
ath fonts (STIX, Asana or MathJax fonts) from your package manager or get them from this zip archive. On Android, Firefox OS and other platforms where the instructions above do not work: install the MathML-fonts add-on. This requires Gecko 15.0 (Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12) or higher. Overview Mathematical formulas make use of various symbols represented by specific Unicode
characters. Mozilla can display any of these symbols provided suitable Unicode fonts are installed. Furthermore, in accordance with the W3C CSS2 recommendation on fonts, authors can specify an ordered list of particular fonts which they prefer (using the font-family property of CSS), with the assurance that Mozilla's font engine will hunt for alternate fonts whenever their specified fonts are not foun...
...talled. Furthermore, in accordance with the W3C CSS2 recommendation on fonts, authors can specify an ordered list of particular fonts which they prefer (using the font-family property of CSS), with the assurance that Mozilla's font engine will hunt for alternate fonts whenever their specified fonts are not found on a particular user's system. If no appropriate font is ultimately found for a given
character, Mozilla will instead display a box containing the hexadecimal representation of the Unicode code point for the
character. Some mathematical operators are also drawn by using glyphs for larger variants of the
character (e.g. summation symbol) or by assembling glyphs for a few pieces of the
character (e.g braces). These variant or part glyphs do not in general have Unicode assignments, and so...
...ntaining the hexadecimal representation of the Unicode code point for the
character. Some mathematical operators are also drawn by using glyphs for larger variants of the
character (e.g. summation symbol) or by assembling glyphs for a few pieces of the
character (e.g braces). These variant or part glyphs do not in general have Unicode assignments, and so font-specific support is required for some
characters. Mozilla has general support for the common delimiters and arrows that have the necessary Unicode assignments. For other
characters, Mozilla has font-specific support. In general, if the necessary glyphs are not available on the system then Mozilla tries to stretch symbols using scale transforms, but that may result in a less pleasant rendering. To see MathML as intended, you need sufficien...
...And 3 more matches
JS::CompileOffThread
This article covers features introduced in SpiderMonkey 31 Compile a script off thread for execution. Syntax bool JS::CanCompileOffThread(JSContext *cx, const JS::ReadOnlyCompileOptions &options, size_t length); bool JS::CompileOffThread(JSContext *cx, const JS::ReadOnlyCompileOptions &options, const
char16_t *
chars, size_t length, JS::OffThreadCompileCallback callback, void *callbackData); JSScript * JS::FinishOffThreadScript(JSContext *maybecx, JSRuntime *rt, void *token); typedef void (*JS::OffThreadCompileCallback)(void *token, void *callbackData); Name Type Description cx / maybe JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In ...
...en, void *callbackData); Name Type Description cx / maybe JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. rt JSRuntime * Pointer to a JS runtime. options JS::ReadOnlyCompileOptions & Compile options. ...
...ackData); Name Type Description cx / maybe JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. rt JSRuntime * Pointer to a JS runtime. options JS::ReadOnlyCompileOptions & Compile options.
chars const
char16_t * String containing the script to compile. length size_t The length of
chars or bytes, in
characters. callback JS::OffThreadCompileCallback A callback function invoked when the compilation. callbackData / token void * Pointer to application-defined data. Description JS::CompileOffThread compiles a script,
chars for execution. The script...
...And 3 more matches
JS::SourceBufferHolder
This article covers features introduced in SpiderMonkey 31 Container class for passing in script source buffers to the JS engine. Constructor enum Ownership { NoOwnership, GiveOwnership }; JS::SourceBufferHolder(const
char16_t *data, size_t dataLength, Ownership ownership); Name Type Description data const
char16_t * Source buffer containing the script to compile. dataLength size_t The length of data, in
characters. ownership Ownership See description. Description JS::SourceBufferHolder is the container class for passing in script source buffers to the JS engine. This not only groups the buffer and length values, it also provides a way to optionally pass ownership of the buffer ...
...r js_realloc if ownership is being granted to the SourceBufferHolder. If ownership is not given to the SourceBufferHolder, then the memory must be kept alive until the JS compilation is complete. Any code calling SourceBufferHolder::take() must guarantee to keep the memory alive until JS compilation completes. ...
...oc if ownership is being granted to the SourceBufferHolder. If ownership is not given to the SourceBufferHolder, then the memory must be kept alive until the JS compilation is complete. Any code calling SourceBufferHolder::take() must guarantee to keep the memory alive until JS compilation completes. ...
...And 3 more matches
JS_ExecuteRegExp
Requires request. ...
...Requires request. ...
...Requires request. ...
...And 3 more matches
SpiderMonkey 1.8.5
f the argument. The rooting APIs (JS_AddRoot, JS_RemoveRoot, etc.) have been replaced with a family of type-safe functions (JS_AddStringRoot, JS_RemoveStringRoot, etc.) that are easier to use correctly. JS_NewDouble, JS_NewDoubleValue, and JS_NewNumberValue are gone. Instead use DOUBLE_TO_JSVAL, INT_TO_JSVAL, and UINT_TO_JSVAL, which are faster and can't fail. JS_GetStringBytes and JS_GetString
Chars are gone. There is no longer an infallible way to examine string
characters. Applications must use JS_GetString
CharsAndLength or JS_EncodeString/JS_free and check for errors. These and other changes are explained in detail below. New JavaScript language features JavaScript 1.8.5 adds support for ECMAScript Edition 5, including ES5 strict mode. For details, see New in JavaScript 1.8.5. Note tha...
...iptForPrincipalsVersion JS_EvaluateUCScriptForPrincipalsVersion JS_ExecuteRegExp JS_ExecuteRegExpNoStatics JS_ExecuteScriptVersion JS_FORGET_STRING_FLATNESS JS_FileEscapedString JS_FinishJSONParse (removed in future releases, replaced with JS_ParseJSON) JS_FlatStringEqualsAscii JS_FlattenString JS_FlushCaches JS_FreezeObject JS_GetCompartmentPrivate JS_GetEmptyString JS_GetFlatString
Chars JS_GetGCParameter JS_GetGCParameterForThread JS_GetGlobalForScopeChain JS_GetInternedString
Chars JS_GetInternedString
CharsAndLength JS_GetOwnPropertyDescriptor JS_GetPropertyAttrsGetterAndSetterById JS_GetPropertyById JS_GetPropertyByIdDefault JS_GetPropertyDefault JS_GetPropertyDescriptorById JS_GetRuntimeSecurityCallbacks JS_GetSecurityCallbacks JS_GetString
CharsAndLength JS_Get...
...GetGCParameter JS_GetGCParameterForThread JS_GetGlobalForScopeChain JS_GetInternedString
Chars JS_GetInternedString
CharsAndLength JS_GetOwnPropertyDescriptor JS_GetPropertyAttrsGetterAndSetterById JS_GetPropertyById JS_GetPropertyByIdDefault JS_GetPropertyDefault JS_GetPropertyDescriptorById JS_GetRuntimeSecurityCallbacks JS_GetSecurityCallbacks JS_GetString
CharsAndLength JS_GetString
CharsZ JS_GetString
CharsZAndLength JS_GetStringEncodingLength JS_HasPropertyById JS_InitCTypesClass JS_InternJSString JS_IsConstructing_PossiblyWithGivenThisObject JS_IsExtensible JS_IsInRequest JS_LeaveCrossCompartmentCall JS_LookupPropertyById JS_LookupPropertyWithFlagsById JS_New JS_NewCompartmentAndGlobalObject JS_NewDateObject JS_NewDateObjectMsec JS_NewFunctionById body New C++...
...And 3 more matches
SpiderMonkey 38
645416) JSID_TO_SYMBOL (bug 645416) JSPROP_DEFINE_LATE (bug 825199) JSPROP_IGNORE_ENUMERATE (bug 1037770) JSPROP_IGNORE_PERMANENT (bug 1037770) JSPROP_IGNORE_READONLY (bug 1037770) JSPROP_IGNORE_VALUE (bug 1037770) JSPROP_PROPOP_ACCESSORS (bug 1088002) JSPROP_REDEFINE_NONCONFIGURABLE (bug 1101123) JS_AddFinalizeCallback (bug 996785) JS_DefineConstIntegers (bug 1066020) JS_GetFlatString
CharAt (bug 1034627) JS_GetFunctionScript (bug 1069694) JS_GetLatin1FlatString
Chars (bug 1037869) JS_GetLatin1InternedString
Chars (bug 1037869) JS_GetLatin1String
CharsAndLength (bug 1032726) JS_GetString
CharAt (bug 1034627) JS_GetTwoByteExternalString
Chars (bug 1034627) JS_GetTwoByteFlatString
Chars (bug 1037869) JS_GetTwoByteInternedString
Chars (bug 1037869) JS_GetTwoByteString
CharsAndLength ...
...tString
CharAt (bug 1034627) JS_GetTwoByteExternalString
Chars (bug 1034627) JS_GetTwoByteFlatString
Chars (bug 1037869) JS_GetTwoByteInternedString
Chars (bug 1037869) JS_GetTwoByteString
CharsAndLength (bug 1032726) JS_NewPlainObject (bug 1125356) JS_RemoveFinalizeCallback (bug 996785) JS_SELF_HOSTED_SYM_FN (bug 1082672) JS_SYM_FN (bug 1082672) JS_SYM_FNSPEC (bug 1082672) JS_StringHasLatin1
Chars (bug 1032726) JS_StringIsFlat (bug 1037869) JS_StringToId (bug 959787) PropertyDefinitionBehavior (bug 825199) SYMBOL_TO_JSID (bug 645416) Obsolete APIs ... Deleted APIs JS::AddNamedObjectRoot (bug 1107639) JS::AddNamedScriptRoot (bug 1107639) JS::AddNamedStringRoot (bug 1107639) JS::AddNamedValueRoot (bug 1107639) JS::AddNamedValueRootRT (bug 1107639) JS::AddObjectRoot (bug 1...
...26) JS_ConvertArguments (bug 1125784) JS_ConvertArgumentsVA (bug 1125784) JS_ConvertStub (bug 1103152) JS_DefineOwnProperty (bug 1017323) JS_DeletePropertyStub (bug 1103152) JS_DoubleToInt32 (bug 1112774) JS_DoubleToUint32 (bug 1112774) JS_EnumerateStub (bug 1103152) JS_EvaluateScript (bug 1100579) JS_EvaluateUCScript (bug 1100579) JS_ExecuteScriptVersion (bug 1095660) JS_GetFlatString
Chars (bug 1037869) JS_GetFunctionCallback (bug 1103269) JS_GetInternedString
Chars (bug 1037869) JS_GetInternedString
CharsAndLength (bug 1037869) JS_GetString
CharsAndLength (bug 1037869) JS_GetString
CharsZ (bug 1037869) JS_GetString
CharsZAndLength (bug 1037869) JS_GetTypeName (bug 1037718) JS_IsAboutToBeFinalized (bug 650161) JS_LookupElement (bug 1094176) JS_LookupProperty (bug 1094176) JS...
...And 3 more matches
Using XPCOM Utilities to Make Things Easier
SUPPORTS(); } Sample::~Sample() { } NS_IMPL_ISUPPORTS1(Sample, nsISupports); NS_GENERIC_FACTORY_CONSTRUCTOR(Sample); static const nsModuleComponentInfo components[] = { { "Pretty Class Name", SAMPLE_CID, "@company.com/sample", SampleConstructor } }; NS_IMPL_NSGETMODULE(nsSampleModule, components) String Classes in XPCOM Strings are usually thought of as linear sequences of
characters. In C++, the string literal "XPCOM", for example, consists of 6 consecutive bytes, where `X' is at byte offset zero and a null
character is at byte offset 5. Other kinds of strings like "wide" strings use two bytes to represent each
character, and are often used to deal with Unicode strings. The string classes in XPCOM are not just limited to representing a null terminated sequence of
char...
...o represent each
character, and are often used to deal with Unicode strings. The string classes in XPCOM are not just limited to representing a null terminated sequence of
characters, however. They are fairly complex because they support the Gecko layout engine and other subsystems that manage large chunks of data. Additionally, in some versions of Mozilla the string classes support sequences of
characters broken up into multiple fragments (fragments which may or may not be null terminated)[nulls-in-strings]. All string classes in XPCOM derive from one of two abstract classes[other-string-classes]: nsAString and nsACString. The former handles double byte
characters, and the latter tends to be used in more general circumstances, but both of these classes define the functionality of a string. ...
...ich in many cases is an unacceptable gain (see the XPCOM string guide). For WebLock, where the string classes need to be only wrappers around already existing string data, trading advanced functionality for a much smaller footprint is the right way to go. The WebLock string classes don't need to append, concatenate, search, or do any other real work on the string data; they just need to represent
char* and other data and pass them to methods that expect an nsACString. nsEmbedString and nsEmbedCString The strings used in this tutorial are nsEmbedString and nsEmbedCString, which implement the nsAString abstract class and the nsACString abstract classes, respectively. This first example shows an nsEmbedCString being used to pass an nsACString to a method that's not expected to modify the string...
...And 3 more matches
BeginReading
<< XPCOM API Reference Summary The BeginReading function returns a const pointer to the first element of the string's internal buffer. const
char_type* BeginReading() const; Remarks The resulting
character array is not necessarily null-terminated. The length of the array is determined by the result of the Length method. ...
... << XPCOM API Reference Summary The BeginReading function returns a const pointer to the first element of the string's internal buffer. const
char_type* BeginReading() const; Remarks The resulting
character array is not necessarily null-terminated. The length of the array is determined by the result of the Length method. ...
...he BeginReading function returns a const pointer to the first element of the string's internal buffer. const
char_type* BeginReading() const; Remarks The resulting
character array is not necessarily null-terminated. The length of the array is determined by the result of the Length method. ...
...And 3 more matches
BeginReading
<< XPCOM API Reference Summary The BeginReading function returns a const pointer to the first element of the string's internal buffer. const
char_type* BeginReading() const; Remarks The resulting
character array is not necessarily null-terminated. The length of the array is determined by the result of the Length method. ...
... << XPCOM API Reference Summary The BeginReading function returns a const pointer to the first element of the string's internal buffer. const
char_type* BeginReading() const; Remarks The resulting
character array is not necessarily null-terminated. The length of the array is determined by the result of the Length method. ...
...he BeginReading function returns a const pointer to the first element of the string's internal buffer. const
char_type* BeginReading() const; Remarks The resulting
character array is not necessarily null-terminated. The length of the array is determined by the result of the Length method. ...
...And 3 more matches
nsIMessenger
Inherits from: nsISupports Implemented by: @mozilla.org/messenger;1. To create an instance, use: messenger = Components.classes["@mozilla.org/messenger;1"] .createInstance(Components.interfaces.nsIMessenger); In Thunderbird, a global nsIMessenger object is defined as messenger via the createMessenger function in mailWindow.js. ...
...pports Implemented by: @mozilla.org/messenger;1. To create an instance, use: messenger = Components.classes["@mozilla.org/messenger;1"] .createInstance(Components.interfaces.nsIMessenger); In Thunderbird, a global nsIMessenger object is defined as messenger via the createMessenger function in mailWindow.js. ...
...aunchExternalURL(in ACString aURL); boolean canUndo(); boolean canRedo(); unsigned long getUndoTransactionType(); unsigned long getRedoTransactionType(); void undo(in nsIMsgWindow msgWindow); void redo(in nsIMsgWindow msgWindow); void sendUnsentMessages(in nsIMsgIdentity aIdentity, in nsIMsgWindow aMsgWindow); void setDocument
Charset(in ACString
characterSet); void saveAs(in ACString aURI, in boolean aAsFile, in nsIMsgIdentity aIdentity, in AString aMsgFilename); void openAttachment(in ACString contentTpe, in ACString url, in ACString displayName, in ACString messageUri, in boolean isExternalAttachment); void saveAttachment(in ACString contentTpe, in ACString url, in ACString displayName, in ACSt...
...And 3 more matches
nsIMsgSearchTerm
oda-id. * value.str will be compared with nsIMsgHdr::GetProperty(hdrProperty). */ attribute ACString hdrProperty; customId /// identifier for a custom id used for this term, if any. ...
... will be compared with nsIMsgHdr::GetProperty(hdrProperty). */ attribute ACString hdrProperty; customId /// identifier for a custom id used for this term, if any. ...
... customId /// identifier for a custom id used for this term, if any. ...
...And 3 more matches
nsIZipReader
interface provides methods for reading compressed (zip) files. Inherits from: nsISupports Last changed in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) Implemented by: @mozilla.org/libjar/zip-reader;1. To create an instance, use: var zipReader = Components.classes["@mozilla.org/libjar/zip-reader;1"] .createInstance(Components.interfaces.nsIZipReader); About
character sets and code pages Note: nsIZipReader has a code page problem; that is, in the ZIP specification, filenames are supposed to use 7-bit ASCII; however, most modern filesystems use 8 bit code pages, such as UTF-8. This can mismatch
characters in the nsIZipReader API. Starting in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), the nsIZipReader API supports a limited 8 bit code p...
...ismatch
characters in the nsIZipReader API. Starting in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), the nsIZipReader API supports a limited 8 bit code page usage. All functions now pass the filenames (both in and out) as AUTF8String. So you can now read and extract what you wrote with nsIZipWriter. If you show filenames from the findEntries() result in the user interface, the
character matching is only fine on UTF-8 ZIP archives. Method overview void close(); void extract(in AUTF8String zipEntry, in nsIFile outFile); void extract(in string zipEntry, in nsIFile outFile); Obsolete since Gecko 10 nsIUTF8StringEnumerator findEntries(in AUTF8String aPattern); nsIUTF8StringEnumerator findEntries(in string aPattern); Obsolete since Gecko 1...
...ndEntries() Returns a string enumerator containing the matching entry names. nsIUTF8StringEnumerator findEntries( in AUTF8String aPattern ); Parameters aPattern A regular expression used to find matching entries in the zip file. Set this parameter to null (javascript) or EmptyCString() (c++) to get all entries; otherwise, use the following syntax: * matches anything. ...
...And 3 more matches
AbstractRange - Web APIs
family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">AbstractRange</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties collapsed Read only A Boolean value which is true if the range is collapsed. A collapsed range is one whose start position and end position are the same, resulting in a zero-
character-long range. endContainer Read only The DOM Node in which the end of the range, as specified by the endOffset property, is located. endOffset Read only An integer value indicating the offset, in
characters, from the beginning of the node's contents to the beginning of the range represented by the range object. This value must be less than the length of the endContainer node. startConta...
...This value must be less than the length of the node indicated in startContainer. Methods The AbstractRange interface offers no methods. ...
...ents to the beginning of the range represented by the range object. This value must be less than the length of the endContainer node. startContainer Read only The DOM Node in which the beginning of the range, as specified by the startOffset property, is located. startOffset Read only An integer value indicating the offset, in
characters, from the beginning of the node's contents to the last
character of the contents referred to by the range object. This value must be less than the length of the node indicated in startContainer. Methods The AbstractRange interface offers no methods. Usage notes Range types All ranges of content within a document are described using instances of interfaces based on AbstractRange. There are two such interfaces: Range The Range interface has been ...
...And 3 more matches
Element.querySelectorAll() - Web APIs
uerySelectorAll(selectors); Parameters selectors A DOMString containing one or more selectors to match against. This string must be a valid CSS selector string; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas. Note:
Characters which are not part of standard CSS syntax must be escaped using a backslash
character. Since JavaScript also uses backspace escaping, special care must be taken when writing string literals using these
characters. See Escaping special
characters for more information. Return value A non-live NodeList containing one Element object for each descendant node that matches at least one of the s...
...taining one Element object for each descendant node that matches at least one of the specified selectors. Note: If the specified selectors include a CSS pseudo-element, the returned list is always empty. Exceptions SyntaxError The syntax of the specified selectors string is not valid. ...
... that matches at least one of the specified selectors. Note: If the specified selectors include a CSS pseudo-element, the returned list is always empty. Exceptions SyntaxError The syntax of the specified selectors string is not valid. ...
...And 3 more matches
KeyboardEvent - Web APIs
s KeyboardEvent.initKeyEvent() Initializes a KeyboardEvent object. This was implemented only by Firefox, and is no longer supported even there; instead, you should use the KeyboardEvent() constructor. KeyboardEvent.initKeyboardEvent() Initializes a KeyboardEvent object. This is now deprecated. You should instead use the KeyboardEvent() constructor. ...
...ardEvent object. This was implemented only by Firefox, and is no longer supported even there; instead, you should use the KeyboardEvent() constructor. KeyboardEvent.initKeyboardEvent() Initializes a KeyboardEvent object. This is now deprecated. You should instead use the KeyboardEvent() constructor. Obsolete properties KeyboardEvent.
char Read only Returns a DOMString representing the
character value of the key. ...
...onger supported even there; instead, you should use the KeyboardEvent() constructor. KeyboardEvent.initKeyboardEvent() Initializes a KeyboardEvent object. This is now deprecated. You should instead use the KeyboardEvent() constructor. Obsolete properties KeyboardEvent.
char Read only Returns a DOMString representing the
character value of the key. If the key corresponds to a printable
character, this value is a non-empty Unicode string containing that
character. ...
...And 3 more matches
OpenType font features guide - CSS: Cascading Style Sheets
These are all referred to as OpenType Features, and are made available to use on the web via specific properties and a low-level control property -- font-feature-settings. This article provides you with all you need to know about using OpenType font features in CSS. ...
...ternates (font-variant-alternates) Fonts can supply a number of different alternatives for various glyphs, such as different styles of lower case 'a' or more or less elaborate swashes in a script typeface. This property can activate an entire set of alternates or just a specific one, depending on the values supplied.The example below is showing several different aspects of working with alternate
characters. Fonts with alternate glyphs can make them available across the board or individually in separate stylistic sets, or even individual
characters. In this example you can see two different typefaces, and the introduction of the @font-feature-values at-rule. This is used to define shortcuts or named options that can be defined per font family. This way you can create a named option that applie...
...s. In this example you can see two different typefaces, and the introduction of the @font-feature-values at-rule. This is used to define shortcuts or named options that can be defined per font family. This way you can create a named option that applies to only a single font, or one that is shared and can be applied more generally In this case, @stylistic(alternates) will show all the alternate
characters for either font). Applying this to just the word 'My' alters the way the 'M' renders, and applying @styleset(alt-a) only changes the lower case 'a'. Try changing the line font-variant-alternates: styleset(alt-a); to font-variant-alternates: styleset(alt-g); and notice that the lower case 'a' reverts to its regular form and the lower case 'g' changes instead. More about alternates ...
...And 3 more matches
font-variant-alternates - CSS: Cascading Style Sheets
trols the usage of alternate glyphs. These alternate glyphs may be referenced by alternative names defined in @font-feature-values. ...
...This property allows those human-readable names (defined in @font-feature-values) in the stylesheet. Syntax This property may take one of two forms: either the keyword normal or one or more of the other keywords and functions listed below, space-separated, in any order. Values normal This keyw...
...eyword normal or one or more of the other keywords and functions listed below, space-separated, in any order. Values normal This keyword deactivates alternate glyphs. historical-forms This keyword enables historical forms -- glyphs that were common in the past but not today. It corresponds to the OpenType value hist. ...
...And 3 more matches
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
when a website dynamically 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. ...
... 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. ...
...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 arranged left-to-right (LTR) and sequences of
characters that are arranged 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
characters (such as spaces and some punctuation) are treated as neutral and are assigned directionality based on that of their surrounding
characters. Usually, the bidirectional algorithm will do the right thing without the author having to provide a...
...And 3 more matches
<colgroup> - HTML: Hypertext Markup Language
only. align This enumerated attribute specifies how horizontal alignment of each column cell content will be handled. Possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell
char, aligning the textual content on a special
character with a minimal offset, defined by the
char and
charoff attributes. If this attribute is not set, the left value is assumed. The descendant <col> elements may override this value using their own align attribute. Note: Do not try to set the text-align property on a selector giving a <colgroup> element. Because <td> elements are not de...
...f the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. bgcolor The background color of the table. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. One of the predefined color kewords can also be used. To achieve a similar effect, use the CSS background-color property. ...
...quate CSS attribute selectors like [colspan=n], though this is not trivial. bgcolor The background color of the table. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. One of the predefined color kewords can also be used. To achieve a similar effect, use the CSS background-color property.
char This attribute specifies the alignment of the content in a column group to a
character. ...
...And 3 more matches
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
lated elements, like <base>, <link>, <script>, <style> or <title>. Content categories Metadata content. If the itemprop attribute is present: flow content, phrasing content. Permitted content None, it is an empty element. Tag omission As it is a void element, the start tag must be present and the end tag must not be present. Permitted parents <meta
charset>, <meta http-equiv>: a <head> element. If the http-equiv is not an encoding declaration, it can also be inside a <noscript> element, itself inside a <head> element. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLMetaElement The type of metadata provided by the meta element can be one of the following:...
...interface HTMLMetaElement The type of metadata provided by the meta element can be one of the following: If the name attribute is set, the meta element provides document-level metadata, applying to the whole page. If the http-equiv attribute is set, the meta element is a pragma directive, providing information equivalent to what can be given by a similarly-named HTTP header. If the
charset attribute is set, the meta element is a
charset declaration, giving the
character encoding in which the document is encoded. If the itemprop attribute is set, the meta element provides user-defined metadata. Attributes This element includes the global attributes. Note: the attribute name has a specific meaning for the <meta> element, and the itemprop attribute must not be set on the same...
...If the attribute is present, its value must be an ASCII case-insensitive match for the string "utf-8". content This attribute contains the value for the http-equiv or name attribute, depending on which is used. http-equiv Defines a pragma directive. ...
...And 3 more matches
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
TML4Obsolete since HTML5 This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell
char, aligning the textual content on a special
character with a minimal offset, defined by the
char and
charoff attributes Unimplemented (see bug 2212). If this attribute is not set, the left value is assumed. Note: Do not use this attribute as it is obsolete (not supported) in the latest standard. To achieve the same effect as the left, center, right or justify values, use the CSS text-al...
... bgcolor This attribute defines the background color of each cell of the column. It is one of the 6-digit hexadecimal code as defined in sRGB, prefixed by a '#'. ...
...ff attributes Unimplemented (see bug 2212). If this attribute is not set, the left value is assumed. Note: Do not use this attribute as it is obsolete (not supported) in the latest standard. To achieve the same effect as the left, center, right or justify values, use the CSS text-align property on it. To achieve the same effect as the
char value, in CSS3, you can use the value of the
char as the value of the text-align property Unimplemented. bgcolor This attribute defines the background color of each cell of the column. It is one of the 6-digit hexadecimal code as defined in sRGB, prefixed by a '#'. One of the sixteen predefined color strings may be used: black = "#000000" green = "#008000" silver = "#C0C0C0" lime ...
...And 3 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
Just try parsing the string "10.2abc" with each method by yourself in the console and you'll understand the differences better. Strings Strings in JavaScript are sequences of Unicod...
...NaN values using the built-in isFinite() function: isFinite(1 / 0); // false isFinite(-Infinity); // false isFinite(NaN); // false The parseInt() and parseFloat() functions parse a string until they reach a
character that isn't valid for the specified number format, then return the number parsed up to that point. However the "+" operator simply converts the string to NaN if there is an invalid
character contained within it. Just try parsing the string "10.2abc" with each method by yourself in the console and you'll understand the differences better. Strings Strings in JavaScript are sequences of Unicode
characters. This should be welcome news to anyone who has had to deal with internationalization. More accurately, they are sequences of UTF-16 code units; each code unit is represented by ...
...t try parsing the string "10.2abc" with each method by yourself in the console and you'll understand the differences better. Strings Strings in JavaScript are sequences of Unicode
characters. This should be welcome news to anyone who has had to deal with internationalization. More accurately, they are sequences of UTF-16 code units; each code unit is represented by a 16-bit number. Each Unicode
character is represented by either 1 or 2 code units. If you want to represent a single
character, you just use a string consisting of that single
character. To find the length of a string (in code units), access its length property: 'hello'.length; // 5 There's our first brush with JavaScript objects! Did we mention that you can use strings like objects too? They have methods as well that allow ...
...And 3 more matches
Unicode property escapes - JavaScript
Unicode property escapes Regular Expressions allows for matching
characters based on their Unicode properties. A
character is described by several properties which are either binary ("boolean-like") or non-binary. For instance, unicode property escapes can be used to match emojis, punctuations, letters (even letters from specific languages or scripts), etc. Note: For Unicode property escapes to work, a regular expression must use the u flag which indicates a string must be considered as a series of Unicode code points. See also RegExp.prototype.unicode. Note: Some Unicode properties encompasses much more
characters than some
character classes (such as \w which matches only latin letters, a to z) but the latter is better supported among browsers (as of January 2020). Syntax The follo...
...imal_Number). For most values, the UnicodePropertyName part and equals sign may be omitted. If a UnicodePropertyName is specified, the value must correspond to the property type given. Note: As there are many properties and values available, we will not describe them exhaustively here but rather provide various examples Rationale Before ES2018 there was no performance-efficient way to match
characters from different sets based on scripts (like Macedonian, Greek, Georgian etc.) or propertyName (like Emoji etc) in JavaScript. Check out tc39 Proposal on Unicode Property Escapes for more info. Examples General categories General categories are used to classify Unicode
characters and subcategories are available to define a more precise categorization. It is possible to use both short or lo...
...es) story.match(/\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}/gu); Scripts and script extensions Some languages use different scripts for their writing system. For instance, English and Spanish are written using the Latin script while Arabic and Russian are written with other scripts (respectively Arabic and Cyrillic). The Script and Script_Extensions Unicode properties allow regular expression to match
characters according to the script they are mainly used with (Script) or according to the set of scripts they belong to (Script_Extensions). For example, A belongs to the Latin script and ? to the Greek script. let mixed
Characters = "a??"; // Using the canonical "long" name of the script mixed
Characters.match(/\p{Script=Latin}/u); // a // Using a short alias for the script mixed
Characters.match(/\...
...And 3 more matches
JSON.stringify() - JavaScript
llowlist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string. space Optional A String or Number object that's used to insert white space into the output JSON string for readability purposes. If this is a Number, it indicates the number of space
characters to use as white space; this number is capped at 10 (if it is greater, the value is just 10). Values less than 1 indicate that no space should be used. If this is a String, the string (or the first 10
characters of the string, if it's longer than that) is used as white space. If this parameter is not provided (or is null), no white space is used. Return value A JSON string representin...
...e names of the properties in the object that should be included in the resulting JSON string. JSON.stringify(foo, ['week', 'month']); // '{"week":45,"month":7}', only keep "week" and "month" properties The space argument The space argument may be used to control spacing in the final string. ...
...oo, ['week', 'month']); // '{"week":45,"month":7}', only keep "week" and "month" properties The space argument The space argument may be used to control spacing in the final string. If it is a number, successive levels in the stringification will each be indented by this many space
characters (up to 10). If it is a string, successive levels will be indented by this string (or the first ten
characters of it). ...
...And 3 more matches
JSON - JavaScript
DecimalNumber . Digits or DecimalNumber . ...
...its or DecimalNumber . ...
...r DecimalNumber . ...
...And 3 more matches
String.prototype.substring() - JavaScript
the string between the start and end indexes, or to the end 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. ...
...or 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 str.substring(indexStart[, indexEnd]) Parameters indexStart The index of the first
character to include in the returned substring. indexEnd Optional The index of the first
character to exclude from the returned substring. Return value A new string containing the specified part of the given string. Description substring() extracts
characters from indexStart up to but not including indexEnd. In particular: If indexEnd is omitted, substring() extracts
characters to the end of the string. If indexStart is equal to indexEnd, substring() returns an empty string. If ...
...art is greater than indexEnd, then the effect of substring() is as if the two arguments were swapped; See example below. Any argument value that is less than 0 or greater than stringName.length is treated as if it were 0 and stringName.length, respectively. Any argument value that is NaN is treated as if it were 0. ...
...And 3 more matches
translate - XPath
Returns The translated string. ...
... Returns The translated string. ...
... Returns The translated string. ...
...And 3 more matches
io/text-streams - Archive of obsolete content
If not specified, "UTF-8"...
...closed) { TextWriter.write(text); TextWriter.close(); } } Globals Constructors TextReader(inputStream,
charset) Creates a buffered input stream that reads text from a backing stream using a given text encoding. You can also create TextReader objects using io/file's open() function. Parameters inputStream : stream The backing stream, an nsIInputStream. It must already be opened.
charset : string inputStream is expected to be in the
character encoding named by this value. If not specified, "UTF-8" is assumed. See nsI
CharsetConverterManager.idl for documentation on how to determine other valid values for this. TextWriter(outputStream,
charset) Creates a buffered output stream that writes text to a backing stream using a given text encoding. You can also create TextWriter ob...
...If not specified, "UTF-8" is assumed. See nsI
CharsetConverterManager.idl for documentation on how to determine other valid values for this. ...
...And 2 more matches
JavaScript Daemons Management - Archive of obsolete content
t in function of a future date. The date argument can be a Date object, a string expressing the date in GMTString format, or a number expressing the number of milliseconds since January 1, 1970, 00:00:00 UTC. Only the length property will be modified. ...
...d');">two reversals</button> <button onclick="oRecompose.makeLoop();alert('changed');">makeLoop</button> <button onclick="oRecompose.unmakeLoop();alert('changed');">unmakeLoop</button> <button onclick="oRecompose.close();">close</button> <button onclick="oRecompose.reclose();">reclose</button><br /> frame rate: <input type="text" id="vello" value="33" style="width: 40px;" onkeypress="return event.
charCode===0||/\d/.test(String.from
CharCode(event.
charCode));" onkeyup="if(isFinite(this.value)&&Number(this.value)>0){oRecompose.setRate(this.value);}" /></p> </body> </html> Example #2: A practical instantiation - Daemon.buildAround() <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" /> <title>Daemon.buildAround(…)</title> <script type="text...
...lert('changed');">two reversals</button> <button onclick="oUnhide.makeLoop();alert('changed');">makeLoop</button> <button onclick="oUnhide.unmakeLoop();alert('changed');">unmakeLoop</button> <button onclick="oUnhide.close();">close</button> <button onclick="oUnhide.reclose();">reclose</button><br /> frame rate: <input type="text" id="vello" value="33" style="width: 40px;" onkeypress="return event.
charCode===0||/\d/.test(String.from
CharCode(event.
charCode));" onkeyup="if(isFinite(this.value)&&Number(this.value)>0){oUnhide.setRate(this.value);}" /></p> </body> </html> Example #3: A safe (without setInterval) instantiation - new Daemon.safe() <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" /> <title>new Daemon.safe(…)</title> <script ty...
...And 2 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
indow. window.openDialog('another.xul', '_blank','chrome,all,dialog=no'); Listing 1: Opening a window without the Firefox GUI XUL as an XML application Listing 2 shows an example of a GUI definition file marked up in XUL (a "XUL document"). The root element in XUL is generally the "window" element. The namespace URI is : http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul If the
character encoding is UTF-8, both the encoding specifier and the XML declaration can be omitted. But for the samples in this chapter, please include them. Because a XUL document is also an XML document, it can contain XHTML, SVG, MathML, and other elements; if you use external entity references, the XML document's contents are modularized; combined with other XML-related technologies, such as DOM, X...
...w menu in Firefox, with items to show or hide the toolbar and sidebar. When one has been checked, then the checked="true" attribute is set. radio button Assigning type="radio" to multiple menuitem elements and setting them to have the same name attribute groups them so that selecting one deselects all the others, much like radio buttons in HTML. For an example of this kind of menu item, see the
Character Encoding submenu of the View menu in Firefox. The selected radio button has the selected="true" attribute set. Contextual menus The context attribute is used to display a contextual menu or shortcut menu, that is, a custom menu that will appear when right-clicking on an element. Earlier we placed the menupopup child element inside a menu element; here, we use it outside the menu element. ...
...t. In HTML, there are two separate elements--input for one line of text, and textarea for multiple lines. But both these functions are handled by textbox as shown in Listing 16, which produces output as shown in Figure 13. The textbox element uses the value attribute to set its default content; content entered by the user also can be captured using the value attribute. To set a maximum length in
characters, declare the maxlength attribute with a positive integer value. Setting type="password" will turn the textbox into a special password-entry field, in which
characters are hidden as they're typed. Every
character entered into a textbox generates an input event. If you use the oninput event handler, you can implement commands that reflect user input in real time. <vbox align="start"> <tex...
...And 2 more matches
URIs and URLs - Archive of obsolete content
mapping at any particular instance in time. Thus, a resource can remain constant even when its content---the entities to which it currently corresponds---changes over time, provided that the conceptual mapping is not changed in the process. Identifier An identifier is an object that can act as a reference to something that has identity. In the case of URI, the object is a sequence of
characters with a restricted syntax. A URI can be further classified as a locator, a name, or both. The term "Uniform Resource Locator" (URL) refers to the subset of URI that identify resources via a representation of their primary access mechanism (e.g., their network "location"), rather than identifying the resource by name or by some other attribute(s) of that resource. ... The URI scheme define...
... For performance reasons the complete spec is stored in escaped form in the nsStandardURL object with pointers (position and length) to each basic segment and for the more global segments like path and prehost for example. Necko provides pre written urlparsers for schemes based on hierachical naming systems. Escaping To be able to parse an URL safely it is sometimes necessary to "escape" certain
characters, to hide them from the parser. An escaped
character is encoded as a
character triplet, consisting of the percent
character "%" followed by the two hexadecimal digits representing the octet code. For example, "%20" is the escaped encoding for the US-ASCII space
character. Another quote from RFC 2396: A URI is always in an "escaped" form, since escaping or unescaping a completed URI might c...
...enting the octet code. For example, "%20" is the escaped encoding for the US-ASCII space
character. Another quote from RFC 2396: A URI is always in an "escaped" form, since escaping or unescaping a completed URI might change its semantics. Normally, the only time escape encodings can safely be made is when the URI is being created from its component parts; each component may have its own set of
characters that are reserved, so only the mechanism responsible for generating or interpreting that component can determine whether or not escaping a
character will change its semantics. Likewise, a URI must be separated into its components before the escaped
characters within those components can be safely decoded. This implies that the segments of urls are escaped differently. This is done by NS_Esc...
...And 2 more matches
browser - Archive of obsolete content
cts to change the displayed document. ...
...ent. contentWindow Type: TODO Use the contentWindow.wrappedJSObject to obtain a DOM(html) window object currentURI Type: nsIURI This read-only property contains the currently loaded URL. To change the URL, use the loadURI method. docShell Type: nsIDocShell This read-only property contains the nsIDocShell object for the document. document
CharsetInfo Obsolete since Gecko 12.0 Type: nsIDocument
CharsetInfo This read-only property contains the nsIDocument
CharsetInfo object for the document which is used to handle which
character set should be used to display the document. The properties of the nsIDocument
CharsetInfo object were merged into the docshell in Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9). ...
...o the page in the history with the given index. Use a positive number to go forward and a negative number to go back. NOTE: This is the XUL method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js. ...
...And 2 more matches
NP_GetMIMEDescription - Archive of obsolete content
file. Each MIME type description should be separated by a semicolon (;). Each MIME type description contains the MIME Type, an extensions list and a short description. One MIME type // example inside http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/plugin.cpp #define MIME_TYPE_DESCRIPTION "application/basic-plugin:bsp:Basic Example Plug-in for Mozilla" const
char* NP_GetMIMEDescription(void) { return(MIME_TYPES_DESCRIPTION); } Two MIME types const
char* NP_GetMIMEDescription(void) { return "application/basic-example-plugin:xmp1:Example 1;application/basic-example2-plugin:xmp2, xm2p:Example 2"; } Gnome Integration If you use GNOME VFS (gnome-vfs-2.0), you can get the MIME type description with a function. #include <libgnomevfs/gnome-vfs-mime-handl...
...MIMEDescription(void) { return "application/basic-example-plugin:xmp1:Example 1;application/basic-example2-plugin:xmp2, xm2p:Example 2"; } Gnome Integration If you use GNOME VFS (gnome-vfs-2.0), you can get the MIME type description with a function. ...
...n/basic-example-plugin:xmp1:Example 1;application/basic-example2-plugin:xmp2, xm2p:Example 2"; } Gnome Integration If you use GNOME VFS (gnome-vfs-2.0), you can get the MIME type description with a function. ...
...And 2 more matches
How can we design for all types of users? - Learn web development
is proportional to the root element's font size and is expressed as portions of 1, like em. Suppose we wanted a base font size of 16px and an h1 (main heading) at the equivalent of 32px, yet if within the h1 we find a span with the subheading class, it too must be rendered at the default font size (usually 16px). ...
... web, but here's the story. Back when we had newspapers, printers realized that the reader's eyes would have trouble going from one line to the next if the lines were too long. The solution? Columns. Of course the problem doesn't go away when we switch to the Web. The reader's eyes act like a shuttle going from line to line. ...
...ines were too long. The solution? Columns. Of course the problem doesn't go away when we switch to the Web. The reader's eyes act like a shuttle going from line to line. To make it easier on people's eyes, limit line width to around 60 or 70
characters. To achieve this, you can specify a size for your text's container. Let's consider this HTML: <!DOCTYPE html> <html lang="en"> <head> <meta
charset="UTF-8"> <title>Font size experiment</title> </head> <body> <div class="container"> <h1>This is our main heading <span class="subheading">This is our subheading</span> </h1> <p>[lengthly text that spans many lines]</p> </div> </body> </html> We have a div with class container. We can style the div either to set its width (using the width property) or its maximum wid...
...And 2 more matches
HTML text fundamentals - Learn web development
as a heading and two paragraphs in the Output field. If you make a mistake, you can always reset it using the Reset button. If you get stuck, press the Show solution button to see the answer. Playable code <h2>Live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>Editable code</h2> <p class="a11y-label">Press Esc to move focus away from the code area (Tab inserts a tab
character).</p> <textarea id="code" class="input" style="min-height: 100px; width: 95%">My short story I am a statistician and my name is Trish. My legs are made of cardboard and I am married to a fish.</textarea> <div class="playable-buttons"> <input id="reset" type="button" value="Reset"> <input id="solution" type="button" value="Show solution"> </div> html { font-family: sans-serif; } h2...
...milk</li> <li>eggs</li> <li>bread</li> <li>hummus</li> </ul> Active learning: Marking up an unordered list Try editing the live sample below to create your very own HTML unordered list. ...
...> <li>The school is on your right, 300 meters up the road</li> </ol> Active learning: Marking up an ordered list Try editing the live sample below to create your very own HTML ordered list. ...
...And 2 more matches
Arrays - Learn web development
third item inside the random array (see previous section), we could do something like this: random[2][2]; Try making some more modifications to your array examples before moving on. Play around a bit, and see what works and what doesn't. Finding the length of an array You can find out the length of an array (how many items are in it) in exactly the same way as you find out the length (in
characters) of a string -- by using the length property. Try the following: shopping.length; // should return 5 This has other uses, but it is most commonly used to tell a loop to keep going until it has looped through all the items in an array. So for example: let sequence = [1, 1, 2, 3, 5, 8, 13]; for (let i = 0; i < sequence.length; i++) { console.log(sequence[i]); } You'll learn about loops ...
... vice versa, and add new items into arrays. Converting between strings and arrays Often you'll be presented with some raw data contained in a big long string, and you might want to separate the useful items out into a more useful form and then do things to them, like display them in a data table. To do this, we can use the split() method. In its simplest form, this takes a single parameter, the
character you want to separate the string at, and returns the substrings between the separator as items in an array. Note: Okay, this is technically a string method, not an array method, but we've put it in with arrays as it goes well here. Let's play with this, to see how it works. First, create a string in your console: let myData = 'Manchester,London,Liverpool,Birmingham,Leeds,Carlisle'; ...
...using the join() method. Try the following: let myNewString = myArray.join(','); myNewString; Another way of converting an array to a string is to use the toString() method. toString() is arguably simpler than join() as it doesn't take a parameter, but more limiting. With join() you can specify different separators, whereas toString() always uses a comma. (Try running Step 4 with a different
character than a comma.) let dogNames = ['Rocket','Flash','Bella','Slugger']; dogNames.toString(); // Rocket,Flash,Bella,Slugger Adding and removing array items We've not yet covered adding and removing array items -- let us look at this now. We'll use the myArray array we ended up with in the last section. If you've not already followed that section, create the array first in your console: le...
...And 2 more matches
Gecko info for Windows accessibility vendors
For example, "Open\tCtrl+O" ROLE_TOOLTIP XUL: <tooltip> or tooltiptext attribute ROLE_APPLICATION Default role of root object of application DHTML: role="wairole:application" accName() exposes the <title> of the current pane. Role Supported? Unique features ...
...ses the URL of the current pane. accName() exposes the <title> of the current pane. ROLE_PANE The first child of a <frame> or <iframe> accValue() exposes the URL of the current document. accName() exposes the <title> of the current pane. Sets STATE_READONLY unless it's an editable frame via designMode. ROLE_
CHART Not supported. n/a ROLE_DIALOG XUL: <dialog> DHTML: role="wairole:dialog" accName() exposes the <title> of the current dialog. ROLE_BORDER Not supported. ROLE_GROUPING HTML: <fieldset> XUL: <groupbox> DHTML: role="wairole:group" or DHTML: role="wairole:r...
...e changed, we need a real <link> widget for XUL HTML: <a> and <area> Sets STATE_LINKED if it is pointing somewhere. Sets STATE_TRAVERSED if link has been visited. Sets STATE_SELECTABLE if it is an HTML named anchor accValue() exposes the URL that is pointed to ROLE_HELPBALLOON Not supported. n/a ROLE_
CHARACTER Not supported. n/a ROLE_LIST XUL: <listbox> HTML: <select size=""> where size > 1 -- STATE_READONLY is off HTML: <ol> or <ul> -- STATE_READONLY is on DHTML: role="wairole:list" ROLE_LISTITEM HTML: <li>, <option> or <optgroup> DHTML: role="wairole:listitem" XUL: <listitem> Sets STATE_...
...And 2 more matches
Error codes returned by Mozilla APIs
This error will occur in this situation. File Errors The following table lists the errors that could occur when using files. While these errors can occur when using the file APIs, they can also occur with other components that use files. NS_ERROR_FILE_UNRECOGNIZED_PATH (0x80520001) This error occurs when an attempt is made to set a path that isn't valid for the platform. For example, if a
character in the path is not valid for a filename. In addition, this error may occur when a relative path is supplied to a method that expects an absolute path and vice versa. NS_ERROR_FILE_UNRESOLVABLE_SYMLINK (0x80520002) An attempt was made to access a symbolic link to a file or directory which does not exist. NS_ERROR_FILE_EXECUTION_FAILED (0x80520003) An attempt to launch or execute a file fa...
...80530003) 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 was created in a different document. The document.importNode method may need to be used to import the node into the document first. NS_ERROR_DOM_INVALID_
CHARACTER_ERR (0x80530005) An invalid
character was used in a tag or attribute name. NS_ERROR_DOM_NO_DATA_ALLOWED_ERR (0x80530006) NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR (0x80530007) This error can occur when an attempt is made to modify an aspect of an object that cannot be changed. NS_ERROR_DOM_NOT_FOUND_ERR (0x80530008) A node was not found. For example, an attempt was made to use the el...
...000B) An attempt was made to use an object which is no longer usable. NS_ERROR_DOM_SYNTAX_ERR (0x8053000C) An attribute value or property was set to an invalid 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 no...
...And 2 more matches
Mozilla DOM Hacking Guide
sses are detailed in Section 1.3. The fourth and last argument, _flags, is a bitvector of nsIXPCScriptable flags. The macros for those flags are defined nsDOMClassInfo.cpp. The flags give special behavior through XPConnect. See also Section 1.9. The nsDOMClassInfoData objects are created in the sClassInfoData array by explicitly initializing it. Here is the description of the structure: const
char *mName: C-style string that is passed as second argument to the macro. It is the name of the JavaScript object that will be available in the browser through the DOM. union { nsDOMClassInfoConstructorFnc mConstructorFptr; nsDOMClassInfoExternalConstructorFnc mExternalConstructorFptr; } u; This union is a pointer to a function typedef'ed: typedef nsIClassInfo* (*nsDOMClassInfoConstructorFn...
...pt object that will be available in the browser through the DOM. union { nsDOMClassInfoConstructorFnc mConstructorFptr; nsDOMClassInfoExternalConstructorFnc mExternalConstructorFptr; } u; This union is a pointer to a function typedef'ed: typedef nsIClassInfo* (*nsDOMClassInfoConstructorFnc)(nsDOMClassInfoID aID); or typedef nsIClassInfo* (*nsDOMClassInfoExternalConstructorFnc) (const
char* aName); It is initialized with the doCreate member function of the helper class passed as third argument to the macro. nsIClassInfo *mCachedClassInfo: mCachedClassInfo holds an nsIClassInfo pointer to an instance of the relevant helper class. const nsIID *mProtoChainInterface: Pointer to the IID of the first interface available to JavaScript clients. This is used in global resolve functions,...
...>GetLocation(getter_AddRefs(location)); NS_ENSURE_SUCCESS(rv, rv); // Use the DOM to get the Location object of the window object. jsval v; rv = WrapNative(cx, obj, location, NS_GET_IID(nsIDOMLocation), &v); // This XPConnect method creates a wrapper for the Location object on the // Window object. NS_ENSURE_SUCCESS(rv, rv); if (!::JS_DefineUCProperty(cx, obj, ::JS_GetString
Chars(str), ::JS_GetStringLength(str), v, nsnull, nsnull, 0)) { return NS_ERROR_FAILURE; } // This JS API call defines the "location" property on the window object, its // value being the XPConnect wrapper for the Location object. *objp = obj; return NS_OK; } This is the first step. It is required to have the getter ...
...And 2 more matches
NSS Sample Code sample4
length of the public/private key. */ #include "nss.h" #include "pk11pub.h" /* this callback is responsible for returning the password to the NSS * key database. for example purposes, this function hardcodes the password. ...
...* this callback is responsible for returning the password to the NSS * key database. for example purposes, this function hardcodes the password. ...
...he password using secure means * such as prompting an operator, or retrieving it over a secure communication * channel */
char *passwdcb(PK11SlotInfo *info, PRBool retry, void *arg); int main(int argc,
char **argv) { SECStatus rv; CERTCertificate *cert = NULL; SECKEYPublicKey *pubkey = NULL; SECKEYPrivateKey *pvtkey = NULL; int modulus_len, i, outlen;
char *buf1 = NULL;
char *buf2 = NULL; /* Initialize NSS */ PK11_SetPasswordFunc(passwdcb); rv = NSS_Init("."); if (rv != SECSuccess) { fprintf(stderr, "NSS initialization failed (err %d)\n", PR_GetError()); goto cleanup; } cert = PK11_FindCertFromNickname("TestCA", NULL); if (cert == NULL) { fprintf(stderr, "Couldn't find cert Tes...
...And 2 more matches
JSAutoByteString
SString *str); Name Type Description cx JSContext * The context in which to add the root. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * A pointer to JSString to get initial content by calling JS_EncodeString(cx, str). ...
... JSContext * The context in which to add the root. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * A pointer to JSString to get initial content by calling JS_EncodeString(cx, str). Methods Method Description void initBytes(
char *bytes) Take ownership of the given byte array.
char *encodeLatin1(JSContext *cx, JSString *str) Call JS_EncodeString and take ownership of the returned string, and return the string.
char *encodeLatin1(js::ExclusiveContext *cx, JSString *str) Call JS::LossyTwoByte
CharsToNewLatin1
CharsZ, or allocate string and copy the content of JSLinearString::latin1
Chars, and take the ownership of the string. This may fail if str is not linear. ...
...eLatin1(JSContext *cx, JSString *str) Call JS_EncodeString and take ownership of the returned string, and return the string.
char *encodeLatin1(js::ExclusiveContext *cx, JSString *str) Call JS::LossyTwoByte
CharsToNewLatin1
CharsZ, or allocate string and copy the content of JSLinearString::latin1
Chars, and take the ownership of the string. This may fail if str is not linear.
char *encodeUtf8(JSContext *cx, JS::HandleString str) Call JS_EncodeStringToUTF8 and take ownership of the returned string, and return the string. void clear() Free the owned string. ...
...And 2 more matches
JSPropertySpec
Defines a single property for an object. ...
... Defines a single property for an object. ...
... tinyid int8 Obsolete since JSAPI 31 Unique ID number for the property to aid in resolving getProperty and setProperty method calls. This value should be zero if you are not using tinyIDs (i.e. the...
...And 2 more matches
JS_FlattenString
Syntax JSFlatString * JS_FlattenString(JSContext *cx, JSString *str); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * The string to flatten. Description JS_FlattenString flattens a string str and returns a pointer to JSFlatString. To catch errors, an opaque JSFlatString type is returned. ...
...lattenString() are the same actual GC-thing so only one needs to be rooted. If a JSString is known to be flat, you can use JS_ASSERT_STRING_IS_FLAT to make a debug-checked cast. ...
...String() are the same actual GC-thing so only one needs to be rooted. If a JSString is known to be flat, you can use JS_ASSERT_STRING_IS_FLAT to make a debug-checked cast. ...
...And 2 more matches
JS_ValueToId
Convert a JS::Value to type jsid. Syntax bool JS_ValueToId(JSContext *cx, JS::HandleValue v, JS::MutableHandleId idp); bool JS_StringToId(JSContext *cx, JS::HandleString s, JS::MutableHandleId idp); // Added in SpiderMonkey 38 bool JS_IndexToId(JSContext *cx, uint32_t index, JS::MutableHandleId idp); // Added in SpiderMonkey 17 bool JS_
CharsToId(JSContext* cx, JS::TwoByte
Chars
chars, JS::MutableHandleId idp); // Added in SpiderMonkey 24 void JS::ProtoKeyToId(JSContext *cx, JSProtoKey key, JS::MutableHandleId idp); // Added in SpiderMonkey 38 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. v JS::HandleValue The JS value to convert. s ...
...d in SpiderMonkey 38 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. v JS::HandleValue The JS value to convert. s JS::HandleString The JS string to convert. index uint32_t An unsigned integer index of array to convert.
chars JS::TwoByte
Chars The string to convert. key JSProtoKey The prototype key to convert. idp JS::MutableHandleId Out parameter. On success, *idp receives the converted jsid. Description JS_ValueToId converts a specified JS::Value, v, to a jsid. If v is an integer, *idp receives an integer jsid. Otherwise, if E4X support is enabled and v is an object, *idp ...
.... Description JS_ValueToId converts a specified JS::Value, v, to a jsid. If v is an integer, *idp receives an integer jsid. Otherwise, if E4X support is enabled and v is an object, *idp receives an object jsid. Otherwise, *idp receives an interned string jsid based on the value of v. If v is not a string, it is converted to a string as if by calling JS_ValueToString. JS_StringToId and JS_
CharsToId convert a specified string to a jsid. JS_IndexToId converts a specified integer index to an integer jsid. JS::ProtoKeyToId converts a specified prototype key to a jsid. On success, JS_ValueToId stores the converted value in *idp and returns true. Otherwise it returns false. The inverse of JS_ValueToId is JS_IdToValue. MXR ID Search for JS_ValueToId See Also MXR ID Search for JS_IdTo...
...And 2 more matches
Mork
a table, nor need they be in only one table. Values are merely an opaque sequence of bytes, so their actual content is dependent on the mork consumer. Except when parsing values, whitespace ('\b', '\t', '\r', '\n', '\f', ' ', and '\x7f'), line continuations ('\\' followed by a newline), and comments (C++ or C style) can be ignored. In practice, only C++-style comments, and the standard whitespace
characters ('\t', ' ', '\r', '\n') appear to be used. The grammar for mork is as follows: file = header ( dictionary | table | group | row )* header = '// <!-- <mdb:mork:z v="1.4"/> -->' dictionary = '<' ( metaDictionary | alias )* '>' table = '{' '-'? mid ( metaTable | row | '-' | rowReference)* '}' row = '[' '-'? mid ( cell | metaRow | '-' )* ']' group = '@$${' hex '{@' (dictionary|table|row)* ('@$...
...It is structured as a comment so it can be safely ignored by the parser. The header is: // <!-- <mdb:mork:z v="1.4"/> --> This file is therefore version 1.4 of the Zany Mork format for the Message Database. Versions 1.0-1.3 were never used in any publicly-available so...
...s (changesets). Dictionaries, tables, and rows all have corresponding metastructures. Meta-dictionaries are in practice only used to change the scope of alias definitions (the '(a=c)' that you can see in files). Meta-tables are used to establish some facts about the table as well as the default row scope. Meta-rows do not appear to be used at all, although the parser seems to consider setting the
charset, row scope, and atom scope. Some notes on further terminology: When referring to cells or aliases, the first component is the key and the second component is the value. Expanding refers to taking a '^' hex buffer and replacing it with the alias value for the hex key (explained below). A mid has two components: the ID itself, to the left of the colon, and the scope, to the right of the colon.
...And 2 more matches
IAccessibleHypertext
nterface is the main interface to expose hyperlinks in a document, typically a text document, that are used to reference other documents. A typical implementation is to implement this interface on the smallest text object such as a paragraph of text. Method overview [propget] HRESULT hyperlink([in] long index, [out] IAccessibleHyperlink hyperlink ); [propget] HRESULT hyperlinkIndex([in] long
charIndex, [out] long hyperlinkIndex ); [propget] HRESULT nHyperlinks([out] long hyperlinkCount ); Methods hyperlink() Returns the specified link. The returned IAccessibleHyperlink object encapsulates the hyperlink and provides several kinds of information describing it. [propget] HRESULT hyperlink( [in] long index, [out] IAccessibleHyperlink hyperlink ); Parameters index This 0 based index...
...rlink to return. hyperlink If the given index is valid, that is it lies in the interval from 0 to the number of links minus one, a reference to the specified hyperlink object is returned. If the index is invalid then a null pointer is returned. Return value E_INVALIDARG if bad [in] passed, [out] value is null. S_OK. ...
...s it lies in the interval from 0 to the number of links minus one, a reference to the specified hyperlink object is returned. If the index is invalid then a null pointer is returned. Return value E_INVALIDARG if bad [in] passed, [out] value is null. S_OK. hyperlinkIndex() Returns the index of the hyperlink that is associated with this
character index. This is the case when a link spans the given
character index. [propget] HRESULT hyperlinkIndex( [in] long
charIndex, [out] long hyperlinkIndex ); Parameters
charIndex A 0 based index of the
character for which to return the link index. If IAccessibleText is used to represent the text containing the link, then the
character index is only valid if it is greater than or equal to zero and lower than the number of
characters in the text. hyperl...
...And 2 more matches
nsIAnnotationService
e: Use of value "1" is omitted due to it's temporary use as EXPIRE_NEVER in bug 319455. Methods setPageAnnotation() This method sets an annotation for given URI, overwriting any previous annotation with the same URL/name. IT IS YOUR JOB TO NAMESPACE YOUR ANNOTATION NAMES. Use the form "namespace/value", so your name would be like "bills_extension/page_state" or "history/thumbnail". Do not use
characters that are not valid in URLs such as spaces, ":", commas, or most other symbols. You should stick to ASCII letters and numbers plus "_", "-", and "/". The annotation "favicon" is special. Favicons are stored in the favicon service, but are special cased in the protocol handler so they look like annotations. Do not set favicons using this service, it will not work. Binary annotations should ...
...EVER annotation. This will ensure the annotation exists until the item is removed by the user. setItemAnnotation() This method sets an annotation for given item, overwriting any previous annotation with the same URL/name. IT IS YOUR JOB TO NAMESPACE YOUR ANNOTATION NAMES. Use the form "namespace/value", so your name would be like "bills_extension/page_state" or "history/thumbnail". Do not use
characters that are not valid in URLs such as spaces, ":", commas, or most other symbols. You should stick to ASCII letters and numbers plus "_", "-", and "/". The annotation "favicon" is special. Favicons are stored in the favicon service, but are special cased in the protocol handler so they look like annotations. Do not set favicons using this service, it will not work. Binary annotations should ...
...OTATIONS WILL GET DELETED WHEN THE BOOKMARK IS REMOVED. setPageAnnotationString() This method sets an annotation for given URI by taking a String as input value, overwriting any previous annotation with the same URL/name. IT IS YOUR JOB TO NAMESPACE YOUR ANNOTATION NAMES. Use the form "namespace/value", so your name would be like "bills_extension/page_state" or "history/thumbnail". Do not use
characters that are not valid in URLs such as spaces, ":", commas, or most other symbols. You should stick to ASCII letters and numbers plus "_", "-", and "/". The annotation "favicon" is special. Favicons are stored in the favicon service, but are special cased in the protocol handler so they look like annotations. Do not set favicons using this service, it will not work. Binary annotations should ...
...And 2 more matches
nsIConverterOutputStream
xpcom/io/nsIConverterOutputStream.idlScriptable This interface allows writing strings to a stream, doing automatic
character encoding conversion. 1.0 66 Introduced Gecko 1.8 Inherits from: nsIUni
charOutputStream Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Implemented by: @mozilla.org/intl/converter-output-stream;1. To create an instance, use: var converterOutputStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .createInstance(Components.interfaces.nsIConverterOutputStream); Method overview void init(in nsIOutputStream aOutStream, in string a
Charset, in unsigned long aBufferSize, in PRUni
char aReplacement
Character); Methods init() Initialize this stream. Must be called bef...
...A null
charset will be interpreted as UTF-8. aBufferSize How many bytes to buffer. ...
...aBufferSize How many bytes to buffer. A value of 0 means that no bytes will be buffered. ...
...And 2 more matches
nsICryptoHash
This example, while simple, shows most of the functionality of the interface. The first thing to note is that ...
...This example, while simple, shows most of the functionality of the interface. The first thing to note is that when you call the init() met...
...ire file const PR_UINT32_MAX = 0xffffffff; ch.updateFromStream(istream, PR_UINT32_MAX); // pass false here to get binary data back var hash = ch.finish(false); // return the two-digit hexadecimal code for a byte function toHexString(
charCode) { return ("0" +
charCode.toString(16)).slice(-2); } // convert the binary hash data to a hex string. var s = Array.from(hash, (c, i) => toHexString(hash.
charCodeAt(i))).join(""); // s now contains your hash in hex This gives 5eb63bbbe01eeed093cb22bb8f5acdc3 for the hash value. This example, while simple, shows most of the functionality of the interface. The first thing to note is that when you call the init() method you must specify the hash algorithm to use. All of the available algorithms are specified as constants on the interface. Also note th...
...And 2 more matches
NS_StringAppendData
aDataLength [in] The length of aData, measured in storage units. ...
... aDataLength [in] The length of aData, measured in storage units. ...
... 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. ...
...And 2 more matches
Edit fonts - Firefox Developer Tools
supplied. They are used by a descendant of the inspected element, for example, when it is a container for other elements which have text content with fonts applied. They are system fallback fonts used when nothing from the font-family CSS declaration has been applied. Fonts Editor Firefox 63 adds the Font Editor -- a new area below "Fonts used" with additional controls for editing the fonts'
characteristics. For standard (static) fonts, you will be able to change the settings listed below Size The font-size for the inspected element. This can be set using em, rem, %, px, vh, or vw units. You can select values using the slider or enter a numeric value directly into the text box. Note: If you want to use a different unit such as pt for font-size or line-height, you can set the pro...
...fonts? Variable Fonts, or OpenType Font Variations, define a new font file format that allows the font designer to include multiple variations of a 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...
...nt-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 implement a registered axis, its behavior must follow the defined behavior. All variable font axes have a four-
character axis tag. The CSS font-variation-settings property uses the tag as part of the key-value pair. For example, to set font-weight using font-variation-settings, you could do something like this: font-variation-settings: "wght" 350; However, you should only use font-variation-settings as a last resort if there is no basic font property available for setting those
characteristic values (e.g. cu...
...And 2 more matches
Document.querySelector() - Web APIs
ng through sequential nodes by order of the number of child nodes. Syntax element = document.querySelector(selectors); Parameters selectors A DOMString containing one or more selectors to match. This string must be a valid CSS selector string; if it isn't, a SYNTAX_ERR exception is thrown. See Locating DOM elements using selectors for more about selectors and how to manage them. Note:
Characters that are not part of standard CSS syntax must be escaped using a backslash
character. Since JavaScript also uses backslash escaping, be especially careful when writing string literals using these
characters. See Escaping special
characters for more information. Return value An HTMLElement object representing the first element in the document that matches the specified set of CSS selector...
...cified selectors, you should use querySelectorAll() instead. Exceptions SYNTAX_ERR The syntax of the specified selectors is invalid. Usage notes If the specified selector matches an ID that is incorrectly used more than once in the document, the first element with that ID is returned. CSS pseudo-elements will never return any elements, as specified in the Selectors API. ...
...fied selector matches an ID that is incorrectly used more than once in the document, the first element with that ID is returned. CSS pseudo-elements will never return any elements, as specified in the Selectors API. Escaping special
characters To match against an ID or selectors that do not follow standard CSS syntax (by using a colon or space inappropriately, for example), you must escape the
character with a backslash ("\"). ...
...And 2 more matches
Document - Web APIs
ent interface, whereas XML and SVG documents implement the XMLDocument interface. Constructor Document() Creates a new Document object. Properties This interface also inherits from the Node and EventTarget interfaces. Document.anchorsRead only Returns a list of all of the anchors in the document. Document.body Returns the <body> or <frameset> node of the current document. Document.
characterSetRead only Returns the
character set being used by the document. Document.compatMode Read only Indicates whether the document is rendered in quirks or strict mode. Document.contentType Read only Returns the Content-Type from the MIME Header of the current document. Document.doctypeRead only Returns the Document Type Definition (DTD) of the current document. Document.documentEl...
... links in the document body. Document.all Provides access to all elements in the document -- it returns an HTMLAllCollection rooted at the document node. This is a legacy, non-standard property and should not be used. Document.applets Read only Returns an ordered list of the applets within a document. Document.bgColor Gets/sets the background color of the current document. Document.
charset Read only Alias of Document.
characterSet. Use this property instead. Document.domConfig Should return a DOMConfiguration object. Document.fgColor Gets/sets the foreground color, or text color, of the current document. Document.fullscreen true when the document is in full-screen mode. Document.height Gets/sets the height of the current document. Document.inputEncoding Rea...
...Use this property instead. Document.linkColor Gets/sets the color of hyperlinks in the document. Document.rootElement Like Document.documentElement, but only for <svg> root elements. Use this property instead. Document.vlinkColor Gets/sets the color of visited hyperlinks. Document.width Returns the width of the current document. ...
...And 2 more matches
GlobalEventHandlers.onkeypress - Web APIs
This example logs the KeyboardEvent.code value whenever you press a key inside the <input> element. ...
...ySelector('input'); const log = document.getElementById('log'); input.onkeypress = logKey; function logKey(e) { log.textContent += ` ${e.code}`; } Result Filter keys with a regular expression This example filters the
characters typed into a form field using a regular expression. ...
...t.getElementById('log'); input.onkeypress = logKey; function logKey(e) { log.textContent += ` ${e.code}`; } Result Filter keys with a regular expression This example filters the
characters typed into a form field using a regular expression. HTML <label>Enter numbers only: <input> </label> JavaScript function numbersOnly(event) { return event.
charCode === 0 || /\d/.test(String.from
CharCode(event.
charCode)); } const input = document.querySelector('input'); input.onkeypress = numbersOnly; // Prevent pasting (since pasted content might include non-number
characters) input.onpaste = event => false; Result Capture the typing of a hidden word The following JavaScript function will do something after the user types the word "exit" in any point of a page. /* Type the word "exit...
...And 2 more matches
HTMLTableCellElement - Web APIs
urrounding context. The possible values are "left", "right", and "center". HTMLTableCellElement.axis A DOMString containing a name grouping cells in virtual. It reflects the obsolete axis attribute. HTMLTableCellElement.bgColor A DOMString containing the background color of the cells. It reflects the obsolete bgcolor attribute. ...
...t. The possible values are "left", "right", and "center". HTMLTableCellElement.axis A DOMString containing a name grouping cells in virtual. It reflects the obsolete axis attribute. HTMLTableCellElement.bgColor A DOMString containing the background color of the cells. It reflects the obsolete bgcolor attribute. HTMLTableCellElement.ch A DOMString containing one single
chararcter. ...
...ment.axis A DOMString containing a name grouping cells in virtual. It reflects the obsolete axis attribute. HTMLTableCellElement.bgColor A DOMString containing the background color of the cells. It reflects the obsolete bgcolor attribute. HTMLTableCellElement.ch A DOMString containing one single
chararcter. This
character is the one to align all the cell of a column on. It reflects the
char and default to the decimal points associated with the language, e.g. ...
...And 2 more matches
HTMLTableRowElement - Web APIs
enter". HTMLTableRowElement.bgColor Is a DOMString containing the background color of the cells. It reflects the obsolete bgcolor attribute. HTMLTableRowElement.cells Read only Returns a live HTMLCollection containing the cells in the row. The HTMLCollection is live and is automatically updated when cells are added or removed. ...
...leRowElement.bgColor Is a DOMString containing the background color of the cells. It reflects the obsolete bgcolor attribute. HTMLTableRowElement.cells Read only Returns a live HTMLCollection containing the cells in the row. The HTMLCollection is live and is automatically updated when cells are added or removed. HTMLTableRowElement.ch Is a DOMString containing one single
character. ...
...he cells. It reflects the obsolete bgcolor attribute. HTMLTableRowElement.cells Read only Returns a live HTMLCollection containing the cells in the row. The HTMLCollection is live and is automatically updated when cells are added or removed. HTMLTableRowElement.ch Is a DOMString containing one single
character. This
character is the one to align all the cell of a column on. It reflects the
char and default to the decimal points associated with the language, e.g. ...
...And 2 more matches
HTMLTableSectionElement - Web APIs
the alignment of the element's contents with respect to the surrounding context. The possible values are "left", "right", and "center". HTMLTableSectionElement.rows Read only Returns a live HTMLCollection containing the rows in the section. The HTMLCollection is live and is automatically updated when rows are added or removed. ...
...the element's contents with respect to the surrounding context. The possible values are "left", "right", and "center". HTMLTableSectionElement.rows Read only Returns a live HTMLCollection containing the rows in the section. The HTMLCollection is live and is automatically updated when rows are added or removed. HTMLTableSectionElement.ch Is a DOMString containing one single
chararcter. ...
...e values are "left", "right", and "center". HTMLTableSectionElement.rows Read only Returns a live HTMLCollection containing the rows in the section. The HTMLCollection is live and is automatically updated when rows are added or removed. HTMLTableSectionElement.ch Is a DOMString containing one single
chararcter. This
character is the one to align all the cell of a column on. It reflects the
char and default to the decimal points associated with the language, e.g. ...
...And 2 more matches
KeyboardEvent.code - Web APIs
The KeyboardEvent.code property represents a physical key on the keyboard (as opposed to the
character generated by pressing the key). In other words, this property returns a value that isn't altered by keyboard layout or the state of the modifier keys. If the input device isn't a physical keyboard, but is instead a virtual keyboard or accessibility device, the returned value will be set by the browser to match as closely as possible to what would happen with a physical keyboard, to maximize compatibility between physical and virtual input devices. ...
... a physical keyboard, but is instead a virtual keyboard or accessibility device, the returned value will be set by the browser to match as closely as possible to what would happen with a physical keyboard, to maximize compatibility between physical and virtual input devices. ...
.... This property is useful when you want to handle keys based on their physical positions on the input device rather than the
characters associated with those keys; this is especially common when writing code to handle input for games that simulate a gamepad-like environment using keys on the keyboard. Be aware, however, that you can't use the value reported by KeyboardEvent.code to determine the
character generated by the keystroke, because the keycode's name may not match the actual
character that's printed on the key or that's generated by the computer when the key is pressed. For example, the code returned is "KeyQ" for the Q key on a QWERTY layout keyboard, but the same code value also represents the ' key on Dvorak keyboards and the A key on AZERTY keyboards. That makes it impossible to...
...And 2 more matches
KeyboardEvent.key - Web APIs
The KeyboardEvent interface's key read-only property returns the value of the key pressed by the user, taking into consideration the state of modifier keys such as Shift as well as the keyboard locale and layout. Its value is determined as follows: Key values See a full list of key values. If the pressed key has a printed representation, the returned value is a non-empty Unicode
character string containing the printable representation of the key. If the pressed key is a control or special
character, the returned value is one of the pre-defined key values. If the KeyboardEvent represents the press of a dead key, the key value must be "Dead". Some specialty keyboard keys (such as the extended keys for controlling media on multimedia keyboards) don't generate key codes on Windows; inst...
...hey aren't actually key codes. If the key cannot be identified, the returned value is Unidentified. KeyboardEvent sequence Every KeyboardEvent is fired in a pre-determined sequence. For a given key press, the sequence of KeyboardEvents fired is as follows assuming that Event.preventDefault is not called: A keydown event is first fired. ...
... a given key press, the sequence of KeyboardEvents fired is as follows assuming that Event.preventDefault is not called: A keydown event is first fired. If the key is held down further and the key produces a
character key, then the event continues to be emitted in a platform implementation dependent interval and the KeyboardEvent.repeat read only property is set to true. If the key produces a
character key that would result in a
character being inserted into possibly an <input>, <textarea> or an element with HTMLElement.contentEditable set to true, the beforeinput and input event types are fired in that order. Note that some other implementations may fire keypress event if supported. The events will be fired repeatedly while the key is held down. A keyup event is fired once the key is rel...
...And 2 more matches
SVGTextContentElement - Web APIs
SVGAnimatedLength reflecting the textLength attribute of the given element. SVGTextContentElement.lengthAdjust Read only An SVGAnimatedEnumeration reflecting the lengthAdjust attribute of the given element. The numeric type values represent one of the constant values above. Methods This interface also inherits methods from its parent, SVGGraphicsElement. SVGTextContentElement.getNumberOf
Chars() Returns a long representing the total number of addressable
characters available for rendering within the current element, regardless of whether they will be rendered. SVGTextContentElement.getComputedTextLength() Returns a float representing the computed length for the text within the element. SVGTextContentElement.getSubStringLength() Returns a float representing the computed length of ...
...float representing the computed length of the formatted text advance distance for a substring of text within the element. Note that this method only accounts for the widths of the glyphs in the substring and any extra spacing inserted by the CSS 'letter-spacing' and 'word-spacing' properties. Visual spacing adjustments made by the 'x' attribute is ignored. SVGTextContentElement.getStartPositionOf
Char() Returns a DOMPoint representing the position of a typographic
character after text layout has been performed. Note: In SVG 1.1 this method returned an SVGPoint. SVGTextContentElement.getEndPositionOf
Char() Returns a DOMPoint representing the trailing position of a typographic
character after text layout has been performed. Note: In SVG 1.1 this method returned an SVGPoint. SVGTextCont...
... representing the position of a typographic
character after text layout has been performed. Note: In SVG 1.1 this method returned an SVGPoint. SVGTextContentElement.getEndPositionOf
Char() Returns a DOMPoint representing the trailing position of a typographic
character after text layout has been performed. Note: In SVG 1.1 this method returned an SVGPoint. SVGTextContentElement.getExtentOf
Char() Returns a DOMRect representing the computed tight bounding box of the glyph cell that corresponds to a given typographic
character. ...
...And 2 more matches
SpeechSynthesisEvent - Web APIs
The SpeechSynthesisEvent interface of the Web Speech API contains information about the current state of SpeechSynthesisUtterance objects that have been processed in the speech service. Properties The SpeechSynthesisEvent interface also inherits properties from its parent interface, Event. SpeechSynthesisEvent.
charIndex Read only Returns the index position of the
character in the SpeechSynthesisUtterance.text that was being spoken when the event was triggered. SpeechSynthesisEvent.elapsedTime Read only Returns the elapsed time in milliseconds after the SpeechSynthesisUtterance.text started being spoken that the event was triggered at. SpeechSynthesisEvent.name Read only Returns the name associated with certain types of events occuring as the SpeechSynthesisUtterance.text is bei...
...f the SSML marker reached in the case of a mark event, or the type of boundary reached in the case of a boundary event. SpeechSynthesisEvent.utterance Read only Returns the SpeechSynthesisUtterance instance that the event was triggered on. Methods The SpeechSynthesisEvent interface also inherits methods from its parent interface, Event. ...
... the case of a mark event, or the type of boundary reached in the case of a boundary event. SpeechSynthesisEvent.utterance Read only Returns the SpeechSynthesisUtterance instance that the event was triggered on. Methods The SpeechSynthesisEvent interface also inherits methods from its parent interface, Event. ...
...And 2 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
. WebVTT comments Comments are an optional component that can be used to add information to a WebVTT file. Comments are intended for those reading the file and are not seen by users. Comments may contain newlines but cannot contain a blank line, which is equivalent to two consecutive newlines. A blank line signifies the end of a comment. A comment cannot contain the string "-->", the ampersand
character (&), or the less-than sign (<). If you wish to use such
characters, you need to escape them using for example & for ampersand and < for less-than. It is also recommended that you use the greater-than escape sequence (>) instead of the greater-than
character (>) to avoid confusion with tags. A comment consists of three parts: The string NOTE. A space or a newline. Zero or more...
... Example 4 - Common WebVTT example NOTE This is a comment Example 5 - Multi-line comment NOTE One comment that is spanning more than one line. NOTE You can also make a comment across more than one line this way. ...
...rt line:-1 align:end Cue payload The payload is where the main information or content is located. In normal usage the payload contains the subtitles to be displayed. The payload text may contain newlines but it cannot contain a blank line, which is equivalent to two consecutive newlines. A blank line signifies the end of a cue. A cue text payload cannot contain the string "-->", the ampersand
character (&), or the less-than sign (<). Instead use the escape sequence "&" for ampersand and "<" for less-than. It is also recommended that you use the greater-than escape sequence ">" instead of the greater-than
character (>) to avoid confusion with tags. If you are using the WebVTT file for metadata these restrictions do not apply. In addition to the three escape sequences mentioned ab...
...And 2 more matches
Using XMLHttpRequest - Web APIs
d to send and receive binary content. There are several well tested methods for coercing the response of an XMLHttpRequest into sending binary data. These involve utilizing the overrideMimeType() method on the XMLHttpRequest object and is a workable solution. var oReq = new XMLHttpRequest(); oReq.open("GET", url); // retrieve data unprocessed as a binary string oReq.overrideMimeType("text/plain;
charset=x-user-defined"); /* ... */ However, more modern techniques are available, since the responseType attribute now supports a number of additional content types, which makes sending and receiving binary data much easier. For example, consider this snippet, which uses the responseType of "arraybuffer" to fetch the remote content into a ArrayBuffer object, which stores the raw binary data. var ...
... to perform the same effects using JavaScript you have to instruct the interpreter about everything. Therefore, how to send forms in pure AJAX is too complex to be explained here in detail. ...
...|*| https://www...
...And 2 more matches
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. ...
... /* 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. 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 tex...
...ations 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. ...
...And 2 more matches
Variable fonts guide - CSS: Cascading Style Sheets
one). 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 very specific designs for bolder weights and italics that often include completely different
characters (lower-case 'a' and 'g' are often quite different in italics, for example). In order to most accurately reflect the typeface design and avoid differences between browsers and how they may or may not synthesize the different styles, it's more accurate to load the specific font files where needed when using a non-variable font. You may also find that some variable fonts come split into two f...
...t-variation-settings: 'wdth' 115; The following live example's CSS can be edited to allow you to play with font width values. Italic The Italic (ital) axis works differently in that it is either on or off; there is no in-between. Italic designs often include dramatically different letterforms from their upright counterparts, so in the transition from upright to italic, a number of glyph (or
character) substitutions usually occur. Italic and oblique are often used somewhat interchangeably, but in truth are actually quite different. Oblique is defined in this context with the term slant (see the below section), and a typeface would typically have one or the other, but not both. In CSS, both italic and oblique are applied to text using the font-style property. Also note the introduction of...
...to prevent faux-bolding as well. font-style: italic; font-variation-settings: 'ital' 1; font-synthesis: none; The following live example's CSS can be edited to allow you to play with font italics. Slant Slant (represented by the slnt tag), or as it's often referred to, 'oblique' -- is different to true italics in that it changes the angle of the letterforms but doesn't perform any kind of
character substitution. It is also variable, in that it is expressed as a numeric range. This allows the font to be varied anywhere along that axis. The allowed range is generally 0 (upright) to 20 degrees -- any number value along that range can be supplied, so the font can be slanted just a tiny bit. However, any value from -90-90 degrees is valid. Note: The deg keyword is not used when utilizing ...
...And 2 more matches
<custom-ident> - CSS: Cascading Style Sheets
The <custom-ident> CSS data type denotes an arbitrary user-defined string used as an identifier. It is case-sensitive, and certain values are forbidden in various contexts to prevent ambiguity. Syntax The syntax of <custom-ident> is similar to CSS identifiers (such as property names), except that it is case-sensitive. It consists of one or more
characters, where
characters can be any of the following: any alphabetical
character (A to Z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped
character (preceded by a backslash, \), a Unicode
character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its Unicode code point) Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. On...
... any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped
character (preceded by a backslash, \), a Unicode
character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its Unicode code point) Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. On the other hand, as there are several ways to escape a
character, toto\? and toto\3F are the same identifiers. Forbidden values A <custom-ident> must not be placed between single or double quotes as this would be identical to a <string>. Moreover, the first
character must not be a decimal digit, nor a hyphen (-) followed by a decimal digit or another hyphen. To prevent ambiguity, each property that uses <custom-ident> forbids the use of specific values...
...nese-formal, trad-chinese-informal, upper-armenian, disclosure-open, and disclosure-close. grid-row-start grid-row-end grid-column-start grid-column-end Forbids the span value. will-change Forbids the global CSS values (unset, initial, and inherit), as well as the values will-change, auto, scroll-position, and contents. ...
...And 2 more matches
overflow-wrap - CSS: Cascading Style Sheets
break-word; overflow-wrap: anywhere; /* Global values */ overflow-wrap: inherit; overflow-wrap: initial; overflow-wrap: unset; The overflow-wrap property is specified as a single keyword chosen from the list of values below. Values normal Lines may only break at normal word break points (such as a space between two words). anywhere To prevent overflow, an otherwise unbreakable string of
characters -- like a long word or URL -- may be broken at any point if there are no otherwise-acceptable break points in the line. No hyphenation
character is inserted at the break point. Soft wrap opportunities introduced by the word break are considered when calculating min-content intrinsic sizes. break-word The same as the anywhere value, with normally unbreakable words allowed to be broken at a...
...al valuenormalApplies tonon-replaced inline elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | break-word | anywhere Examples Comparing overflow-wrap, word-break, and hyphens This example compares the results of overflow-wrap, word-break, and hyphens when breaking up a long word. ...
...w-wrap, word-break, and hyphens This example compares the results of overflow-wrap, word-break, and hyphens when breaking up a long word. HTML <p>They say the fishing is excellent at Lake <em class="normal">
Chargoggagoggmanchauggagoggchaubunagungamaugg</em>, though I've never been there myself. (<code>normal</code>)</p> <p>They say the fishing is excellent at Lake <em class="ow-anywhere">
Chargoggagoggmanchauggagoggchaubunagungamaugg</em>, though I've never been there myself. (<code>overflow-wrap: anywhere</code>)</p> <p>They say the fishing is excellent at Lake <em class="ow-break-word">
Chargoggagoggmanchauggagoggchaubunagungamaugg</em>, though I've never been there myself. (<code>overflow-wrap: break-word</code>)</p> <p>They say the fishing is excellent at Lake <em class="wor...
...And 2 more matches
ruby-position - CSS: Cascading Style Sheets
The ruby-position CSS property defines the position of a ruby element relatives to its base element. It can be position over the element (over), under it (under), or between the
characters, on their right side (inter-
character). /* Keyword values */ ruby-position: over; ruby-position: under; ruby-position: inter-
character; /* Global values */ ruby-position: inherit; ruby-position: initial; ruby-position: unset; Syntax Values over Is a keyword indicating that the ruby has to be placed over the main text for horizontal scripts and right to it for vertical scripts. ...
... Global values */ ruby-position: inherit; ruby-position: initial; ruby-position: unset; Syntax Values over Is a keyword indicating that the ruby has to be placed over the main text for horizontal scripts and right to it for vertical scripts. under Is a keyword indicating that the ruby has to be placed under the main text for horizontal scripts and left to it for vertical scripts. ...
... Syntax Values over Is a keyword indicating that the ruby has to be placed over the main text for horizontal scripts and right to it for vertical scripts. under Is a keyword indicating that the ruby has to be placed under the main text for horizontal scripts and left to it for vertical scripts. inter-
character Is a keyword indicating that the ruby has to be placed between the different
characters. ...
...And 2 more matches
<string> - CSS: Cascading Style Sheets
The <string> CSS data type represents a sequence of
characters. Strings are used in numerous CSS properties, such as content, font-family, and quotes. Syntax The <string> data type is composed of any number of Unicode
characters surrounded by either double (") or single (') quotes. Most
characters can be represented literally. All
characters can also be represented with their respective Unicode code points in hexadecimal, in which case they are preceded by a backslash (\). For example, \22 represents a double quote, \27 a single quote ('), and \A9 the copyright symbol ((C)). Importantly, certain
characters which would otherwise be invalid can be escaped with a backslash. These include double quotes when used inside a double-quoted string, single quotes when used inside a single-quoted str...
... However, to get new lines, you must also set the white-space property to appropriate value. ...
... However, to get new lines, you must also set the white-space property to appropriate value. ...
...And 2 more matches
text-justify - CSS: Cascading Style Sheets
Values none The text justification is turned off. ...
...ce and quality, but also on what is most appropriate for the language of the text (e.g., English, CJK languages, etc.). This is the default justification used if text-justify is not set at all. inter-word The text is justified by adding space between words (effectively varying word-spacing), which is most appropriate for languages that separate words using spaces, like English or Korean. inter-
character The text is justified by adding space between
characters (effectively varying letter-spacing), which is most appropriate for languages like Japanese. distribute Exhibits the same behaviour as inter-
character; this value is kept for backwards compatibility. Formal definition Initial valueautoApplies toinline-level and table-cell elementsInheritedyesComputed valueas specifiedAnimation ...
...Nunc ornare maximus vehicula. Duis nisi velit, dictum id mauris vitae, lobortis pretium quam. Quisque sed nisi pulvinar, consequat justo id, feugiat leo. ...
...And 2 more matches
<input type="color"> - HTML: Hypertext Markup Language
o ensure that the color information is entered in the proper format, or a platform-standard color picker, or some kind of custom color picker window. 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. ...
...While you can input the color in either upper- or lower-case, it will be stored in lower-case form. The value is never in any other form, and is never empty. ...
...n't a valid, fully-opaque, RGB color in hexadecimal notation will result in the value being set to #000000. In particular, you can't use CSS's standardized color names, or any CSS function syntax, to set the value. This makes sense when you keep in mind that HTML and CSS are separate languages and specifications. In addition, colors with an alpha channel are not supported; specifying a color in 9-
character hexadecimal notation (e.g. #009900aa) will also result in the color being set to #000000. Note: Any web browser that doesn't support an input of type color will naturally fall back to the type text. Because users can write colors in many different ways (such as rgb(255, 255, 0)), one way to work around this is to set a pattern attribute equal to either #[0-9a-f]{6} or #[0-9A-Fa-f]{6} (pre...
...And 2 more matches
<tbody>: The Table Body element - HTML: Hypertext Markup Language
ed attributes align This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are: left, aligning the content to the left of the cell center, centering the content in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell
char, aligning the textual content on a special
character with a minimal offset, defined by the
char and
charoff attributes. If this attribute is not set, the left value is assumed. As this attribute is deprecated, use the CSS text-align property instead. Note: The equivalent text-align property for the align="
char" is not implemented in any browsers yet. See the text-align's browser compatibi...
...t-align property for the align="
char" is not implemented in any browsers yet. See the text-align's browser compatibility section for the <string> value. bgcolor The background color of the table. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. One of the predefined color kewords can also be used. As this attribute is deprecated, use the CSS background-color property instead.
char This attribute is used to set the
character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values. If align is not set to
char, this attribute is ignored. ...
...ixed by a '#'. One of the predefined color kewords can also be used. As this attribute is deprecated, use the CSS background-color property instead.
char This attribute is used to set the
character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values. If align is not set to
char, this attribute is ignored.
charoff This attribute is used to indicate the number of
characters to offset the column data from the alignment
characters specified by the
char attribute. valign This attribute specifies the vertical alignment of the text within each row of cells of the table header. Possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possi...
...And 2 more matches
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
lign This enumerated attribute specifies how the cell content's horizontal alignment will be handled. Possible values are: left: The content is aligned to the left of the cell. center: The content is centered in the cell. right: The content is aligned to the right of the cell. justify (with text only): The content is stretched out inside the cell so that it covers its entire width.
char (with text only): The content is aligned to a
character inside the <th> element with minimal offset. This
character is defined by the
char and
charoff attributes Unimplemented (see bug 2212). The default value when this attribute is not specified is left. Note: To achieve the same effect as the left, center, right or justify values, apply the CSS text-align property to the element. T...
...Unimplemented in CSS3. axis This attribute contains a list of space-separated strings. Each string is the id of a group of cells that this header applies to. bgcolor This attribute defines the background color of each cell in a column. ...
...Unimplemented in CSS3. axis This attribute contains a list of space-separated strings. Each string is the id of a group of cells that this header applies to. bgcolor This attribute defines the background color of each cell in a column. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. One of the predefined color kewords can also be used. ...
...And 2 more matches
Using the application cache - HTML: Hypertext Markup Language
es listed under the CACHE: section header (or immediately after the CACHE MANIFEST line) are explicitly cached after they're downloaded for the first time. NETWORK: Files listed under the NETWORK: section header in the cache manifest file are white-listed resources that require a connection to the server. All requests to such resources bypass the cache, even if the user is offline. The wildcard
character * can be used once. Most sites need *. FALLBACK: The FALLBACK: section specifies fallback pages the browser should use if a resource is inaccessible. Each entry in this section lists two URIs--the first is the resource, the second is the fallback. Both URIs must be relative and from the same origin as the manifest file. Wildcards may be used. The CACHE, NETWORK, and FALLBACK sections can...
...back resource (e.g., in case a connection to the server cannot be established). Structure of a cache manifest file Cache manifest files must be served with the text/cache-manifest MIME type. All resources served using this MIME type must follow the syntax for an application cache manifest, as defined in this section. Cache manifests are UTF-8 format text files, and may optionally include a BOM
character. Newlines may be represented by line feed (U+000A), carriage return (U+000D), or carriage return and line feed both. The first line of the cache manifest must consist of the string CACHE MANIFEST (with a single U+0020 space between the two words), followed by zero or more space or tab
characters. Any other text on the line is ignored. The remainder of the cache manifest must be comprised o...
...oth. The first line of the cache manifest must consist of the string CACHE MANIFEST (with a single U+0020 space between the two words), followed by zero or more space or tab
characters. Any other text on the line is ignored. The remainder of the cache manifest must be comprised of zero or more of the following lines: Blank line You may use blank lines comprised of zero or more space and tab
characters. Comment Comments consist of zero or more tabs or spaces followed by a single #
character, followed by zero or more
characters of comment text. Comments may only be used on their own lines (after the initial CACHE MANIFEST line), and cannot be appended to other lines. This means that you cannot specify fragment identifiers. Section header Section headers specify which section of the cac...
...And 2 more matches
Data URLs - HTTP
inheriting the origin of the settings object responsible for the navigation. Syntax Data URLs are composed of four parts: a prefix (data:), a MIME type indicating the type of data, an optional base64 token if non-textual, and the data itself: data:[<mediatype>][;base64],<data> The mediatype is a MIME type string, such as 'image/jpeg' for a JPEG image file. If omitted, defaults to text/plain;
charset=US-ASCII If the data is textual, you can simply embed the text (using the appropriate entities or escapes based on the enclosing document's type). Otherwise, you can specify base64 to embed base64-encoded binary data. You can find more info on MIME types here and here. A few examples: data:,Hello%2C%20World! Simple text/plain data. Note the use of percent-encoding (URL-encoding) for the ...
... the data is textual, you can simply embed the text (using the appropriate entities or escapes based on the enclosing document's type). Otherwise, you can specify base64 to embed base64-encoded binary data. You can find more info on MIME types here and here. A few examples: data:,Hello%2C%20World! Simple text/plain data. Note the use of percent-encoding (URL-encoding) for the quote and space
characters. Also, for CSV data (MIME type "text/csv"), percent-encoding is needed to preserve the line endings that delimit rows of the spreadsheet. data:text/plain;base64,SGVsbG8sIFdvcmxkIQ== base64-encoded version of the above data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E An HTML document with <h1>Hello, World!</h1> data:text/html,<script>alert('hi');</script> An HTML document that execu...
...ocument with <h1>Hello, World!</h1> data:text/html,<script>alert('hi');</script> An HTML document that executes a JavaScript alert. Note that the closing script tag is required. Encoding data into base64 format Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. By consisting only in ASCII
characters, base64 strings are generally url-safe, and that's why they can be used to encode data in Data URLs. Encoding in Javascript The Web APIs have native methods to encode or decode to base64: Base64 encoding and decoding. Encoding on a Unix system Base64 encoding of a file or string on Linux and Mac OS X systems can be achieved using the command-line base64 (or, as an alternative, the uuenc...
...And 2 more matches
Functions - JavaScript
This is often useful if you don't know in advance how many arguments will be passed to the function. You can use arguments.length to determine the number of arguments actually passed to the function, and then access each argument using the arguments object. For example, consider a function that concatenates several strings. The only formal argument for the function is a string that specifies the
characters that separate the items to concatenate. 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 in...
...odes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine. decodeURIComponent() The decodeURIComponent() method decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine. ...
...e. decodeURIComponent() The decodeURIComponent() method decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine. ...
...And 2 more matches
Quantifiers - JavaScript
Characters Meaning x* Matches the preceding item "x" 0 or more times. For example, /bo*/ matches "boooo" in "A ghost booooed" and "b" in "A bird warbled", but nothing in "A goat grunted". x+ Matches the preceding item "x" 1 or more times. Equivalent to {1,}. For example, /a+/ matches the "a" in "candy" and all the "a"'s in "caaaaaaandy". ...
...dy", the two "a"'s in "caandy", and the first three "a"'s in "caaaaaaandy". Notice that when matching "caaaaaaandy", the match is "aaa", even though the original string had more "a"s in it. x*? x+? x?? x{n}? x{n,}? x{n,m}? By default quantifiers like * and + are "greedy", meaning that they try to match as much of the string as possible. The ?
character after the quantifier makes the quantifier "non-greedy": meaning that it will stop as soon as it finds a match. For example, given a string like "some <foo> <bar> new </bar> </foo> thing": /<.*>/ will match "<foo> <bar> new </bar> </foo>" /<.*?>/ will match "<foo>" Examples Repeated pattern var wordEndingWithAs = /\w+a+\b/; var delicateMessage = "This is Spar...
... finds a match. ...
...And 2 more matches
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
The JavaScript warning about string generics occurs in Firefox versions prior to 68. String generics have been removed starting with Firefox 68. ...
... The JavaScript warning about string generics occurs in Firefox versions prior to 68. String generics have been removed starting with Firefox 68. ...
... The JavaScript warning about string generics occurs in Firefox versions prior to 68. String generics have been removed starting with Firefox 68. ...
...And 2 more matches
Array.prototype.sort() - 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 arr.sort([compareFunction]) Parameters compareFunction Optional Specifies a function that defines the sort order. If omitted, the array elements are converted to strings, then sorted according to each
character's Unicode code point value. firstEl The first element for comparison. secondEl The second element for comparison. Return value The sorted array. Note that the array is sorted in place, and no copy is made. Description If compareFunction is not supplied, all non-undefined array elements are sorted by converting them to strings and comparing strings in UTF-16 code units orde...
...s not supplied, all non-undefined array elements are sorted by converting 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 fu...
... var items = ['reserve', 'premier', 'communique', 'cafe', 'adieu', 'eclair']; items.sort(function (a, b) { return a.localeCompare(b); }...
...And 2 more matches
String.fromCodePoint() - JavaScript
tring 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 ECMAScript 2015 and may not be supported in all web browsers or environments yet. ...
...// Astral code point; split in surrogate halves // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae codePoint -= 0x10000; codeLen = codeUnits.push( (codePoint >> 10) + 0xD800, // highSurrogate (codePoint % 0x400) + 0xDC00 // lowSurrogate ); } if (codeLen >= 0x3fff) { result += stringFrom
CharCode.apply(null, codeUnits); codeUnits.length = 0; } } return result + stringFrom
CharCode.apply(null, codeUnits); }; try { // IE 8 only supports `Object.defineProperty` on DOM elements Object.defineProperty(String, "fromCodePoint", { "value": fromCodePoint, "configurable": true, "writable": true }); } catch(e) { String.fromCodePoi...
...codeUnits.length = 0; } } return result + stringFrom
CharCode.apply(null, codeUnits); }; try { // IE 8 only supports `Object.defineProperty` on DOM elements Object.defineProperty(String, "fromCodePoint", { "value": fromCodePoint, "configurable": true, "writable": true }); } catch(e) { String.fromCodePoint = fromCodePoint; } }(String.from
CharCode)); Examples Using fromCodePoint() Valid input: String.fromCodePoint(42); // "*" String.fromCodePoint(65, 90); // "AZ" String.fromCodePoint(0x404); // "\u0404" == "?" String.fromCodePoint(0x2F804); // "\uD87E\uDC04" String.fromCodePoint(194564); // "\uD87E\uDC04" String.fromCodePoint(0x1D306, 0x61, 0x1D307); // "\uD834\uDF06a\uD834\uDF07" Invalid input: String.fromCodePoi...
...And 2 more matches
encodeURI() - JavaScript
The encodeURI() function encodes a URI by replacing each instance of certain
characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the
character (will only be four escape sequences for
characters composed of two "surrogate"
characters). 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 encodeURI(URI) Parameters URI A complete URI. Return value A new string representing the provided string encoded as a URI. Description The encodeURI() function does not encode
characters that have special meaning (reserved
characters) for a URI. The following example shows all the p...
...mples and send us a pull request. Syntax encodeURI(URI) Parameters URI A complete URI. Return value A new string representing the provided string encoded as a URI. Description The encodeURI() function does not encode
characters that have special meaning (reserved
characters) for a URI. The following example shows all the parts that a URI "scheme" can possibly contain. Note how certain
characters are used to signify special meaning: http://username:password@www.example.com:80/path/to/file.php?foo=316&bar=this+has+spaces#anchor Hence encodeURI() does not encode
characters that are necessary to formulate a complete URI. Also, encodeURI() does not encode a few additional
characters, known as "unreserved marks", which do not have a reserved purpose but are allowed in a URI "as is". (S...
...aning: http://username:password@www.example.com:80/path/to/file.php?foo=316&bar=this+has+spaces#anchor Hence encodeURI() does not encode
characters that are necessary to formulate a complete URI. Also, encodeURI() does not encode a few additional
characters, known as "unreserved marks", which do not have a reserved purpose but are allowed in a URI "as is". (See RFC2396) encodeURI() escapes all
characters except: Not Escaped: A-Z a-z 0-9 ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) # Examples encodeURI vs encodeURIComponent encodeURI() differs from encodeURIComponent() as follows: var set1 = ";,/?:@&=+$#"; // Reserved
Characters var set2 = "-_.!~*'()"; // Unreserved Marks var set3 = "ABC abc 123"; // Alphanumeric
Characters + Space console.log(encodeURI(set1)); // ;,/?:@&=+$# console...
...And 2 more matches
parseFloat() - JavaScript
https://github.com/mdn/interactive-examples and send us a pull request. Syntax parseFloat(string) Parameters string The value to parse. If this argument is not a string, then it is converted to one using the ToString abstract operation. Leading whitespace in this argument is ignored. Return value A floating point number parsed from the given string. Or NaN when the first non-whitespace
character cannot be converted to a number. Description parseFloat is a top-level function and not a method of any object. If parseFloat encounters a
character other than a plus sign (+), minus sign (- U+002D HYPHEN-MINUS), numeral (0-9), decimal point (.), or exponent (e or E), it returns the value up to that
character, ignoring the invalid
character and
characters following it. A second decimal...
...o a number. Description parseFloat is a top-level function and not a method of any object. If parseFloat encounters a
character other than a plus sign (+), minus sign (- U+002D HYPHEN-MINUS), numeral (0-9), decimal point (.), or exponent (e or E), it returns the value up to that
character, ignoring the invalid
character and
characters following it. A second decimal point also stops parsing (
characters up to that point will still be parsed). Leading and trailing spaces in the argument are ignored. If the argument's first
character can't be converted to a number (it's not any of the above
characters), parseFloat returns NaN. ...
... parseFloat will parse non-string objects if they have a toString or valueOf method. The returned value is the same as if parseFloat had been called on the result of those methods. ...
...And 2 more matches
MathML attribute reference - MathML
Boolean value specifying whether table columns should act as alignment scopes or not. Unimplemented altimg altimg-width altimg-height altimg-valign alttext <math> Visual and textual fall-back options. bevelled <mfrac> Specifies the style how the fraction should be displayed. Deprecated. Use U+2044 (fraction slash) instead. Unimplemented
charalign <mstack> Specifies the horizontal alignment of digits. close <mfenced> A string for the closing delimiter. columnalign <mtable>, <mtd>, <mtr>, <mlabeledtr> Specifies the horizontal alignment of table cells. columnlines <mtable> Specifies table column borders. columnspacing <mtable> Specifies the space between table columns. ...
...that indicates over how many table columns the cell extends. Unimplemented columnwidth <mtable> Specifies the width of table columns. Unimplemented crossout <mscarry> Specifies what kind of line is drawn to cross out carries. Unimplemented decimalpoint <mstyle> If the decimalpoint value is used to specify the alignment, this attribute is specifying the
character for the alignment point within <mstack> and <mtable> columns. denomalign <mfrac> The alignment of the denominator under the fraction. depth <mpadded> Sets or increments the depth. See length. dir <math>, <mi>, <mo>, <mrow>, <ms>, <mtext> The text direction. Possible values are either ltr (left to right) or rtl (right to left). display ...
... Unimplemented indenttarget <mo>, <mspace> Unimplemented infixlinebreakstyle <mstyle> Specifies the default linebreakstyle to use for infix operators. largeop <mo> Specifies whether the operator should be drawn larger than normal. length <msline> Unimplemented linebreak <mo>, <mspace> Unimplemented linebreakmult
char <mo>, <mspace> Unimplemented linebreakstyle <mo>, <mspace> Unimplemented lineleading <mo>, <mspace> linethickness <mfrac> The thickness of the horizontal fraction line. Unimplemented location <mscarries> Unimplemented longdivstyle <mlongdiv> Controls the style of the long division layout. lspace <mo>,...
...And 2 more matches
Common Pitfalls - Archive of obsolete content
tt>chrome:</tt> URIs when you shouldn't. ...
... .getService(Components.interfaces.nsIIOService); var uriObj = ioServ.newURI(uriString, uri
Charset, baseURI); } catch (e) { // May want to catch NS_ERROR_MALFORMED_URI for some applications } C++: nsresult rv; nsCOMPtr<nsIIOService> ioServ = do_GetService("@mozilla.org/network/io-service;1"); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIURI> uriObj; rv = ioServ->NewURI(uriString, uri
Charset, baseURI, getter_AddRefs(uriObj)); if (NS_FAILED(rv)) { // May want to handle NS_ERROR_MALFORMED_URI for // some applications return rv; } or, if the code can include nsNetUtil.h: nsCOMPtr<nsIURI> uriObj; nsresult rv = NS_NewURI(getter_AddRefs(uriObj), uriString, uri
Charset, baseURI); In all cases the baseURI can be null if the uriString should be treated as an a...
...it's something the user typed in the URL bar). ...
...it's something the user typed in the URL bar). The one exception to all of the above, that is the one case in which creating a specific URI class via createInstance is acceptable, is when one is implementing a protocol handler's newURI method. In that case you may not be able to use the I/O service because that service calls the newURI method on the appropriate protocol ha...
Signing an XPI - Archive of obsolete content
this command to create it (note the trailing dot is required). C:\Projects\CodeSigning\> certutil -N -d . The dot will cause the database to be created in the current directory. You will be prompted for the NSS Certificate database password - don't forget it! C:\Projects\CodeSigning\> certutil -N -d . Enter a password which will be used to encrypt your keys. The password should be at least 8
characters long, and should contain at least one non-alphabetic
character. Enter new password: Re-enter password: Create a test certificate Create a test certificate, using the -p option to set a password for the new certificate C:\Projects\CodeSigning\> signtool -G myTestCert -d . -p"password" using certificate directory: . WARNING: Performing this operation while the browser is running could c...
...-G myTestCert -d . -p"password" using certificate directory: . WARNING: Performing this operation while the browser is running could cause corruption of your security databases. If the browser is currently running, you should exit the browser before continuing this operation. Enter "y" to continue, or anything else to abort: y Enter certificate information. All fields are optional. ...
...rrently running, you should exit the browser before continuing this operation. Enter "y" to continue, or anything else to abort: y Enter certificate information. All fields are optional. Acceptable
characters are numbers, letters, spaces, and apostrophes. certificate common name: XPI Test organization: TJworld organization unit: Software state or province: Nottingham country (must be exactly 2
characters): GB username: tj email address: certificates@lan.tjworld.net generated public/private key pair certificate request generated certificate has been signed certificate "myTestCert" added to database Exported certificate to x509.raw and x509.cacert. x509.cacert will be used to sign your XPI package. Check that it exists on the file system and in the certificate database: C:\Projects\CodeSig...
...air from the Mozilla Firefox certificate database and into the NSS certificate database. The hardest part is locating Mozilla's key database. It consists of two files named key3.db and cert8.db. They usually live in the Mozilla Firefox user profile folder. I found mine in C:\Documents and Settings\TJ\Application Data\Mozilla\Firefox\Profiles\xxxxxxxx.default\ where xxxxxxxx is a random string of
characters. This procedure assumes you installed the new certificate into Mozilla Firefox Here's the commands required to export it to a file, import it to the Code Signing database, and verify the signing attributes (u,u,u). Ensure you use the nickname of your certificate in place of mine, and the directory where your Mozilla Firefox key database files are: C:\Projects\CodeSigning> pk12util -o "Ce...
Priority Content - Archive of obsolete content
raw list of everything that has not been migrated at all appears there. Book Length Works In progress: Netscape Gecko Plugin API Reference 1.0 Original: Netscape Gecko Plugin API Reference 1.0 Wiki Location: Gecko Plugin API Reference Migrators: Started: Core JavaScript Reference 1.5 Original: Core JavaScript Reference 1.5 Wiki Location: Core JavaScript 1.5 Reference Migrators: Deb Ri
chardson In progress: Transforming XML: Netscape and XSLT 1.0 Original: Transforming XML: Netscape and XSLT 1.0 Wiki Location: Transforming XML with XSLT Migrators: Serge K. Keller In progress: Rapid Application Development With Mozilla Original: Author's page and planned host, Ben's temporary host Wiki Location: TOC and links page still under construction. Migrators: Nigel McFarlane and B...
...Keller Licensing: These CSS
charts appear to be under a CC:By-NC-SA license, please make note of that on the page when you do the migration. Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Location: Using Moz...
...Keller Licensing: These CSS
charts appear to be under a CC:By-NC-SA license, please make note of that on the page when you do the migration. Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Location: Using Mozilla in Testing and Debugging ...
...ripting Plugins: Macromedia Flash Migrators: Dependant on (these parts need to be done, put your name down) Completed: SOAP in Netscape Gecko-based Browsers Original: SOAP in Netscape Gecko-based Browsers Wiki Location: SOAP in Gecko-based Browsers Migrators: Doron Rosenberg In progress: CSS Support
Charts Original: CSS Support
Charts and Archive.org mirror Wiki Location: CSS Support
Charts Migrators: Serge K. Keller Licensing: These CSS
charts appear to be under a CC:By-NC-SA license, please make note of that on the page when you do the migration. Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Location: Using Mozilla in Testing and Debugging Web Sites Migrators: Serge K. Keller NOTE: Henrik contac...
String Rosetta Stone - Archive of obsolete content
) ...
...) ...
...) ...
... size_type find(const
charT* s, size_type pos, size_type n) const size_type find(const
charT* s, size_type pos = 0) const size_type find(
charT c, size_type pos = 0) const QString int QString::indexOf ( const QString & str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive ) const Format a printf style string nsString AppendPrintf() std::string n/a QString QString & QString::sprintf ( const
char * cformat, ... ) ...
Focus and Selection - Archive of obsolete content
ese events will only be sent to the textbox that has the focus. The input event is fired whenever the text is modified in the field. The new value will be different than the old value. You may want to use this event instead of using key events, as some keys such as the shift key don't change the value. Also, the input event would not fire if a letter key was pressed and there were already more
characters than will fit in the textbox. The change event is similar in that it fires only when the field is changed. However it only fires once the textbox loses the focus, thus, only once per set of changes. Text Selection When working with a textbox, you may wish to retrieve not the entire contents of a field but only what the user has selected. Or, you may wish to change the current selection. ...
... 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 setSelectionRange function. ...
...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 setSelectionRange 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.setSelectionRange(4,8); This example will select the fifth
character displayed, as well as the sixth, seventh and eighth. If there were only six
characters entered into the field, only the fifth and sixth
characters would be selected. No error would occur. I...
...tion 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 can retrieve and modify the contents of the textbox by using the value property. One additional useful property of textboxes is the textLength property, which holds the total number of
characters in the field. Next, we'll find out how to use commands. << PreviousNext >> ...
Keyboard Shortcuts - Archive of obsolete content
as Shift or Ctrl) need to be pressed. An example is shown below: <keyset> <key id="sample-key" modifiers="shift" key="R"/> </keyset> This sample defines a keyboard shortcut that is activated when the user presses the Shift key and R. The key attribute (note that it has the same name as the element itself) can be used to indicate which key should be pressed, in this case R. You could add any
character for this attribute to require that key to be pressed. The modifiers that must be pressed are indicated with the modifiers attribute. It is a space-separated list of modifier keys, which are listed below. alt The user must press the Alt key. On the Macintosh, this is the Option key. control The user must press the Ctrl key. meta The user must press the Meta key. This is the Command ke...
...Here are some additional examples: <keyset> <key id="copy-key" modifiers="control" key="C"/> <key id="explore-key" modifiers="control alt" key="E"/> <key id="paste-key" modifiers="accel" key="V"/> </keyset> Keycode attribute The key attribute is used to specify the key that must be pressed. However, there will also be cases where you want to refer to keys that cannot be specified with a
character (such as the Enter key or the function keys). The key attribute can only be used for printable
characters. Another attribute, keycode can be used for non-printable
characters. The keycode attribute should be set to a special code which represents the key you want. A table of the keys is listed below. Not all of the keys are available on all keyboards. VK_CANCEL VK_BACK VK_TA...
...hortcuts to activate the commands. Of course, the clipboard commands don't do anything anyway, as we haven't written those scripts. Key Events There are three keyboard events that may be used if the key related features described above aren't suitable. These events are: keypress Called when a key is pressed and released when an element has the focus. You might use this to check for allowed
characters in a field. keydown Called when a key is pressed down while an element has the focus. Note that the event will be called as soon as the key is pressed, even if it hasn't been released yet. keyup Called when a key is released while an element has the focus. Key events are only sent to the element that has the focus. Typically, this will include textboxes, buttons, checkboxes and so for...
...ument itself. In this case, you can add an event listener to the window tag. Normally though, if you want to respond to keys globally, you will use a keyboard shortcut as described earlier. The key event object has two properties which hold the key that was pressed. The keyCode property holds the key code and may be compared to one of the constants from the key table earlier in this section. The
charCode is used for printable
characters and will hold the numeric Unicode
character code value for the key that was pressed. Our Find files example so far : Source View Next, we'll find out how to handle focus and the selection. << PreviousNext >> ...
button - Archive of obsolete content
autocheck Type: boolean If this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false, the checked state must be adjusted manually. Whe...
... autocheck Type: boolean If this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false, the checked state must be adjusted manually. When autocheck is true, the button typ...
..., type Properties accessKey, accessibleType, autoCheck, checkState, checked, command, crop, dir, disabled, dlgType, group, image, label, open, orient, tabIndex, type Examples <button label="Press Me" oncommand="alert('You pressed me!');"/> 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. autocheck Type: boolean If this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false, the checked state must be adjusted manually. When autocheck is true, the button type should be "checkbox" or "radio". checkState Type: integer,...
...anel Similar to the menu type, this opens a popup. Place a panel element inside the button. panel elements are popups that support any type of content. radio The button acts like a radio button. Only one button in the group can be on a once. repeat This button will fire its command event repeatedly while the mouse button is held down. Properties accessKey Type:
character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. autoCheck Type: boolean Gets and sets the value of the autoCheck attribute. checkState Type: integer, values 0, 1, or 2 Gets and sets the value of the checkState attribute. ...
listitem - Archive of obsolete content
checked Type: boolean Indicates whether the element is checked or not. Use hasAttribute() to determine whether this attribute is set instead of getAttribute(). For buttons, the type attribute must be set to checkbox or r...
... checked Type: boolean Indicates whether the element is checked or not. Use hasAttribute() to determine whether this attribute is set instead of getAttribute(). For buttons, the type attribute must be set to checkbox or radio for this attribute to have any...
..., image, label, selected, tabIndex, value Style classes listitem-iconic Examples <listbox id="theList"> <listitem label="Ruby"/> <listitem label="Emerald"/> <listitem label="Sapphire" selected="true"/> <listitem label="Diamond"/> </listbox> 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. checked Type: boolean Indicates whether the element is checked or not. Use hasAttribute() to determine whether this attribute is set instead of getAttribute(). For buttons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command Type: id Set to the id of a command element...
...re-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessKey Type:
character Gets and sets the value of the accesskey attribute. accessible Type: nsIAccessible Returns the accessibility object for the element. checked Type: boolean Gets and sets the value of the checked attribute. control Type: element id Gets and sets the value of the control attribute. crop Type: string ...
radio - Archive of obsolete content
command Type: id Set to the id of a command element that is being observed by the element. crop Type: one of the values below If the label of the element is too big to fit in its given space, t...
... command Type: id Set to the id of a command element that is being observed by the element. crop Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side...
...Group, selected, tabIndex, value Examples <radiogroup> <radio id="orange" 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. command Type: id Set to the id of a command element that is being observed by the element. crop Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place ...
...e-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessKey Type:
character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. control Type: radiogroup element Returns the enclosing radiogroup that the radio element is contained within, which may or may not be its direct parent. crop Type: string Gets and s...
tab - Archive of obsolete content
afterselected Type: boolean This is set to true if the tab is immediately after the currently selected tab. This is automatically set when needed and you shouldn't adjust it manually. This is primarily useful for themes s...
... afterselected Type: boolean This is set to true if the tab is immediately after the currently selected tab. This is automatically set when needed and you shouldn't adjust it manually. This is primarily useful for themes so that they can adjust the appearan...
...bel, last-tab, linkedpanel, oncommand, pending, pinned, selected, tabindex, unread, validate, value Properties accessKey, accessibleType, command, control, crop, disabled, image, label, linkedPanel, selected, tabIndex, value Examples (example needed) 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. afterselected Type: boolean This is set to true if the tab is immediately after the currently selected tab. This is automatically set when needed and you shouldn't adjust it manually. This is primarily useful for themes so that they can adjust the appearance of the area around the selected tab. beforeselected Type:...
...e or not. This would be useful if the images are stored remotely or you plan on swapping the image frequently. The following values are accepted, or leave out the attribute entirely for default handling: always The image is always checked to see whether it should be reloaded. never The image will be loaded from the cache if possible. Properties accessKey Type:
character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. command Type: element id Gets and sets the value of the command attribute. control Type: tabs element Returns the enclosing tabs element. crop Type: string Gets and sets the ...
toolbarbutton - Archive of obsolete content
autocheck Type: boolean If this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false, the checked state must be adjusted manually. When...
... autocheck Type: boolean If this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false, the checked state must be adjusted manually. When autocheck is true, the button type...
...lbar"> <toolbarbutton accesskey="1" label="Radio 1" type="radio" group="RadioGroup"/> <toolbarbutton accesskey="2" label="Radio 2" type="radio" group="RadioGroup"/> <toolbarbutton accesskey="3" label="Radio 3" type="radio" group="RadioGroup"/> </toolbar> 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. autocheck Type: boolean If this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false, the checked state must be adjusted manually. When autocheck is true, the button type should be "checkbox" or "radio". checkState Type: integer, v...
...ache or not. This would be useful if the images are stored remotely or you plan on swapping the image frequently. The following values are accepted, or leave out the attribute entirely for default handling: always The image is always checked to see whether it should be reloaded. never The image will be loaded from the cache if possible. Properties accessKey Type:
character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. autoCheck Type: boolean Gets and sets the value of the autoCheck attribute. checkState Type: integer, values 0, 1, or 2 Gets and sets the value of the checkState attribute. ch...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
Jaxer - Example Application The example application consists of a simple form used to accept comments f...
...)", [ name, email, message ] ); } formProcessor.proxy = true; </script> The first statement which uses the Jaxer.DB namespace creates a new datab...
...)", [ name, email, message ] ); } formProcessor.proxy = true; </script> The first statement which uses the Jaxer.DB namespace creates a new database table in the default SQLite database if it doesn't alrea...
...You can see the field names and data types which ma...
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
nguage) {*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK;} // The rest of the methods can safely return error codes... ...
...} // The rest of the methods can safely return error codes... ...
...SUPPORTS2(nsScriptablePeer, nsITestPlugin, nsIClassInfo) // the following method will be callable from JavaScript NS_IMETHODIMP nsScriptablePeer::NativeMethod() { return NS_OK; } Example 3. ...
...riptablePeer, nsITestPlugin, nsIClassInfo) // the following method will be callable from JavaScript NS_IMETHODIMP nsScriptablePeer::NativeMethod() { return NS_OK; } Example 3. ...
How CSS is structured - Learn web development
le with a .css extension. This is the most common and useful method of bringing CSS to a document. You can link a single CSS file to multiple web pages, styling all of them with the same CSS stylesheet. In the Getting started with CSS, we linked an external stylesheet to our web page. ...
...directory level, then inside a subdirectory called styles --> <link rel="stylesheet" href="../styles/style.css"> Internal stylesheet An internal stylesheet resides within an HTML document. To create an internal stylesheet, you place CSS inside a <style> element contained inside the HTML <head>. The HTML for an internal stylesheet might look like this: <!DOCTYPE html> <html> <head> <meta
charset="utf-8"> <title>My CSS experiment</title> <style> h1 { color: blue; background-color: yellow; border: 1px solid black; } p { color: red; } </style> </head> <body> <h1>Hello World!</h1> <p>This is my first CSS example</p> </body> </html> In some circumstances, internal stylesheets can be useful. For example, per...
... to site maintenance too. With CSS in internal stylesheets, there is the risk that even one simple styling change may require edits to multiple web pages. Inline styles Inline styles are CSS declarations that affect a single HTML element, contained within a style attribute. The implementation of an inline style in an HTML document might look like this: <!DOCTYPE html> <html> <head> <meta
charset="utf-8"> <title>My CSS experiment</title> </head> <body> <h1 style="color: blue;background-color: yellow;border: 1px solid black;">Hello World!</h1> <p style="color:red;">This is my first CSS example</p> </body> </html> Avoid using CSS in this way when possible. It is the opposite of a best practice. First, it is the least efficient implementation of CSS for maintenance. One...
...L body. You may also see a lot of inline styles in HTML email to achieve compatibility with as many email clients as possible. Playing with the CSS in this article For the exercise that follows, create a folder on your computer. You can name the folder whatever you want. ...
Drawing graphics - Learn web development
Note that on each frame we are completely clearing the canvas and redrawing everything. For every ball present we draw it, update its position, and check to see if it is colliding with any other balls. Once you've drawn a graphic to a canvas, there's no way to manipulate that graphic individually li...
...e continuing, which is useful for more advanced applications. Draw the graphics you are animating. Restore the settings you saved in step 2, using restore() Call requestAnimationFrame() to schedule drawing of the next frame of the animation. Note: We won't cover save() and restore() here, but they are explained nicely in our Transformations tutorial (and the ones that follow it). A simple
character animation Now let's create our own simple animation -- we'll get a
character from a certain rather awesome retro computer game to walk across the screen. Make another fresh copy of our canvas template (1_canvas_template.html) and open it in your code editor. Make a copy of walk-right.png in the same directory. At the bottom of the JavaScript, add the following line to once again...
...ting sprite (wrapping to 0 after we're done with sprite #5). This effectively means that we are only updating the sprite on every 13th frame, or roughly about 5 frames a second (requestAnimationFrame() calls us at up to 60 frames per second if possible). We are deliberately slowing down the frame rate because we only have six sprites to work with, and if we display one every 60th of a second, our
character will move way too fast! Inside the outer block we use an if ... else statement to check whether the sprite value is at 5 (the last sprite, given that the sprite numbers run from 0 to 5). If we are showing the last sprite already, we reset sprite back to 0; if not we just increment it by 1. Next we need to work out how to change the posX value on each frame -- add the following code ...
...xt we need to work out how to change the posX value on each frame -- add the following code block just below your last one. if(posX > width/2) { newStartPos = -((width/2) + 102); posX = Math.ceil(newStartPos); console.log(posX); } else { posX += 2; } We are using another if ... else statement to see if the value of posX has become greater than width/2, which means our
character has walked off the right edge of the screen. If so, we calculate a position that would put the
character just to the left of the left side of the screen. If our
character hasn't yet walked off the edge of the screen, we simply increment posX by 2. This will make him move a little bit to the right the next time we draw him. Finally, we need to make the animation loop by calling reque...
Handling text — strings in JavaScript - Learn web development
sglDbl = 'Would you eat a "fish supper"?'; let dblSgl = "I'm feeling blue."; sglDbl; dblSgl; However, you can't include the same quote mark inside the string if it's being used to contain them. The following will error, as it confuses the browser as to where the string ends: let bigmouth = 'I've got no right to take my place...'; This leads us very nicely into our next subject. Escaping
characters in a string To fix our previous problem code line, we need to escape the problem quote mark. Escaping
characters means that we do something to them to make sure they are recognized as text, not part of the code. In JavaScript, we do this by putting a backslash just before the
character. Try this: let bigmouth = 'I\'ve got no right to take my place...'; bigmouth; This works fine. You can ...
...\", and there are some special codes besides. See Escape notation for more details. Concatenating strings Concatenate is a fancy programming word that means "join together". ...
...hat you may come across is template literals (sometimes referred to as template strings). This is a newer syntax that provides more flexible, easier to read strings. Note: Try entering the below examples into your browser's JavaScript console, to see what results you get. To turn a standard string literal into a template literal, you have to replace the quote marks (' ', or " ") with backtick
characters (` `). So, taking a simple example: let song = 'Fight the Youth'; Would be turned into a template literal like so: song = `Fight the Youth`; If we want to concatenate strings, or include expression results inside them, traditional strings can be fiddly to write: let score = 9; let highestScore = 10; let output = 'I like the song "' + song + '". I gave it a score of ' + (score/highestSc...
...ng a simple value in the string. The third one calculates a percentage result and rounds it to the nearest integer. The fourth one includes uses a ternary operator to check whether the score is above a certain mark and print a pass or fail message depending on the result. Another point to note is that if you want to split a traditional string over multiple lines, you need to include a newline
character, \n: output = 'I like the song "' + song + '".\nI gave it a score of ' + (score/highestScore * 100) + '%.'; Template literals respect the line breaks in the source code, so newline
characters are no longer needed. This would achieve the same result: output = `I like the song "${ song }". I gave it a score of ${ score/highestScore * 100 }%.`; We would recommend that you get used to using ...
HTML parser threading
thread, which would lead to all sorts of badness, because nsHtml5StreamParser has fields that hold objects that aren't safe to Release except from the main thread. The runnables use nsHtml5RefPtr<nsHtml5StreamParser>. nsHtml5RefPtr sends runnables back to the main thread to call Release on nsHtml5StreamParser on the main thread. Normal (Non-Speculative) Parsing Initially, DoDataAvailable performs
character encoding sniffing on the data if an encoding wasn't declared on the enclosing protocol (HTTP) level. Once a Unicode decoder has been set up, DoDataAvailable passes the byte data to the decoder whose output is accumulated into a linked list of nsHtml5OwningUTF16Buffer objects. nsHtml5OwningUTF16Buffer objects are then passed to the tokenizer in sequence by the ParseAvailableData() method. The...
... parser owns each nsIContent object it creates by one reference no matter how many copies of the content handle for the node exist inside the parser. (This indeed means that removing parser-created nodes from the DOM during parsing doesn't release memory until the parser stops parsing, which is, in theory, a problem for long polling using HTML in an iframe e.g. for a chat app.) Some tree ops hold
char or PRUni
char arrays. Those arrays are allocated when creating the tree op and delete[]d by the destructor of nsHtml5TreeOperation. Hence, data gets copied to and from these arrays. Executing Tree Ops When the executor flushing runnable fires on the main thread, it calls nsHtml5TreeOpExecutor::RunFlushLoop(). This method returns immediately if another invocation of it is already on the call stack ...
...ing to Use Network-Originating Data After Scripts nsHtml5StreamParser::ContinueAfterScripts runs on the main thread. It acquires mSpeculationMutex in order to be able to touch the queue of speculations. The mutex acquisition only blocks if the parser thread happens to be setting up a new speculation object at the same moment. The first speculation in the speculation queue is examined. If the last
character seen by the document.write() tokenizer was not a carriage return, if the document.write() tokenizer is in the "data" state and if the tree builder state snapshot on the speculation matches the state of the document.write() tree builder, the speculation has succeeded. Otherwise it has failed. If there is more than one speculation in the queue and if the speculation is successful, we can deque...
...luding video poster frames), style sheets and scripts. Additionally, the speculative load queue is used for transferring information from the parser thread to the main thread when the information needs to arrive before starting any speculative loads and when the information is known not to be speculative. There are two such pieces of information: the manifest URL for an App Cache manifest and the
character encoding for the document. ...
NSS Key Log Format
zed builds using the Makefile (those using gyp via build.sh are not affected). Distributors can re-enable it at compile time though (using the NSS_ALLOW_SSLKEYLOGFILE=1 make variable) which is done for the official Firefox binaries. (See bug 1188657.) Notably, Debian does not have this option enabled, see Debian bug 842292. This key log file is a series of lines. Comment lines begin with a sharp
character ('#') and are ignored. Secrets follow the format <Label> <space> <ClientRandom> <space> <Secret> where: <Label> describes the following secret. <ClientRandom> is 32 bytes Random value from the Client Hello message, encoded as 64 hexadecimal
characters. <Secret> depends on the Label (see below). The following labels are defined, followed by a description of the secret: RSA: 48 bytes...
...t <Label> <space> <ClientRandom> <space> <Secret> where: <Label> describes the following secret. <ClientRandom> is 32 bytes Random value from the Client Hello message, encoded as 64 hexadecimal
characters. <Secret> depends on the Label (see below). ...
...tRandom> is 32 bytes Random value from the Client Hello message, encoded as 64 hexadecimal
characters. <Secret> depends on the Label (see below). ...
... For Wireshark usage, see SSL - Wireshark Wiki. ...
NSS Sample Code sample2
ote: IV is only needed if Cipher Blocking Chaining (CBC) mode of encryption * is used * * The recommended approach is to store and transport WRAPPED (encrypted) * DES Keys (IVs can be in the clear). However, it is a common (and dangerous) * practice to use raw DES Keys. This example shows the use of a RAW key. ...
...on * is used * * The recommended approach is to store and transport WRAPPED (encrypted) * DES Keys (IVs can be in the clear). However, it is a common (and dangerous) * practice to use raw DES Keys. This example shows the use of a RAW key. ...
...D (encrypted) * DES Keys (IVs can be in the clear). However, it is a common (and dangerous) * practice to use raw DES Keys. This example shows the use of a RAW key. ...
...2, 0x05, 0x63, 0x6a, 0x31}; unsigned
char gIV[] = {0xe4, 0xbb, 0x3b, 0xd3, 0xc3, 0x71, 0x2e, 0x58}; int main(int argc,
char **argv) { CK_MECHANISM_TYPE cipherMech; PK11SlotInfo* slot = NULL; PK11SymKey* SymKey = NULL; SECItem* SecParam = NULL; PK11Context* EncContext = NULL; SECItem keyItem, ivItem; SECStatus rv, rv1, rv2; unsigned
char data[1024], buf1[1024], buf2[1024]; int i, result_len, tmp1_outlen, tmp2_outlen; /* Initialize NSS * If your application code has already initialized NSS, you can skip it * here. * This code uses the simplest of the Init functions, which does not * require a NSS database to exist */ rv = NSS_NoDB_Init("."); if (rv != SECSuccess) { fprintf(stderr, ...
pkfnc.html
se functions are used for obtaining certificates, keys, and passwords. PK11_FindCertFromNickname PK11_FindKeyByAnyCert PK11_GetSlotName PK11_GetTokenName PK11_IsHW PK11_IsPresent PK11_IsReadOnly PK11_SetPasswordFunc PK11_FindCertFromNickname Finds a certificate from its nickname. Syntax #include <pk11func.h> #include <certt.h> CERTCertificate *PK11_FindCertFromNickname(
char *nickname, void *wincx); Parameters This function has the following parameters: nickname A pointer to the nickname in the certificate database or to the nickname in the token. wincx A pointer to application data for the password callback function. This pointer is set with SSL_SetPKCS11P...
... Description When you are finished with the private key structure returned by PK11_FindKeyByAnyCert, you must free it by calling SECKEY_DestroyPrivateKey. The PK11_FindKeyByAnyCert function calls the password callback function set with PK11_SetPasswordFunc and passes it the pointer specified by the wincx parameter. PK11_GetSlotName Gets the name of a slot. Syntax #include <pk11func.h>
char *PK11_GetSlotName(PK11SlotInfo *slot); Parameters This function has the following parameter: slot A pointer to a slot info structure. Returns The function returns one of these values: If successful, a pointer to the name of the slot (a string). If unsuccessful, NULL. Description If the slot is freed, the string w...
...eturns one of these values: If successful, a pointer to the name of the slot (a string). If unsuccessful, NULL. Description If the slot is freed, the string with the slot name may also be freed. If you want to preserve it, copy the string before freeing the slot. Do not try to free the string yourself. PK11_GetTokenName Gets the name of the token. Syntax #include <pk11func.h>
char *PK11_GetTokenName(PK11SlotInfo *slot); Parameters This function has the following parameter: slot A pointer to a slot info structure. Returns The function returns one of these values: If successful, a pointer to the name of the token (a string). If unsuccessful, NULL. Description If the slot is freed, the string...
...d or soft token) to access protected information, such as a private key. Such information is protected with a password that can be retrieved by calling an application-supplied callback function. The callback function is identified in a call to PK11_SetPasswordFunc that takes place during NSS initialization. The callback function set up by PK11_SetPasswordFunc has the following prototype: typedef
char *(*PK11PasswordFunc)( PK11SlotInfo *slot, PRBool retry, void *arg); This callback function has the following parameters: slot A pointer to a slot info structure. retry Set to PR_TRUE if this is a retry. This implies that the callback has previously returned the wrong password. ...
sslcrt.html
ns require a PIN argument (see SSL_SetPKCS11PinArg for details), which must be specified in the wincx parameter. To obtain the value to pass in the wincx parameter, call SSL_RevealPinArg. CERT_VerifyCertName Compares the common name specified in the subject DN for a certificate with a specified hostname. Syntax #include <cert.h> SECStatus CERT_VerifyCertName( CERTCertificate *cert,
char *hostname); Parameters This function has the following parameters: cert A pointer to the certificate against which to check the hostname referenced by hostname. hostname The hostname to be checked. Returns The function returns one of these values: If the common name ...
...he certificate is not identical to the domain name passed in the hostname parameter, SECFailure. Use PR_GetError to obtain the error code. Description The comparison performed by CERT_VerifyCertName is not a simple string comparison. ...
... the domain name passed in the hostname parameter, SECFailure. Use PR_GetError to obtain the error code. Description The comparison performed by CERT_VerifyCertName is not a simple string comparison. ...
.... Description The comparison performed by CERT_VerifyCertName is not a simple string comparison. Instead, it takes account of the following rules governing the construction of common names in SSL server certificates: * matches anything ? matches one
character \ escapes a special
character $ matches the end of the string [abc] matches one occurrence of a, b, or c. The only
character that needs to be escaped in this is ], all others are not special. [a-z] matches any
character between a and z [^az] matches any
character except a or z ~ followed by another shell expression removes any pattern matching the shell expression from the match list (foo|bar) matches either the substring foo or the substring bar. These can be shell expressions as well. CERT_Ch...
NSS tools : signtool
ey is used to create digital signatures. For testing purposes only, you can create an object-signing certificate with Netscape Signing Tool 1.3. When testing is finished and you are ready to disitribute your software, you should obtain an object-signing certificate from one of two kinds of sources: * An independent certificate authority (CA) that authenticates your identity and
charges you a fee. You typically get a certificate from an independent CA if you want to sign software that will be distributed over the Internet. * CA server software running on your corporate intranet or extranet. Netscape Certificate Management System provides a complete management solution for creating, deploying, and managing certificates, including CAs that issue object-signin...
...when you run the command with the -G option. However, all of the requested fields are optional for test certificates. If you do not enter a common name, the tool provides a default name. In the following example, the user input is in boldface: signtool -G MyTestCert using certificate directory: /u/someuser/.netscape Enter certificate information. All fields are optional. ...
...G MyTestCert using certificate directory: /u/someuser/.netscape Enter certificate information. All fields are optional. Acceptable
characters are numbers, letters, spaces, and apostrophes. certificate common name: Test Object Signing Certificate organization: Netscape Communications Corp. organization unit: Server Products Division state or province: California country (must be exactly 2
characters): US username: someuser email address: someuser@netscape.com Enter Password or Pin for "Communicator Certificate DB": [Password will not echo] generated public/private key pair certificate request generated certificate has been signed certificate "MyTestCert" added to database Exported certificate to x509.raw and x509.cacert. The certificate information is read from standard inp...
..."MyTestCert" added to database Exported certificate to x509.raw and x509.cacert. The certificate information is read from standard input. Therefore, the information can be read from a file using the redirection operator (<) in some operating systems. To create a file for this purpose, enter each of the seven input fields, in order, on a separate line. Make sure there is a newline
character at the end of the last line. Then run signtool with standard input redirected from your file as follows: signtool -G MyTestCert inputfile The prompts show up on the screen, but the responses will be automatically read from the file. The password will still be read from the console unless you use the -p option to give the password on the command line. Using the -M Option to...
JSFunctionSpec
call JSNativeWrapper The built-in JS call wrapped by this function. If the function does not wrap a native JS call, set this value to NULL. nargs uint16_t The value used for Function.length. This no longer guarantees anything about the vp array. ...
... call JSNativeWrapper The built-in JS call wrapped by this function. If the function does not wrap a native JS call, set this value to NULL. nargs uint16_t The value used for Function.length. This no longer guarantees anything about the vp array. ...
...tion's name. call JSNativeWrapper The built-in JS call wrapped by this function. If the function does not wrap a native JS call, set this value to NULL. nargs uint16_t The value used for Function.length. This no longer guarantees anything about the vp array. flags uint16_t The bitwise OR of any number of function flags. selfHostedName const
char * The function's name in Self-Hosted JavaScript code. Description JSFunctionSpec defines the attributes for a single JS function to associate with an object. An application typically has an array of JSFunctionSpec to define all the functions for an object and calls JS_DefineFunctions or JS_InitClass to create the functions and assign them to an object. JSFunctionSpec can also be used to ...
...plication typically has an array of JSFunctionSpec to define all the functions for an object and calls JS_DefineFunctions or JS_InitClass to create the functions and assign them to an object. JSFunctionSpec can also be used to define an array element rather than a named property. Array elements are actually individual properties. To define an array element, cast the element's index value to const
char*, initialize the name field with it, and specify the JSPROP_INDEX attribute in flags. To define an array of JSPropertySpec, use JS_FS, JS_FN, JS_SYM_FN, JS_FNINFO, JS_SELF_HOSTED_FN, JS_SELF_HOSTED_SYM_FN, JS_SYM_FNSPEC, JS_FNSPEC, and JS_FS_END. See Also MXR ID Search for JSFunctionSpec JSPropertySpec JSNative JS_FS JS_FN JS_SYM_FN JS_FNINFO JS_SELF_HOSTED_FN JS_SELF_HOSTED_SYM_FN JS_...
JS_CompileFunction
Obsolete since JSAPI 36This 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. Creates a JavaScript function from a text string. Syntax JSFunction * JS_CompileFunction(JSContext *cx, JSObject *obj, const
char *name, unsigned int nargs, const
char **argnames, const
char *body, size_t length, const
char *filename, unsigned int lineno); JSFunction * JS_CompileUCFunction(JSContext *cx, JSObject *obj, const
char *name, unsigned int nargs, const
char **argnames, const js
char *body, size_t length, const
char *filename, unsigned int lineno); Name Type Description cx JSContext * The context in which to compile the function. Require...
...es, const js
char *body, size_t length, const
char *filename, unsigned int lineno); Name Type Description cx JSContext * The context in which to compile the function. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object with which the function is associated. name const
char * Name to assign the newly compiled function. nargs unsigned int Number of arguments to pass to the function. argnames const
char ** Names to assign to the arguments passed to the function. body const
char * or const js
char * String containing the body of the function to compile. length size_t The length, in
characters, of body. ...
...Used to report filename or URL in error messages. lineno unsigned int Line number. Used to report the offending line in the file or URL if an error occurs. ...
...on. name is the name to assign to the newly created function. nargs is the number of arguments the function takes, and argnames is a pointer to the first element of an array of names to assign each argument. The number of argument names should match the number of arguments specified in nargs. body is a string containing the source code of the function. length is the length of the source code in
characters. filename is the name of the file (or URL) containing the function. This information is used in error messages if an error occurs during compilation. Similarly, lineno is used to report the line number where an error occurred during compilation. If both obj and name are non-null, the new function becomes a method of obj. (A new property is defined on obj with the given name and the new Fu...
JS_DeleteProperty
Removes a specified property from an object. ...
... Removes a specified property from an object. ...
...Requires request. ...
...ize_t namelen, JS::ObjectOpResult &result); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object from which to delete a property. name or id const
char * or jsid or const
char16_t * Name of the property to delete. namelen size_t (only in JS_DeleteUCProperty) The length of name in
characters; or -1 to indicate that name is null-terminated. result JS::ObjectOpResult & (out parameter) Receives the result of the operation. Description JS_DeleteProperty removes a specified property, name, from an object, ...
JS_GetOwnPropertyDescriptor
Requires request. ...
...nPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const
char *name, JS::MutableHandle<JSPropertyDescriptor> desc); bool JS_GetOwnPropertyDescriptorById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc); bool JS_GetOwnUCPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const
char16_t *name, JS::MutableHandle desc); // Added in SpiderMonkey 45 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
... desc JS::MutableHandle<JSPropertyDescriptor> Out parameter. On success, if no property is found, desc->obj is set to NULL. If a property is found, *desc receives a description of it. ...
...r16_t *name, JS::MutableHandle desc); // Added in SpiderMonkey 45 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject The object to search for the property. id const
char * or JS::HandleId or const
char16_t The name of the property to look up. desc JS::MutableHandle<JSPropertyDescriptor> Out parameter. On success, if no property is found, desc->obj is set to NULL. If a property is found, *desc receives a description of it. Description JS_GetOwnPropertyDescriptor and JS_GetOwnPropertyDescriptorById get a detailed description of that property (returned in desc->obj)...
JS_LookupProperty
Obsolete since JSAPI 37This 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. Determine if a specified property exists. ...
...lete. 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. Determine if a specified property exists. ...
... JS_LookupPropertyById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp); // Added in SpiderMonkey 1.8.1 bool JS_LookupElement(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleValue vp); // ---- Obsolete since SpiderMonkey 31 ---- bool JS_LookupPropertyWithFlags(JSContext *cx, JS::HandleObject obj, const
char *name, unsigned flags, JS::MutableHandleValue vp); bool JS_LookupPropertyWithFlagsById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned flags, JS::MutableHandleObject objp, JS::MutableHandleValue vp); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * Pointer to a JS context fr...
...ct objp, JS::MutableHandleValue vp); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object to search on for the property. name or id const
char * or const
char16_t *or JS::HandleId Name of the property to look up. namelen size_t (only in JS_LookupUCProperty) The length of name in
characters; or -1 to indicate that name is null-terminated. flags unsigned (only in JS_LookupPropertyWithFlags) A combination of bits requesting special search behavior. See Flags below. objp JS::MutableHandleObject ...
JS_NewExternalString
Create a new JSString whose
characters are stored in external memory. Syntax JSString * JS_NewExternalString(JSContext *cx, const
char16_t *
chars, size_t length, const JSStringFinalizer *fin); JSString * JS_NewExternalStringWithClosure(JSContext *cx, js
char *
chars, size_t length, int type, void *closure); // Obsolete since JSAPI 13 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.
chars const
char16_t * or const js
char * Pointer to the first element of an array of
char16_ts. This array is used as the
character buffer of the JSString to be created. The array must...
... 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.
chars const
char16_t * or const js
char * Pointer to the first element of an array of
char16_ts. This array is used as the
character buffer of the JSString to be created. The array must be populated with the desired
character data before JS_NewExternalString is called, and the array must remain in memory, with its contents unchanged, for as long as the JavaScript engine needs to hold on to it. (Ultimately, the string will be garbage collected, and the JavaScript engine will call the string finalizer callback, allowing the application to free the array.) The array does not need to be zero-terminated. leng...
...alString is called, and the array must remain in memory, with its contents unchanged, for as long as the JavaScript engine needs to hold on to it. (Ultimately, the string will be garbage collected, and the JavaScript engine will call the string finalizer callback, allowing the application to free the array.) The array does not need to be zero-terminated. length size_t The number of
characters in the array
chars. fin JSStringFinalizer A string finalizer the JavaScript engine should use (later) to free the string buffer
chars. Added in SpiderMonkey 17 type int (JS_NewExternalStringWithClosure only) Indicates which string finalizer callback the JavaScript engine should use (later) to free the string buffer
chars. This must be an id number previously re...
...wExternalStringWithClosure only) Arbitrary, application-defined data to include in the string object after it's created. If you use this as a pointer, you should clean it up in the external string finalizer that was previously set up using JS_AddExternalStringFinalizer. Obsolete since JSAPI 13 Description JS_NewExternalString and JS_NewExternalStringWithClosure create a new JSString whose
characters are stored in external memory, i.e., memory allocated by the application, not the JavaScript engine. Since the program allocated the memory, it will need to free it; this happens in an external string finalizer indicated by the type parameter. JS_NewExternalStringWithClosure works similarly, except it accepts an additional parameter, closure, which is saved in the string's internal data st...
JS_NewRegExpObject
Create a new RegExp object. Syntax JSObject * JS_NewRegExpObject(JSContext *cx, JS::HandleObject obj, const
char *bytes, size_t length, unsigned flags); JSObject * JS_NewUCRegExpObject(JSContext *cx, JS::HandleObject obj, const
char16_t *
chars, size_t length, unsigned flags); JSObject * JS_NewRegExpObjectNoStatics(JSContext *cx,
char *bytes, size_t length, unsigned flags); JSObject * JS_NewUCRegExpObjectNoStatics(JSContext *cx,
char16_t *
chars, size_t length, unsigned flags); Name Type Description cx JSContext * The context in which to create the new object. Requires request. In a JS_THREADSAFE build, the caller m...
... flags unsigned Regular expression flags. See below. Flags Name Description RegExp constructor flag JSREG_FOLD Fold uppercase to lowercase. ...
... flags unsigned Regular expression flags. See below. Flags Name Description RegExp constructor flag JSREG_FOLD Fold uppercase to lowercase. ...
...s, size_t length, unsigned flags); Name Type Description cx JSContext * The context in which to create the new object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject A pointer to a global object. bytes or
chars const
char * or const
char16_t * A pointer to the string that contains a regular expression. length size_t The length of bytes or
chars, in
characters. flags unsigned Regular expression flags. See below. Flags Name Description RegExp constructor flag JSREG_FOLD Fold uppercase to lowercase. i JSREG_GLOB Global execution, creates array of matc...
JS_NewUCString
Note: JS_NewString() was removed in SpiderMonkey 1.8.5. Use JS_NewStringCopyN and JS_NewUCStringCopyN instead. Syntax JSString * JS_NewUCString(JSContext *cx,
char16_t *
chars, size_t length); JSString * JS_NewString(JSContext *cx,
char *buf, size_t length); // Obsolete since JSAPI 1.8.5 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. buf
char * or
char16_t * Pointer to a
character array, allocated with JS_malloc, containing the
characters for the JS string to create. The JavaScript engine adopts the buffer. length size_t Number of
characters in the text string. Description JS_NewString...
...On success, the JavaScript engine adopts responsibility for memory management of this region. The application must not read, write, or free the buffer. This allows the JavaScript engine to avoid needless data copying. ...
...On success, the JavaScript engine adopts responsibility for memory management of this region. The application must not read, write, or free the buffer. This allows the JavaScript engine to avoid needless data copying. On success, JS_NewString and JS_NewUCString return a pointer to the new string. ...
...ript engine adopts responsibility for memory management of this region. The application must not read, write, or free the buffer. This allows the JavaScript engine to avoid needless data copying. ...
JS_SetPropertyAttributes
Obsolete since JSAPI 26This 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. Set the attributes for a specified property. Syntax JSBool JS_SetPropertyAttributes(JSContext *cx, JSObject *obj, const
char *name, unsigned int attrs, JSBool *foundp); JSBool JS_SetUCPropertyAttributes(JSContext *cx, JSObject *obj, const js
char *name, size_t namelen, unsigned int attrs, JSBool *foundp); Name Type Description cx JSContext * The context in which to set the property attributes. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object for which to set property attributes. ...
... attrs unsigned int Attribute values to set. foundp JSBool * Out parameter. Flag indicating whether or not the specified property was located. ...
...ar *name, size_t namelen, unsigned int attrs, JSBool *foundp); Name Type Description cx JSContext * The context in which to set the property attributes. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object for which to set property attributes. name const
char * or const js
char * Name of the property for which to set attributes. namelen size_t (in JS_SetUCPropertyAttributes only) The length of name, in
characters. attrs unsigned int Attribute values to set. foundp JSBool * Out parameter. Flag indicating whether or not the specified property was located. Description JS_SetPropertyAttributes sets the attributes for a...
...following values: Flag Purpose JSPROP_ENUMERATE Property is visible in for and in loops. JSPROP_READONLY Property is read only. JSPROP_PERMANENT Property cannot be deleted. JSPROP_EXPORTED Property can be imported by other objects. JSPROP_INDEX Property is actually an index into an array of properties, and is cast to a const
char *. If JS_SetPropertyAttributes cannot locate an object with the specified property, it returns JS_FALSE, and the value left in *foundp is undefined. If the specified property or the specified object does not exist, foundp is set to JS_FALSE. Then, if the property exists, but is associated with a different object, JS_SetPropertyAttributes returns JS_TRUE. Otherwise, it sets foundp to JS_TR...
SpiderMonkey 1.8.7
iptForPrincipalsVersion JS_EvaluateUCScriptForPrincipalsVersion JS_ExecuteRegExp JS_ExecuteRegExpNoStatics JS_ExecuteScriptVersion JS_FORGET_STRING_FLATNESS JS_FileEscapedString JS_FinishJSONParse (removed in future releases, replaced with JS_ParseJSON) JS_FlatStringEqualsAscii JS_FlattenString JS_FlushCaches JS_FreezeObject JS_GetCompartmentPrivate JS_GetEmptyString JS_GetFlatString
Chars JS_GetGCParameter JS_GetGCParameterForThread JS_GetGlobalForScopeChain JS_GetInternedString
Chars JS_GetInternedString
CharsAndLength JS_GetOwnPropertyDescriptor JS_GetPropertyAttrsGetterAndSetterById JS_GetPropertyById JS_GetPropertyByIdDefault JS_GetPropertyDefault JS_GetPropertyDescriptorById JS_GetRuntimeSecurityCallbacks JS_GetSecurityCallbacks JS_GetString
CharsAndLength JS_Get...
...GetGCParameter JS_GetGCParameterForThread JS_GetGlobalForScopeChain JS_GetInternedString
Chars JS_GetInternedString
CharsAndLength JS_GetOwnPropertyDescriptor JS_GetPropertyAttrsGetterAndSetterById JS_GetPropertyById JS_GetPropertyByIdDefault JS_GetPropertyDefault JS_GetPropertyDescriptorById JS_GetRuntimeSecurityCallbacks JS_GetSecurityCallbacks JS_GetString
CharsAndLength JS_GetString
CharsZ JS_GetString
CharsZAndLength JS_GetStringEncodingLength JS_HasPropertyById JS_InitCTypesClass JS_InternJSString JS_IsConstructing_PossiblyWithGivenThisObject JS_IsExtensible JS_IsInRequest JS_LeaveCrossCompartmentCall JS_LookupPropertyById JS_LookupPropertyWithFlagsById JS_New JS_NewCompartmentAndGlobalObject JS_NewDateObject JS_NewDateObjectMsec JS_NewFunctionById body New C++...
...ing API which was introduced in bug 565157. A conservative stack-scanning collector was also added for SpiderMonkey 1.8.5, making the *LocalRootScope APIs obsolete; they are now NOPs. Bug 614138 introduces a C++ JS::Anchor<> template class to help tie lexical scope to the conservative GC for cases where the compiler might optimize away important stack/register roots (such as when we access the js
chars in a JSString). A C analogue, JS_AnchorPtr, was introduced with bug 630209. Bug 630209 also removed the need for JS_NewScriptObject, by modifying the script compilation interfaces to handle the creation and management of the object wrapper directly; similarly, the script execution interfaces now accept a JSObject pointer than a pointer to JSScript. Affected interfaces are: JS_CompileScript ...
...Constructing, used to differentiate between calls to native constructors with and without the new keyword, now takes a pointer to the native's vp, along with the native's context pointer, to figure out how the function was called. Strings JS_CompareStrings received a new function signature with bug 609440, allowing us to correctly propagate exceptions when the underlying functions to retrieve the
characters in the string failed. Additionally, JS_NewString, JS_GetStringBytes, and JS_GetString
Chars were removed, replaced by fallible interfaces like JS_GetString
CharsZAndLength and JS_EncodeStringToBuffer (not an exhaustive list). Numbers SpiderMonkey 1.8.5 now stores integers up to 32-bits in the jsval. This means that the INT_FITS_IN_JSVAL macro is always returns true (be careful to only use th...
Finishing the Component
stered as a category to receive startup notification. This time, the category name to use is "content-policy". ...
...e category name to use is "content-policy". ...
...lt rv; nsCOMPtr<nsIServiceManager> servman = do_QueryInterface((nsISupports*)aCompMgr, &rv); if (NS_FAILED(rv)) return rv; nsCOMPtr<nsICategoryManager> catman; servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID, NS_GET_IID(nsICategoryManager), getter_AddRefs(catman)); if (NS_FAILED(rv)) return rv;
char* previous = nsnull; rv = catman->AddCategoryEntry("xpcom-startup", "WebLock", WebLock_ContractID, PR_TRUE, PR_TRUE, &previous); if (previous) nsMemory::Free(previous); rv = catman->AddCategoryEntry("content-policy", ...
...you'll recall is a string class that many of the Gecko APIs require. See String Classes in XPCOM for more information about strings. Once the URL string is wrapped in a nsEmbedCString, it can be passed to the method NewURI. This method expects to parse the incoming string and create an object which implements an nsIURI interface. The two nsnull parameters passed to NewURI are used to specify the
charset of the string and any base URI to use, respectively. We are assuming here that the
charset of the URL string is UTF-8, and also assuming that every URL string is absolute. See the intro to the HTML 4 specification for more information about relative URLs. Here is the complete implementation of the ShouldLoad() method: NS_IMETHODIMP WebLock::ShouldLoad(PRInt32 contentType, ...
mozIJSSubScriptLoader
bscript-loader;1. To get this service, use: var mozIJSSubScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getService(Components.interfaces.mozIJSSubScriptLoader); Note: See Components.utils.import for another way to import JavaScript code. Method overview jsval loadSubScript(in string url, in Object targetObj Optional, in string
charset Optional); jsval loadSubScriptWithOptions(in string url, in Object options); Methods loadSubScript() Synchronously loads and executes the script from the specified URL. As of Gecko 8.0, scripts are loaded from the startup cache where possible. The loaded script is executed with the principal associated with the target object. Any top-level functions or variables created by...
...es of the targetObj target object (but things declared via let and const are NOT). Additionally, properties of the targetObj target object can be referred to as variables in the loaded script. If the script returns a value, it will be returned by this method. Note: This method must only be called from JavaScript! jsval loadSubScript( in string url, in Object targetObj Optional, in string
charset Optional, ); Example let context = {}; Services.scriptloader.loadSubScript("chrome://my-package/content/foo-script.js", context, "UTF-8" /* The script's encoding */); Parameters url The URL pointing to the script to load. It must be a local chrome:, resource: or file: URL (see bug 307686 and bug 418356). Note: In versions of Gecko prior to Geck...
...at let and const declarations in the script will be placed on a syntactic scope that is not an object at all, and will not be available to the caller of loadSubScript. Note: Undeclared variables in the loaded script will be created as global variables in the caller (ie.: in the caller's global object). This object will be searched for variables that cannot be resolved in the subscript scope.
charset An optional string to specify the
character encoding of the file. If absent, the file is interpreted as ASCII. loadSubScriptWithOptions() Same as loadSubScript(), except that parameters after url are expressed as an object, and a new ignoreCache option is available. Note: This method must only be called from JavaScript! jsval loadSubScriptWithOptions( in string url, in Object option...
...scription target object The object to use as the scope object for the script being executed. It defaults to the global object of the caller. Note: Undeclared variables in the loaded script will be created as global variables in the caller (ie.: in the caller's global object). This object will be searched for variables that cannot be resolved in the subscript scope.
charset string An optional string to specify the
character encoding of the file. If absent, the file is interpreted as ASCII. ignoreCache boolean If present and set to true, the cache will be bypassed when reading the file. See also Appendix D: Loading Scripts ...
mozITXTToHTMLConv
aStartPos, out long aEndPos) wstring scanHTML(in wstring text, in unsigned long whattodo) wstring scanTXT(in wstring text, in unsigned long whattodo) Constants Conversion control attributes These bits allow you to control the conversion of text into HTML. Constant Type Description kEntities unsigned long Enables conversion of basic special
characters to HTML entities. This applies to "<", "&", and ">" (which are converted to <, &, and >, respectively). kGlyphSubstitution unsigned long Enables conversion of smilies and non-ASCII special
characters. kStructPhrase unsigned long Enables conversion of text attributes, such as converting "*some text*" to boldfaced "some text" by wrapping in the HTML <st...
...hattodo ); Parameters text The original, user-edited HTML. whattodo A bit field composed of the Conversion control attributes indicating what conversions to apply. Return value A normalized version of the original HTML string. citeLevelTXT() Returns the "cite level" of the specified text; that is, it indicates how many levels of email reply quotes are used, when the text uses "quote"
characters (such as ">") at the beginning of the line to indicate cite levels. unsigned long citeLevelTXT( in wstring line, out unsigned long logLineStart ); Parameters line The original line of text, which may begin with one or more cite
characters such as ">". logLineStart On output, this parameter is set to indicate the offset into the string of the first non-cite
character. You must s...
...unsigned long logLineStart ); Parameters line The original line of text, which may begin with one or more cite
characters such as ">". logLineStart On output, this parameter is set to indicate the offset into the string of the first non-cite
character. You must set this value to zero before calling this method. Return value The cite level of the quote; that is, the number of text quote
characters found at the beginning of the string. findURLInPlaintext() Returns the start and end offsets of the first URL found in a substring. ...
...t quote
characters found at the beginning of the string. findURLInPlaintext() Returns the start and end offsets of the first URL found in a substring. void findURLInPlaintext( in wstring text, in long aLength, in long aPos, out long aStartPos, out long aEndPos ); Parameters text The string to scan for the presence of a URL. aLength The length of the buffer to scan. aPos The
character offset into the string at which to begin the scan. aStartPos On return, indicates the offset to the first
character of the first found URL, or -1 if no URL was found. aEndPos On return, indicates the offset to the last
character of the first found URL, or -1 if no URL was found. Remarks You can call this method repeatedly, passing in updated values for aPos, to locate all the URLs in ...
nsIContentSniffer
classes of nsIRequest might offer. ACString getMIMETypeFromContent( in nsIRequest aRequest, [const,array,size_is(aLength)] in octet aData, in unsigned long aLength ); Parameters aRequest The request where this data came from. May be null. aData Data to check. aLength Length of the data. Return value The content type. Example How to read content from aData. ...
..., [const,array,size_is(aLength)] in octet aData, in unsigned long aLength ); Parameters aRequest The request where this data came from. May be null. aData Data to check. aLength Length of the data. Return value The content type. Example How to read content from aData. ...
...ta, in unsigned long aLength ); Parameters aRequest The request where this data came from. May be null. aData Data to check. aLength Length of the data. Return value The content type. Example How to read content from aData. ...
...as been removed, see Bug 910192
charset = Services.prefs.getComplexValue("intl.
charset.default", Ci.nsIPrefLocalizedString).data; } catch (e) { } let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"] .createInstance(Ci.nsIScriptableUnicodeConverter); conv.
charset =
charset; try { let str = conv.convertFromByteArray(aData, aLength); if (str.substring(0, 5) == "%PDF-") return "application/pdf"; // we detected a pdf file } catch (e) { // try to get information from aRequest } ...
nsIDOMSerializer
herits from: nsISupports Last changed in Gecko 1.7 Implemented by: @mozilla.org/xmlextras/xmlserializer;1. To create an instance, use: var domSerializer = Components.classes["@mozilla.org/xmlextras/xmlserializer;1"] .createInstance(Components.interfaces.nsIDOMSerializer); Method overview void serializeToStream(in nsIDOMNode root, in nsIOutputStream stream, in AUTF8String
charset); AString serializeToString(in nsIDOMNode root); Methods serializeToStream() The subtree rooted by the specified element is serialized to a byte stream using the
character set specified. void serializeToStream( in nsIDOMNode root, in nsIOutputStream stream, in AUTF8String
charset ); Parameters root The root of the subtree to be serialized. This could be any node, including a Docum...
... serializeToString() The subtree rooted by the specified element is serialized to a string. ...
... serializeToString() The subtree rooted by the specified element is serialized to a string. ...
... serializeToString() The subtree rooted by the specified element is serialized to a string. AString serializeToString( in nsIDOMNode root ); Parameters root The root of the subtree to be serialized. This could be any node, including a Document. ...
nsIEffectiveTLDService
hostname in aURI is empty. NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS This exception is thrown if there were insufficient subdomain levels in the hostname to satisfy the requested aAdditionalParts value. NS_ERROR_HOST_IS_IP_ADDRESS This exception is thrown if aURI is a numeric IPv4 or IPv6 address. NS_ERROR_UNEXPECTED Or other error returned by nsIIDNService.normalize() when the hostname contains
characters disallowed in URIs. getBaseDomainFromHost() Returns the base domain of a host string. Otherwise identical to getBaseDomain(). Note: It is strongly recommended that you use getBaseDomain() if a suitable nsIURI is available. Only use this method if this is not the case. ACString getBaseDomainFromHost( in AUTF8String aHost, in PRUint32 aAdditionalParts Optional ); Parameters aHo...
...f domain name parts to be returned in addition to the public suffix. Return value An ACString containing the base domain (public suffix plus the requested number of additional parts). Exceptions thrown NS_ERROR_INVALID_ARG This exception is thrown if aHost is empty. NS_ERROR_UNEXPECTED This exception originates in the Normalize() method in nsIIDNService and is thrown when aHost contains
characters disallowed in URIs. NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS This exception is thrown if there were insufficient subdomain levels in the hostname to satisfy the requested aAdditionalParts value. NS_ERROR_HOST_IS_IP_ADDRESS This exception is thrown if aHost is a numeric IPv4 or IPv6 address. Remarks Note: Prior to Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), this method worked...
...eters aURI The URI to be analyzed. Return value An ACString containing the public suffix. Exceptions thrown NS_ERROR_INVALID_ARG This exception is thrown if the hostname in aURI is empty. NS_ERROR_HOST_IS_IP_ADDRESS This exception is thrown if aURI is a numeric IPv4 or IPv6 address. NS_ERROR_UNEXPECTED Or other error returned by nsIIDNService.normalize() when the hostname contains
characters disallowed in URIs. getPublicSuffixFromHost() Returns the public suffix of a host string. Otherwise identical to getPublicSuffix(). Note: It is strongly recommended to use getBaseDomain() if a suitable nsIURI is available. Only use this method if this is not the case. ACString getPublicSuffixFromHost( in AUTF8String aHost ); Parameters aHost The host string to be analyzed. Re...
...ot the case. ACString getPublicSuffixFromHost( in AUTF8String aHost ); Parameters aHost The host string to be analyzed. Return value An ACString containing the public suffix. Exceptions thrown NS_ERROR_INVALID_ARG This exception is thrown if aHost is empty. NS_ERROR_UNEXPECTED This exception originates in the Normalize() method in nsIIDNService and is thrown when aHost contains
characters disallowed in URIs. NS_ERROR_HOST_IS_IP_ADDRESS This exception is thrown if aHost is a numeric IPv4 or IPv6 address. Remarks All returned strings are encoded in ASCII/ACE and normalized according to RFC 3454. ...
nsIInputStream
nd thread to avoid locking up the main application thread. For this reason, it is generally the case that a blocking input stream should be implemented using thread-safe AddRef and Release. Method overview unsigned long available();Deprecated since Gecko 17.0 unsigned long long available(); void close(); boolean isNonBlocking(); unsigned long read(in
charPtr aBuf, in unsigned long aCount); Native code only! unsigned long readSegments(in nsWriteSegmentFun aWriter, in voidPtr aClosure, in unsigned long aCount); Native code only! Methods available() Determine number of bytes available in the stream. In addition to the number of bytes available in the stream, this method also informs the caller of the current status of the stream. A...
...eadSegments() to return 0 bytes read to indicate end-of-file. Note: The close method may be called more than once, but subsequent calls are ignored. void close(); Parameters None. isNonBlocking() boolean isNonBlocking(); Parameters None. Return value true if stream is non-blocking. Native code only!read This method copies data from the stream into a buffer. unsigned long read( in
charPtr aBuf, in unsigned long aCount ); Parameters aBuf The buffer into which the data from the stream is copied. aCount The size of the buffer, or the maximum number of bytes to copy from the stream. Return value This method returns the number of bytes copied from the stream (may be less than aCount). It returns 0 to indicate end-of-file. Exceptions thrown <other-error> On failure.
...rnal buffer that can be accessed directly. NS_BASE_STREAM_WOULD_BLOCK Indicates that reading from the input stream would block the calling thread for indeterminate amount of time. This exception may only be thrown if isNonBlocking() returns true. Example Consume all data from an input stream using read(). nsresult ConsumeStream(nsIInputStream* aStream) { nsresult rv; uint32_t numRead;
char buf[512]; while (1) { rv = aStream->Read(buf, sizeof(buf), &numRead); if (NS_FAILED(rv)) { printf("### error reading stream: %x\n", rv); break; } if (numRead == 0) break; // buf now contains numRead bytes of data } return rv; } Consume all data from an input stream using readSegments(). static NS_METHOD AppendSegment(nsIInputStream* aStream,...
...f (NS_FAILED(rv)) { printf("### error reading stream: %x\n", rv); break; } if (numRead == 0) break; // buf now contains numRead bytes of data } return rv; } Consume all data from an input stream using readSegments(). static NS_METHOD AppendSegment(nsIInputStream* aStream, void* aClosure, const
char* aFromSegment, uint32_t aToOffset, uint32_t aCount, uint32_t* aWriteCount) { // aFromSegment now contains aCount bytes of data. nsACString* pBuf = (nsACString*) aClosure; pBuf->Append(aFromSegment, aCount); // Indicate that we have consumed all of aFromSegment *aWriteCount = aCount; return N...
nsIOutputStream
ean isNonBlocking(); Parameters None. Return value true if stream is non-blocking. Exceptions thrown NS_BASE_STREAM_WOULD_BLOCK A non-blocking stream may throw this exception when written to if space for the data is not immediately available. write() This method copies data from a buffer into the stream. Note: Though this method is scriptable, JavaScript code must only pass an ASCII
character string as the aBuf parameter. C++ code may however pass any arbitrary binary data, including data with embedded null bytes. unsigned long write( in string aBuf, in unsigned long aCount ); Parameters aBuf The buffer containing the data to be written. aCount The size of the buffer, or the maximum number of bytes to copy from the buffer. Return value This method returns the numb...
... required to implement this method. In some contexts, writeFrom may be guaranteed to be implemented, but in general it is not. This method serves as an optimization. Note: This method is defined by this interface in order to allow the output stream to efficiently copy the data from the input stream into its internal buffer (if any). If this method was provided as an external facility, a separate
char* buffer would need to be used in order to call the output stream's other Write() method. unsigned long writeFrom( in nsIInputStream aFromStream, in unsigned long aCount ); Parameters aFromStream An nsIInputStream containing the data to be written. aCount The maximum number of bytes to write to the stream. Return value This method returns the number of bytes written to the stream (...
...time. This exception may only be thrown if isNonBlocking() returns true. NS_ERROR_NOT_IMPLEMENTED Indicates that the stream does not have an internal buffer that can be written to directly. ...
...HOD CopySegment(nsIInputStream* aStream, void* aClosure,
char* aToSegment, PRUint32 aFromOffset, PRUint32 aCount, PRUint32* aReadCount) { // aFromSegment now contains aCount bytes of data. nsACString* pBuf = (nsACString*) aClosure; const
char* data; PRUint32 len = NS_CStringGetData(&data); data += aFromOffset; len -= aFromOffset; if (len > aCount) len = aCount; memcpy(aToSegment, data, len); // Indicate that we have copied len bytes to the segment *aReadCount = len; return NS_OK; } // Write the contents of aSource into aStream, using WriteSegments // to avoid intermediate buffer copies. nsresult Wr...
nsIPluginHost
Obsolete since Gecko 1.8 void instantiateFullPagePlugin(in string aMimeType, in nsIURI aURI, in nsIPluginInstanceOwner aOwner, out nsIStreamListener aStreamListener); Native code only! nsIStreamListener instantiatePluginForChannel(in nsIChannel aChannel, in nsIPluginInstanceOwner aOwner); Native code only! void isPluginEnabledForExtension(in string aExtension, in const
CharStarRef aMimeType); Native code only! void isPluginEnabledForType(in string aMimeType); Native code only! void loadPlugins(); Native code only! void newPluginNativeWindow(out nsPluginNativeWindowPtr aPluginNativeWindow); Native code only! void parsePostBufferToFixHeaders(in string aInPostData, in unsigned long aInPostDataLen, out string aOutPostData, out unsign...
...Native code only! Methods Native code only!createTempFileToPost To create temp file with Content len header in, it will use by http POST. nsIFile createTempFileToPost( in string aPostDataURL ); Parameters aPostDataURL R...
...The caller is responsible for opening the channel. It may or may not be already opened when this function is called. nsIStreamListener instantiatePluginForChannel( in nsIChannel aChannel, in nsIPluginInstanceOwner aOwner ); Parameters aChannel aOwner Return value Native code only!isPluginEnabledForExtension void isPluginEnabledForExtension( in string aExtension, in const
CharStarRef aMimeType ); Parameters aExtension aMimeType Native code only!isPluginEnabledForType void isPluginEnabledForType( in string aMimeType ); Parameters aMimeType Native code only!loadPlugins void loadPlugins(); Parameters None. Native code only!newPluginNativeWindow Creates a new plugin native window object. void newPluginNativeWindow( out nsPluginNativeWi...
...Then using nsIHandlerService it gets the handler info. A handler is, default application that should open or deal with this file. let pluginHost = Cc["@mozilla.org/plugin/host;1"].getS...
nsIProtocolHandler
ement protocol handlers. If you wish to create a new protocol handler, you need to implement this interface. Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview boolean allowPort(in long port, in string scheme); nsIChannel newChannel(in nsIURI aURI); nsIURI newURI(in AUTF8String aSpec, in string aOrigin
Charset, in nsIURI aBaseURI); Attributes Attribute Type Description defaultPort long The default port is the port the protocol uses by default. If the protocol doesn't need a port (for example, the "about" protocol), this attribute is -1. Read only. protocolFlags unsigned long Protocol-specific flags. Read only. Note: Starting with Firefox 3, on...
...ewChannel() Constructs a new channel from the given URI for this protocol handler. nsIChannel newChannel( in nsIURI aURI ); Parameters aURI The URI for which to construct a channel. Return value Return the newly constructed channel. newURI() Makes a URI object that is suitable for loading by this protocol, where the URI string is given as an UTF-8 string. ...
...hannel( in nsIURI aURI ); Parameters aURI The URI for which to construct a channel. Return value Return the newly constructed channel. newURI() Makes a URI object that is suitable for loading by this protocol, where the URI string is given as an UTF-8 string. The caller may provide the
charset from which the URI string originated, so that the URI string can be translated back to that
charset (if necessary) before communicating with, for example, the origin server of the URI string. (Many servers do not support UTF-8 IRIs at the present time, so we must be careful about tracking the native
charset of the origin server.) nsIURI newURI( in AUTF8String aSpec, in string aOrigin
Charset, in nsIURI aBaseURI ); Parameters aSpec The URI string in UTF-8 encoding. Depending on th...
...ng with, for example, the origin server of the URI string. (Many servers do not support UTF-8 IRIs at the present time, so we must be careful about tracking the native
charset of the origin server.) nsIURI newURI( in AUTF8String aSpec, in string aOrigin
Charset, in nsIURI aBaseURI ); Parameters aSpec The URI string in UTF-8 encoding. Depending on the protocol's implementation, Unicode
character sequences may or may not be %xx escaped. aOrigin
Charset The
character set of the document from which this URI string originated. This corresponds to the
character set that should be used when communicating this URI to an origin server. If this is null, then UTF-8 encoding is assumed and no
character transformation is not performed. aBaseURI If null, aSpec must specify an absolute URI. Ot...
nsIRadioInterfaceLayer
Obsolete since Gecko 13.0 microphoneMuted bool radioState jsval Read only. speakerEnabled bool Constants Call state constants Constant Value Description ...
...callback returns false. void enumerateCalls( in nsIRILTelephonyCallback callback ); Parameters callback Missing Description Exceptions thrown Missing Exception Missing Description getDataCallList() void getDataCallList(); Parameters None. Exceptions thrown Missing Exception Missing Description getNumberOfMessagesForText() Returns the number of multi-part SMS needed for a given text (160
characters for one SMS). unsigned short getNumberOfMessagesForText( in DOMString text ); Parameters text The body text of an SMS. Return value Unsigned short. Number of SMS needed. hangUp() void hangUp( in unsigned long callIndex ); Parameters callIndex Missing Description Exceptions thrown Missing Exception Missing Description registerCallback() void registerCallback( in nsIRILTelephony...
...Exceptions thrown Missing Exception Missing Description unregisterCallback() void unregisterCallback( in nsIRILTelephonyCallback callback ); Parameters callback Missing Description Exceptions thrown Missing Exception Missing Description unr...
...Exceptions thrown Missing Exception Missing Description unregisterCallback() void unregisterCallback( in nsIRILTelephonyCallback callback ); Parameters callback Missing Description Exceptions thrown Missing Exception Missing Description unregisterDataCallCallback()...
nsIScriptableUnicodeConverter
Methods ConvertFromUnicode() Converts the data from Unicode to one
Charset. Returns the converted string. After converting, Finish should be called and its return value appended to this return value. ACString ConvertFromUnicode( in AString aSrc ); Finish() Returns the term...
...AString convertFromByteArray([const,array,size_is(aCount)] in octet aData, in unsigned long aCount); void convertToByteArray(in AString aString,[optional] out unsigned long aLen,[array, size_is(aLen),retval] out octet aData); nsIInputStream convertToInputStream(in AString aString); Attributes Attribute Type Description
charset string Current
character set. Throws NS_ERROR_UCONV_NOCONV if the requested
charset is not supported. Methods ConvertFromUnicode() Converts the data from Unicode to one
Charset. Returns the converted string. After converting, Finish should be called and its return value appended to this return value. ACString ConvertFromUnicode( in AString aSrc ); Finish() Returns the terminator string. Should be call...
... AString ConvertToUnicode( in ACString aSrc ); convertFromByteArray() Converts an array of bytes to a unicode string. AString convertFromByteArray( [const,array,size_is(aCount)] in octet aData, in unsigned long aCount ); convertToByteArray() Convert a unicode string to an array of bytes. Finish does not need to be called. ...
...t aData, in unsigned long aCount ); convertToByteArray() Convert a unicode string to an array of bytes. Finish does not need to be called. void convertToByteArray(in AString aString, out unsigned long aLen, Optional [array, size_is(aLen),retval] out octet aData ); convertToInputStream() Converts a Unicode string to an input stream. The bytes in the stream are encoded according to the
charset attribute. The returned stream is non-blocking. nsIInputStream convertToInputStream( in AString aString ); Parameters aString The text to encode to the stream. The text is encoded into the
character set specified by the
charset attribute. Return value An nsIInputStream that will present the text specified in aString as its data. Examples See Reading textual data and Writing textu...
nsIURL
, then the Directory attribute accesses the complete /foo/bar/ portion, and the FileName is the empty string. If the trailing slash is omitted, then the Directory is /foo/ and the file is bar (that is this is a syntactic, not a semantic breakdown of the Path). And hence don't rely on this for something to be a definitely be a file. But you can get just the leading directory portion for sure. Some
characters may be escaped. fileBaseName AUTF8String File basename portion of a filename in a url. Some
characters may be escaped. fileExtension AUTF8String File extension portion of a filename in a url. If a file extension does not exist, the empty string is returned. Some
characters may be escaped. fileName AUTF8String File name portion of a URL. If the UR...
...caped. fileName AUTF8String File name portion of a URL. If the URL denotes a path to a directory and not a file, for example http://host/foo/bar/, then the Directory attribute accesses the complete /foo/bar/ portion, and the FileName is the empty string. Note that this is purely based on searching for the last trailing slash. And hence don't rely on this to be a definite file. Some
characters may be escaped. filePath AUTF8String Path including the directory and file portions of a URL. For example, the filePath of "http://host/foo/bar.html#baz" is "/foo/bar.html". Some
characters may be escaped. param AUTF8String Parameters specified after the ; in the URL. Some
characters may be escaped. Obsolete since Gecko 9.0 Note: This was removed...
... Methods getCommonBaseSpec() This method takes a uri and compares the two. The common uri portion is returned as a string. ...
... Methods getCommonBaseSpec() This method takes a uri and compares the two. The common uri portion is returned as a string. ...
NS ENSURE TRUE
Summary Macro Returns return-value if expr evaluates to false. Syntax NS_ENSURE_TRUE( expr, return-value ); Usage nsresult mozMyClass::MozStringMucking() {
char *foo = new
char[123]; NS_ENSURE_TRUE(foo, NS_ERROR_OUT_OF_MEMORY); // This is equivalent to doing: if (!foo) return NS_ERROR_OUT_OF_MEMORY; // Thou shalt not return NS_ERROR_FAILURE.. ...
...luates to false. Syntax NS_ENSURE_TRUE( expr, return-value ); Usage nsresult mozMyClass::MozStringMucking() {
char *foo = new
char[123]; NS_ENSURE_TRUE(foo, NS_ERROR_OUT_OF_MEMORY); // This is equivalent to doing: if (!foo) return NS_ERROR_OUT_OF_MEMORY; // Thou shalt not return NS_ERROR_FAILURE.. ...
...SURE_TRUE( expr, return-value ); Usage nsresult mozMyClass::MozStringMucking() {
char *foo = new
char[123]; NS_ENSURE_TRUE(foo, NS_ERROR_OUT_OF_MEMORY); // This is equivalent to doing: if (!foo) return NS_ERROR_OUT_OF_MEMORY; // Thou shalt not return NS_ERROR_FAILURE.. ...
... return-value ); Usage nsresult mozMyClass::MozStringMucking() {
char *foo = new
char[123]; NS_ENSURE_TRUE(foo, NS_ERROR_OUT_OF_MEMORY); // This is equivalent to doing: if (!foo) return NS_ERROR_OUT_OF_MEMORY; // Thou shalt not return NS_ERROR_FAILURE.. ...
NS_StringInsertData
<< XPCOM API Reference Summary The NS_StringInsertData function appends data to the existing value of a nsACString instance. This is a low-level API. #include "nsStringAPI.h" nsresult NS_StringInsertData( nsACString& aString, PRUint32 aOffset, const PRUni
char* aData, PRUint32 aDataLength = PR_UINT32_MAX ); Parameters aString [in] A nsACString instance to be modified. aOffset [in] An offset into the string's internal buffer specifying where to place the given
characters. 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_StringInsertData ...
...he 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_StringSetDataRange . ...
...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_StringSetDataRange . Note: GCC requires the -fshort-w
char option to compile this example since PRUni
char is an unsigned short. ...
... This function is defined inline as a wrapper around NS_StringSetDataRange . Note: GCC requires the -fshort-w
char option to compile this example since PRUni
char 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 PRUni
char* 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_StringSetDataRange , nsACString ...
Index
MailNews, SeaMonkey, thunderbird This article provides examples on accessing and manipulating Thunderbird address books. Address book interfaces provides an overview of the related interfaces. See An overview of Thunderbird components for a general description of the Thunderbird user interface and related programmatic interfaces. 9 Address book sync client design by Ri
chard H. Pizzarro <rhp@netscape.com> 10 Autoconfiguration in Thunderbird Administration, enterprise Author: Ben Bucksch Please do not change this document without consulting the author 11 Autoconfig file format No summary! 12 Autoconfig file format definition Please see https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFo...
...ey application suite. 34 Mail and RDF Mozilla Mail exposes many of it's data structures to RDF through a few datasources. This allows exposure of mailnews-specific data to user interface using RDF Templates. 35 Mail client architecture overview Sections in grey refer to modules outside of mail/news 36 Mail composition back end by Ri
chard H. Pizzarro <rhp@netscape.com> Contents 37 Mail event system Mozilla mail requires an event system to notify different subsystems that data has changed. This document describes the system that events are passed amongst the mail objects. 38 MailNews Filters MailNews, thunderbird Mailnews filters consist of a set of search terms, and a set of filter actio...
...ction the purge code is implemented as a search of the "Junk" folder, looking for "old" message that have the proper junk status. when does purging happens? elaborate on the mime changes that were made for spam currently, spam filtering is does not work for news, but it would be possible to add support for this. (there is a bug on it.) 51 The libmime module by Ri
chard H. Pizzarro <rhp@netscape.com> 52 Thunderbird API documentation These pages have been moved from mozilla.org, and may or may not be relevant. 55 Thunderbird Binaries Branch, Trunk, comm-central, thunderbird Described below are three types of generally available Thunderbird packages - Releases, Early Preview Releases, and Nightly Builds (including trunk ...
...llows applications to send files via a system's default mail application. The Thunderbird installer sets the installed build as the default mapi/mail client. If you want to set a debug build as the default mail client, you need configure it manually: 115 Using the Multiple Accounts API By Alec Flett alecf@flett.org 118 libmime content type handlers by Ri
chard H. Pizzarro <rhp@netscape.com> ...
Using COM from js-ctypes
NDWORK let is64bit; if (ctypes.voidptr_t.size == 4 /* 32-bit */) { is64bit = false; } else if (ctypes.voidptr_t.size == 8 /* 64-bit */) { is64bit = true; } let WINABI = is64bit ? ctypes.default_abi : ctypes.winapi_abi; let CALLBACK_ABI = is64bit ? ...
...fault_abi : ctypes.winapi_abi; let CALLBACK_ABI = is64bit ? ...
...es.winapi_abi; let CALLBACK_ABI = is64bit ? ...
... // LIBRARIES let lib = ctypes.open('ole32.dll'); // TYPES // Simple Types let BYTE = ctypes.unsigned_
char; let DWORD = ctypes.unsigned_long; let LONG = ctypes.long; let LPVOID = ctypes.voidptr_t; let VOID = ctypes.void_t; let ULONG = ctypes.unsigned_long; let USHORT = ctypes.unsigned_short; let W
CHAR = ctypes.js
char; // Advanced Types - based on simple types let HRESULT = LONG; let LPCWSTR = W
CHAR.ptr; // Guess Types - these just work I couldnt find a proper defintion for it let LPUNKNOWN = ctypes.voidptr_t; // STRUCTURES // Simple Structures let GUID = ctypes.StructType('GUID', [ { 'Data1': ULONG }, { 'Data2': USHORT }, { 'Data3': USHORT }, { 'Data4': BYTE.array(8) } ]); // Advanced Structures let CLSID = GUID; let IID = GUID; // Super Advanced Structures let REFIID = IID.ptr;...
Initialization and Destruction - Plugins
pecify whether it is windowed (the default) or windowless. Plug-in instances are created with NPP_New and destroyed with NPP_Destroy. NPP_New informs the plug-in of the creation of a new instance with the specified MIME type. You can allocate instance-specific private data at this time. NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
char *argn[],
char *argv[], NPSavedData *saved); The pluginType parameter represents the MIME type of this instance of the plug-in. You can assign more than one MIME type to a plug-in, which could potentially allow the plug-in to respond to data streams of different types with different interfaces and behavior. The instance parameter represents an NPP object, created by the browser.
...edData and the buffer it contains. In NPP_Destroy, the save parameter specifies state or other information to save for reuse by a new instance with the same URL. ...
...stance of the plug-in is destroyed, before releasing the plug-in library itself. void NP_Shutdown(void); For an example that shows both the NP_Initialize and NP_Shutdown methods, see Initialize and Shutdown Example. Initialize and Shutdown Example This example demonstrates the use of the NP_Initialize and NP_Shutdown methods. /* Define global variable to hold the user agent string. ...
...ows both the NP_Initialize and NP_Shutdown methods, see Initialize and Shutdown Example. Initialize and Shutdown Example This example demonstrates the use of the NP_Initialize and NP_Shutdown methods. /* Define global variable to hold the user agent string. */ static
char* userAgent = NULL; /* Initialize function. */ NPError NP_Initialize(void) { /* Get the user agent from the browser. */
char* result = NPN_UserAgent(); if (result == NULL) return NPERR_OUT_OF_MEMORY_ERROR; /* Allocate some memory so that you can keep a copy of it. */ userAgent = (
char*) NPN_MemAlloc(strlen(result) + 1); if (userAgent == NULL) return NPERR_OUT_OF_MEMORY_ERROR; /* Copy the string to your memory. */ strcpy(userAgent, result); return NPERR_NO_ERROR; } /* Shutdown function */ NPError NP_Sh...
BatteryManager.onlevelchange - Web APIs
ryManager.onlevelchange property specifies an event listener to receive levelchange events. These events occur when the battery level is updated. Syntax navigator.battery.onlevelchange = funcRef Where battery is a BatteryManager object, and funcRef is a function to be called when the levelchange event occurs. ...
...is a BatteryManager object, and funcRef is a function to be called when the levelchange event occurs. ...
...ange event occurs. ...
... HTML <div id="level">(battery level unknown)</div> <div id="stateBaterry">(
charging state unknown)</div> JavaScript navigator.getBattery().then(function(battery) { battery.onlevelchange = function(){ document.querySelector('#level').textContent = battery.level; if(battery.
charging) { document.querySelector('#stateBaterry').textContent = "
Charging time: " + (battery.
chargingTime / 60); } else { document.querySelector('#stateBaterry').textContent = "Dis
charging time: " + (battery.dis
chargingTime / 60); } }; }); Specifications Specification Status Comment Battery Status API Candidate Recommendation Initial definition ...
Comment - Web APIs
The Comment interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. Comments are represented in HTML and XML as content between '<!--' and '-->'. In XML, the
character sequence '--' cannot be used within a comment. <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 meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size=...
...eight="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/
CharacterData" target="_top"><rect x="266" y="1" width="130" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="331" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">
CharacterData</text></a><polyline points="396,25 406,20 406,30 396,25" stroke="#D4DDE4" fill="none"/><line x1="406" y1="25"...
... Specifications Specification Status Comment DOMThe definition of 'Comment' in that specification. Living...
... Specifications Specification Status Comment DOMThe definition of 'Comment' in that specification. Living Standard Added the constructor. ...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
ard cinematographic techniques are used, since the viewer has likely grown up watching films using those techniques, and has subconscious expectations that a film or animation will follow those methods. Deviating from them can pull the viewer out of the moment. In business applications, the 3D camera is used to simply set the apparent size and perspective when rendering things such as graphs and
charts. In mapping applications, the camera may either be placed directly over the scene, or might use various angles to show perspective. For 3D GPS solutions, the camera is positioned to show the area around the user, with the majority of the display showing the area ahead of the user's path of motion. When using WebGL to accelerate 2D graphics drawing, the camera is typically placed directly abov...
...ames offering weapons with scopes, where the view isn't quite based off the head's position in the same way anymore. 3D games might also provide the ability for non-players to observe the action, either by positioning an invisible avatar of sorts or by choosing a fixed virtual camera to watch from. In advanced 3D games, a camera or camera-like object could be used to determine what a non-player
character can see, relying on the same rendering and physics engine used by player
characters for non-player
characters. In single-screen 2D games, the camera is not associated directly with the player or any other
character in the game, but is instead either fixed above or next to the game play area, or follows the action as the action moves around a scrolling game world. For example, a classic arca...
... tilt or pitch the camera, you keep it fixed in space at the same coordinates while changing the direction in which it's facing vertically without altering the horizontal portion of its facing at all. It simply adjusts the direction it's pointing up and down. Tilting is good for capturing the scope of a tall object or scene, such as a forest or a mountain, but is also a popular way to introduce a
character or locale of importance or which inspires awe. it's also of course useful for implementing support for a player looking up and down. Thus, tilting the camera can be achieved by rotating the camera around the X axis, so that it pivots to look up and down. This can be done using the appropriate method in your matrix math library, such as the rotateX() method in glMatrix's mat4 class: mat4.
...llying, but instead of moving the camera forward and backward, it moves from left to right or vice-versa. The camera doesn't rotate at all, so the focus of the shot slowly glides off the screen. This can suggest concentration, time passing, or contemplation when attempting to establish emotion in a scene. It's also used frequently in "walk-and-talk" scenes, wherein the camera glides alongside the
characters and they walk through the scene. To move the camera left and right, translate the view matrix along the X axis in the opposite direction from the desired camera movement: mat4.translate(viewMatrix, viewMatrix, [-truckDistance, 0, 0]); Note the vector [-truckDistance, 0, 0]. This compensates for the fact that the truck operation works by moving the world rather than the camera. By movin...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
)'s basic syntax. var intervalID = window.setInterval(myCallback, 500, 'Parameter 1', 'Parameter 2'); function myCallback(a, b) { // Your code here // Parameters are purely optional. console.log(a); console.log(b); } Example 2: Alternating two colors The following example calls the flashtext() function once a second until the Stop button is pressed. ...
... </script> </head> <body onload="changeColor();"> <div id="my_box"> <p>Hello World</p> </div> <button onclick="stopTextColor();">Stop</button> </body> </html> Example 3: Typewriter simulation The following example simulates typewriter by first clearing and then slowly typing content into the NodeList that matches a specified group of selectors. ...
... oCurrent = oRel.ref; sPart = oCurrent.nodeValue; oCurrent.nodeValue = ''; } oSheet.ref.appendChild(oRel.ref); if (bExit) { return false; } } aMap.length--; return true; } function typewrite () { if (sPart.length === 0 && scroll(aSheets[nIdx], 0, true) && nIdx++ === aSheets.length - 1) { clean(); return; } oCurrent.nodeValue += sPart.
charAt(0); sPart = sPart.slice(1); } function Sheet (oNode) { this.ref = oNode; if (!oNode.hasChildNodes()) { return; } this.parts = Array.prototype.slice.call(oNode.childNodes); for (var nChild = 0; nChild < this.parts.length; nChild++) { oNode.removeChild(this.parts[nChild]); this.parts[nChild] = new Sheet(this.parts[nChild]); } } var nIntervId, oCu...
...ds (index decreasing). MiniDaemon global object methods MiniDaemon.forceCall(minidaemon) Forces a single callback to the minidaemon.task function regardless of the fact that the end has been reached or not. In any case the internal INDEX property is increased/decreased (depending on the actual direction of the process). ...
CSS values and units - CSS: Cascading Style Sheets
keywords and values with or without units. There are a common set of data types -- values and units -- that CSS properties accept. Below is an overview of most of these data types. Refer to the page for each value type for more detailed information. Textual data types <custom-ident> Pre-defined keywords as an <ident> <string> <url> Text data types are either <string>, a quoted series of
characters, or an <ident>, a "CSS Identifier" which is an unquoted string. A <string> must be quoted with either single or double quotes. CSS Identifiers, listed in the specifications as <ident> or <custom-ident>, must be unquoted. In the CSS specifications, values that can be defined by the web developer, like keyframe animations, font-family names, or grid areas are listed as a <custom-ident>, <st...
... you wanted to include a background image, you might use either of the following. .box { background-image: url("images/my-background.png"); } .box { background-image: url("https://www.exammple.com/images/my-background.png"); } The parameter for url() can be either quoted or unquoted. If unquoted, it is parsed as a <url-token>, which has extra requirements including the escaping of certain
characters. See <url> for more information. Numeric data types <integer> <number> <dimension> <percentage> Integers An integer is one or more decimal digits, 0 through 9, such as 1024 or -55. An integer may be preceded by a + or - symbol, with no space between the symbol and the integer. Numbers A <number> represents a real number, which may or may not have a decimal point with a fraction...
...e integer. Numbers A <number> represents a real number, which may or may not have a decimal point with a fractional component, for example 0.255, 128 or -1.2. Numbers may also be preceded by a + or - symbol. Dimensions A <dimension> is a <number> with a unit attached to it, for example 45deg, 100ms, or 10px. The attached unit identifier is case insensitive. There is never a space or any other
characters between a the number and the unit identifier: i.e. 1 cm is not valid. CSS uses dimensions to specify: <length> (Distance units) <angle> <time> <frequency> <resolution> These are all covered in subsections below. Distance units Where a distance unit, also known as a length, is allowed as a value for a property, this is described as the <length> type. There are two types of length...
...gth in relation to something else. For example, em is relative to the font size on the element and vh is relative to the viewport height. Relative length units Unit Relative to em Font size of the element. ex x-height of the element's font. cap Cap height (the nominal height of capital letters) of the element's font. ch Average
character advance of a narrow glyph in the element's font, as represented by the "0" (ZERO, U+0030) glyph. ic Average
character advance of a full width glyph in the element's font, as represented by the "?" (CJK water ideograph, U+6C34) glyph. rem Font size of the root element. lh Line height of the element. rlh Line height of the root element. ...
conic-gradient() - CSS: Cascading Style Sheets
The result of the conic-gradient() function is an object of the <gradient> data type, which is a special kind of <image>. 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. ...
... midpoint of the red to blue gradient change, however, is at the 20% mark rather than the 50% mark as would have happened without the 80grad, or 20%, color hint. conic-gradient(red 40grad, 80grad, blue 360grad); If two or more color stops are at the same location, the transition will be a hard line between the first and last colors declared at that location. To use conic gradients to create pie
charts --- which is NOT the correct way to create pie
charts as background images are not accessible -- use hard color stops, where the color stop angles for two adjacent color stops are the same. The easiest way to do this is to use multip position colors stops. The following two declarations are equivalent: conic-gradient(#fff 0.09turn, #bbb 0.09turn, #bbb 0.27turn, #666 0.27turn, #666 0.54turn, #0...
... 25% 25%; And, yes, you can mix and match different angle units, but don't. The above is hard to read. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. While it is possible to create pie
charts, checkerboards, and other effects with conic gradients, CSS images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Gu...
... div { width: 100px; height: 100px; } <div></div> div { background: conic-gradient( red 36deg, orange 36deg 170deg, yellow 170deg); border-radius: 50% } Checkerboard div { width: 100px; height: 100px; } <div></div> div { background: ...
font-family - CSS: Cascading Style Sheets
t one generic family name in a font-family list, since there's no guarantee that any given font is available. This lets the browser select an acceptable fallback font when necessary. The font-family property specifies a list of fonts, from highest priority to lowest. Font selection does not simply stop at the first font in the list that is on the user's system. Rather, font selection is done one
character at a time, so that if an available font does not have a glyph for a needed
character, the latter fonts are tried. (However, this doesn't work in Internet Explorer 6 or earlier.) When a font is only available in some styles, variants, or sizes, those properties may also influence which font family is chosen. Syntax /* A font family name and a generic family name */ font-family: Gill Sans Ex...
...e plain. E.g. "Open Sans", "Fira Sans", "Lucida Sans", "Lucida Sans Unicode", "Trebuchet MS", "Liberation Sans", "Nimbus Sans L", sans-serif. monospace All glyphs have the same fixed width. E.g. "Fira Mono", "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", Monaco, "Lucida Console", monospace. cursive Glyphs in cursive fonts generally have either joining strokes or other cursive
characteristics beyond those of italic typefaces. The glyphs are partially or completely connected, and the result looks more like handwritten pen or brush writing than printed letterwork. E.g. "Brush Script MT", "Brush Script Std", "Lucida Calligraphy", "Lucida Handwriting", "Apple Chancery", cursive. fantasy Fantasy fonts are primarily decorative fonts that contain playful representations of c...
...his is for the particular stylistic concerns of representing mathematics: superscript and subscript, brackets that cross several lines, nesting expressions, and double struck glyphs with distinct meanings. This is some example math text: ax2 + bx + c = 0. emoji Fonts that are specifically designed to render emoji. This is some example emoji text: ??. fangsong A particular style of Chinese
characters that are between serif-style Song and cursive-style Kai forms. This style is often used for government documents. This is some example fangsong text with the Chinese
characters for "fangsong" in traditional and simple forms, respectively: ??? ???. Valid family names Font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This me...
...en serif-style Song and cursive-style Kai forms. This style is often used for government documents. This is some example fangsong text with the Chinese
characters for "fangsong" in traditional and simple forms, respectively: ??? ???. Valid family names Font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means that punctuation
characters and digits at the start of each token must be escaped in unquoted font family names. For example, the following declarations are valid: font-family: Gill Sans Extrabold, sans-serif; font-family: "Goudy Bookletter 1911", sans-serif; The following declarations are invalid: font-family: Goudy Bookletter 1911, sans-serif; font-family: Red/Black, sans-serif; font-family: "Lucida" Grande, san...
font-variation-settings - CSS: Cascading Style Sheets
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. ...
...-variation-settings: initial; font-variation-settings: unset; Values This property's value can take one of two forms: normal Text is laid out using default settings. <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 ...
.... 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. 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...
... "wdth" font-stretch "slnt" (slant) font-style: oblique + angle "ital" font-style: italic "opsz" font-optical-sizing Custom axes can be anything the font designer wants to vary in their font, for example ascender or descender heights, the size of serifs, or anything else they can imagine. Any axis can be used as long as it is given a unique 4-
character axis. Some will end up becoming more common, and may even become registered over time. 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. In order to use variable fonts ...
letter-spacing - CSS: Cascading Style Sheets
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. ...
... 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. ...
...ull request. Syntax /* Keyword value */ letter-spacing: normal; /* <length> values */ letter-spacing: 0.3em; letter-spacing: 3px; letter-spacing: .3px; /* Global values */ letter-spacing: inherit; letter-spacing: initial; letter-spacing: unset; Values normal The normal letter spacing for the current font. Unlike a value of 0, this keyword allows the user agent to alter the space between
characters in order to justify text. <length> Specifies extra inter-
character space in addition to the default space between
characters. Values may be negative, but there may be implementation-specific limits. User agents may not further increase or decrease the inter-
character space in order to justify text. Accessibility concerns A large positive or negative letter-spacing value will make the w...
...led with a very large positive value, the letters will be so far apart that the word(s) will appear like a series of individual, unconnected letters. For text styled with a very large negative value, the letters will overlap each other to the point where the word(s) may be unrecognizable. Legible letter-spacing must be determined on a case-by-case basis, as different font families have different
character widths. There is no one value that can ensure all font families automatically maintain their legibility. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.8 | W3C Understanding WCAG 2.0 Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valuean optimum value consisti...
text-orientation - CSS: Cascading Style Sheets
It only affects text in vertical mode (when writing-mode is not horizontal-tb). It is useful for controlling the display of languages that use vertical script, and also for making vertical table headers. 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 /* Keyword values */ text-orientation: mixed; text-orientation: upright; text-orientation: sideways-right; text-orientation: sideways; text-orientation: use-glyph-orientation; /* Global values */ text-orientation: inherit; text-orientation: initial; text-orientation: unset; The text-orientation property is specified as a single keyword from the list below. ...
...ientation: upright; text-orientation: sideways-right; text-orientation: sideways; text-orientation: use-glyph-orientation; /* Global values */ text-orientation: inherit; text-orientation: initial; text-orientation: unset; The text-orientation property is specified as a single keyword from the list below. Values mixed Rotates the
characters of horizontal scripts 90? clockwise. Lays out the
characters of vertical scripts naturally. Default value. ...
...; text-orientation: use-glyph-orientation; /* Global values */ text-orientation: inherit; text-orientation: initial; text-orientation: unset; The text-orientation property is specified as a single keyword from the list below. Values mixed Rotates the
characters of horizontal scripts 90? clockwise. Lays out the
characters of vertical scripts naturally. Default value. upright Lays out the
characters of horizontal scripts naturally (upright), as well as the glyphs for vertical scripts. Note that this keyword causes all
characters to be considered as left-to-right: the used value of direction is forced to be ltr. sideways Causes
characters to be laid out as they would be horizontally, but with the whole line rotated 90? clockwise. sideways-right An alias to sideways that is kept for ...
white-space - CSS: Cascading Style Sheets
eyword values */ white-space: normal; white-space: nowrap; white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: break-spaces; /* Global values */ white-space: inherit; white-space: initial; white-space: unset; The white-space property is specified as a single keyword chosen from the list of values below. Values normal Sequences of white space are collapsed. Newline
characters in the source are handled the same as other white space. Lines are broken as necessary to fill line boxes. nowrap Collapses white space as for normal, but suppresses line breaks (text wrapping) within the source. pre Sequences of white space are preserved. Lines are only broken at newline
characters in the source and at <br> elements. pre-wrap Sequences of white space are preserved. L...
...ndled the same as other white space. Lines are broken as necessary to fill line boxes. nowrap Collapses white space as for normal, but suppresses line breaks (text wrapping) within the source. pre Sequences of white space are preserved. Lines are only broken at newline
characters in the source and at <br> elements. pre-wrap Sequences of white space are preserved. Lines are broken at newline
characters, at <br>, and as necessary to fill line boxes. pre-line Sequences of white space are collapsed. Lines are broken at newline
characters, at <br>, and as necessary to fill line boxes. break-spaces The behavior is identical to that of pre-wrap, except that: Any sequence of preserved white space always takes up space, including at the end of the line. A line breaking opportunity exist...
... Such preserved spaces take up space and do not hang, and thus affect the box's intrinsic sizes (min-content size and max-content size). ...
... Such preserved spaces take up space and do not hang, and thus affect the box's intrinsic sizes (min-content size and max-content size). ...
Introduction to HTML5 - Developer guides
even browsers that don't presently support HTML5 to enter into standards mode, which means that they'll interpret the long-established parts of HTML in an HTML5-compliant way while ignoring the new features of HTML5 they don't support. This is much simpler than the former doctypes, and shorter, making it easier to remember and reducing the amount of bytes that must be downloaded. ...
...sently support HTML5 to enter into standards mode, which means that they'll interpret the long-established parts of HTML in an HTML5-compliant way while ignoring the new features of HTML5 they don't support. This is much simpler than the former doctypes, and shorter, making it easier to remember and reducing the amount of bytes that must be downloaded. Declaring the
character set with the <meta
charset> The first thing done on a page is usually indicating the
character set that is used. In previous versions of HTML, it was done using a very complex <meta> element. Now, it is very simple: <meta
charset="UTF-8"> Place this right after your <head>, as some browsers restart the parsing of an HTML document if the declared
character set is different from what they had anticipated. Also, if you ...
...This was done to tighten security and prevent some types of attacks. ...
...This was done to tighten security and prevent some types of attacks. Using the new HTML5 parser The parsing rules of HTML5, which analyze the meaning of mark-up, have been more precisely defined in HTML5. ...
HTML attribute reference - HTML: Hypertext Markup Language
Elements in HTML have attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want. Attribute list Attribute Name Elements Description accept <form>, <input> List of types the server accepts, typically a file type. accept-
charset <form> List of supported
charsets. accesskey Global attribute Keyboard shortcut to activate or add focus to the element. action <form> The URI of a program that processes the information submitted via the form. align <applet>, <caption>, <col>, <colgroup>, <hr>, <iframe>, <img>, <table>, <tbody>, <td>, <tfoot> , <th>, <thead>, <tr> Specifies the horizontal alignment of the element. ...
... 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 <command>, <input> Indicates whether the element should be checked on page load. cite <blockquote>, <del>, <ins>, <q> Contains a URI which points to the source of the quote or change. class Global attribute Often used with CSS to style elements with common properti...
...ished. 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> Defines the minimum number of
characters allowed in the element. media <a>, <area>, <link>, <source>, <style> Specifies a hint of the media for which the linked resource was designed. method <form> Defines which HTTP method to use when submitting the form. Can be GET (default) or POST. ...
... <th> Defines the cells that the header test (defined in the th element) relates to. scoped <style> selected <option> Defines a value which will be selected on page load. shape <a>, <area> size <input>, <select> Defines the width of the element (in pixels). If the element's type attribute is text or password then it's the number of
characters. sizes <link>, <img>, <source> slot Global attribute Assigns a slot in a shadow DOM shadow tree to an element. span <col>, <colgroup> spellcheck Global attribute Indicates whether spell checking is allowed for the element. src <audio>, <embed>, <iframe>, <img>, <input>, <script>, <source>, <track>, <video> The URL ...
<input type="hidden"> - HTML: Hypertext Markup Language
y browser's developer tools or "View Source" functionality. Do not rely on hidden inputs as a form of security. ...
...not rely on hidden inputs as a form of security. ...
... Using hidden inputs As mentioned above, hidden inputs can be used anywhere that you want to include data the user can't see or edit along with the form when it's submitted to the server. Let's look at some examples that illustrate its use. ...
... Using hidden inputs As mentioned above, hidden inputs can be used anywhere that you want to include data the user can't see or edit along with the form when it's submitted to the server. Let's look at some examples that illustrate its use. ...
<textarea> - HTML: Hypertext Markup Language
nd Chrome), which controls whether and how the text value should be automatically capitalized as it is entered/edited by the user. The non-deprecated values are available in iOS 5 and later. Possible values are: none: Completely disables automatic capitalization. sentences: Automatically capitalize the first letter of sentences. words: Automatically capitalize the first letter of words.
characters: Automatically capitalize all
characters. on: Deprecated since iOS 5. off: Deprecated since iOS 5. autocomplete This attribute indicates whether the value of the control can be automatically completed by the browser. Possible values are: off: The user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the b...
...rm element whose id is specified by the form attribute of the input element. For more information, see the autocomplete attribute in <form>. autofocus This Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form-associated element in a document can have this attribute specified. cols The visible width of the text control, in average
character widths. If it is specified, it must be a positive integer. If it is not specified, the default value is 20. disabled This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example <fieldset>; if there is no containing element when the disabled attribute is set, th...
... <textarea> element is associated with (its "form owner"). The value of the attribute must be the id of a form element in the same document. If this attribute is not specified, the <textarea> element must be a descendant of a form element. This attribute enables you to place <textarea> elements anywhere within a document, not just as descendants of form elements. maxlength The maximum number of
characters (UTF-16 code units) that the user can enter. If this value isn't specified, the user can enter an unlimited number of
characters. minlength The minimum number of
characters (UTF-16 code units) required that the user should enter. name The name of the control. placeholder A hint to the user of what can be entered in the control. Carriage returns or line-feeds within the placeholder tex...
...invalid: textarea:invalid { border: 2px dashed red; } textarea:valid { border: 2px solid lime; } Examples Basic example The following example show a very simple textarea, with a set numbers of rows and columns and some default content. <textarea name="textarea" rows="10" cols="50">Write something here</textarea> Min and max length This example has a minimum and maximum number of
characters -- of 10 and 20 respectively. Try it and see. <textarea name="textarea" rows="5" cols="30" minlength="10" maxlength="20">Write something here</textarea> Note that minlength doesn't stop the user from removing
characters so that the number entered goes past the minimum, but it does make the value entered into the <textarea> invalid. Also note that even if you have a minlength value...
HTML elements reference - HTML: Hypertext Markup Language
ruby> element. <rt> The HTML Ruby Text (<rt>) element specifies the ruby text component of a ruby annotation, which is used to provide pronunciation, translation, or transliteration information for East Asian typography. The <rt> element must always be contained within a <ruby> element. <rtc> The HTML Ruby Text Container (<rtc>) element embraces semantic annotations of
characters presented in a ruby of <rb> elements used inside of <ruby> element. <rb> elements can have both pronunciation (<rt>) and semantic (<rtc>) annotations. <ruby> The HTML <ruby> element represents a ruby annotation. Ruby annotations are for showing pronunciation of East Asian
characters. <s> The HTML <s> element renders text with a strikethrough, or a line through it...
... elements Warning: These are old HTML elements which are deprecated and should not be used. You should never use them in new projects, and should replace them in old projects as soon as you can. They are listed here for informational purposes only. Element Description <acronym> The HTML Acronym Element (<acronym>) allows authors to clearly indicate a sequence of
characters that compose an acronym or abbreviation for a word. <applet> The obsolete HTML Applet Element (<applet>) embeds a Java applet into the document; this element has been deprecated in favor of <object>. <basefont> The obsolete HTML Base Font element (<basefont>) sets a default font face, size, and color for the other elements which are descended from its parent elem...
...long with other information needed to construct a certificate request, and that the result of the process will be a signed certificate. <listing> The HTML Listing Element (<listing>) renders text between the start and end tags without interpreting the HTML in between and using a monospaced font. The HTML 2 standard recommended that lines shouldn't be broken when not greater than 132
characters. <marquee> The HTML <marquee> element is used to insert a scrolling area of text. You can control what happens when the text reaches the edges of its content area using its attributes. <menuitem> The HTML <menuitem> element represents a command that a user is able to invoke through a popup menu. This includes context menus, as well as menus that might be attached...
... ...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
with: <link rel="stylesheet" href="styles/main.css"> Here however, we will use a rel value of preload, which turns <link> into a preloader for any resource we want. You will also need to specify: The path to the resource in the href attribute. The type of resource in the as attribute. ...
... attribute, which contains the MIME type of the resource the element points to. This is especially useful when preloading resources -- the browser will use the type attribute value to work out if it supports that resource, and will only download it if so, ignoring it if not. You can see an example of this in our video example (see the full source code, and also the live version): <head> <meta
charset="utf-8"> <title>Video preload example</title> <link rel="preload" href="sintel-short.mp4" as="video" type="video/mp4"> <link rel="preload" href="sintel-short.webm" as="video" type="video/webm"> </head> <body> <video controls> <source src="sintel-short.mp4" type="video/mp4"> <source src="sintel-short.webm" type="video/webm"> <p>Your browser doesn't support HTML5 video. Here...
... as long as you set a crossorigin attribute on your <link> element. One interesting case where this applies, even if the fetch is not cross-origin, is font files. Because of various reasons, these have to be fetched using anonymous mode CORS (see Font fetching requirements). Let's use this case as an example. You can see the full example source code on GitHub (also see it live): <head> <meta
charset="utf-8"> <title>Web font example</title> <link rel="preload" href="fonts/cicle_fina-webfont.woff2" as="font" type="font/woff2" crossorigin> <link rel="preload" href="fonts/zantroke-webfont.woff2" as="font" type="font/woff2" crossorigin> <link href="style.css" rel="stylesheet"> </head> <body> ... </body> Not only are we providing the MIME type hints in the type attributes, but we a...
...e hints in the type attributes, but we are also providing the crossorigin attribute to handle the CORS issue. Including media One nice feature of <link> elements is their ability to accept media attributes. ...
Set-Cookie - HTTP
Encoding: Many implementations perform URL encoding on coo...
...t-Cookie: <cookie-name>=<cookie-value>; SameSite=Lax Set-Cookie: <cookie-name>=<cookie-value>; SameSite=None // Multiple attributes are also possible, for example: Set-Cookie: <cookie-name>=<cookie-value>; Domain=<domain-value>; Secure; HttpOnly Attributes <cookie-name>=<cookie-value> A cookie begins with a name-value pair: A <cookie-name> can be any US-ASCII
characters, except control
characters, spaces, or tabs. It also must not contain a separator
character like the following: ( ) < > @ , ; : \ " / [ ] ? = { }. A <cookie-value> can optionally be wrapped in double quotes and include any US-ASCII
characters excluding control
characters, Whitespace, double quotes, comma, semicolon, and backslash. Encoding: Many implementations perform URL encoding on cookie values, however it is n...
... __Secure- prefix: Cookies names starting with __Secure- (dash is part of the prefix) must be set with the secure flag from a secure page (HTTPS). ...
...rent document URL, not including subdomains. Contrary to earlier specifications, leading dots in domain names (.example.com) are ignored. Multiple host/domain values are not allowed, but if a domain is specified, then subdomains are always included. Path=<path-value> Optional A path that must exist in the requested URL, or the browser won't send the Cookie header. The forward slash (/)
character is interpreted as a directory separator, and subdirectories will be matched as well: for Path=/docs, /docs, /docs/Web/, and /docs/Web/HTTP will all match. Secure Optional A secure cookie is only sent to the server when a request is made with the https: scheme. (However, confidential information should never be stored in HTTP Cookies, as the entire mechanism is inherently insecure and doesn...
String.prototype.normalize() - JavaScript
ion. "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 by either of: The single code point U+00F1. The code point for "n" (U+006E) followed by the code point for the combining tilde (U+0303). let string1 = '\u00F1'; let...
...t, they even have different lengths. let string1 = '\u00F1'; // n let string2 = '\u006E\u0303'; // n console.log(string1 === string2); // false console.log(string1.length); // 1 console.log(string2.length); // 2 The normalize() method helps solve this problem by converting a string into a normalized form common for all sequences of code points that represent the same
characters. There are two main normalization forms, one based on canonical equivalence and the other based on compatibility. Canonical equivalence normalization In Unicode, two sequences of code points have canonical equivalence if they represent the same abstract
characters, and should always have the same visual appearance and behavior (for example, they should always be sorted in the same way). ...
... equivalence if they represent the same abstract
characters, and should always have the same visual appearance and behavior (for example, they should always be sorted in the same way). You can use normalize() using the "NFD" or "NFC" arguments to produce a form of the string that will be the same for all canonically equivalent strings. In the example below we normalize two representations of the
character "n": let string1 = '\u00F1'; // n let string2 = '\u006E\u0303'; // n string1 = string1.normalize('NFD'); string2 = string2.normalize('NFD'); console.log(string1 === string2); // true console.log(string1.length); // 2 console.log(string2.length); // 2 Composed and decomposed forms Note that the length of the normalized form under "NFD" is 2. That's because "NFD" ...
... All canonically equivalent sequences are also compatible, but not vice versa. For example: the code point U+FB00 represents the ligature "ff". It is compatible with two consecutive U+0066 code points ("ff"). the code point U+24B9 represents the symbol "(D)". It is compatible with the U+0044 code point ("D...
escape() - JavaScript
Warning: Although escape() is not strictly deprecated (as in "removed from the Web standards"), it is defined in Annex B of the ECMA-262 standard, whose introduction states: ... All of the language features and behaviours specified in this annex have one or more undesirable
characteristics and in the absence of legacy usage would be removed from this specification. ... ... Programmers should not use or assume the existence of these features and behaviours when writing new ECMAScript code. ... The escape() function computes a new string in which certain
characters have been replaced by a hexadecimal escape sequence. Note: This function was used mostly for URL queries (the part of a URL following ?)--not for escaping ordinary String literals, which use the format "\xHH". (HH are two hexade...
...g new ECMAScript code. ... The escape() function computes a new string in which certain
characters have been replaced by a hexadecimal escape sequence. Note: This function was used mostly for URL queries (the part of a URL following ?)--not for escaping ordinary String literals, which use the format "\xHH". (HH are two hexadecimal digits, and the form \xHH\xHH is used for higher-plane Unicode
characters.) Escaped
characters in String literals can be expanded by replacing the \x with %, then using the decodeURIComponent() function. Syntax escape(str) Parameters str A string to be encoded. Return value A new string in which certain
characters have been escaped. ...
...\xHH is used for higher-plane Unicode
characters.) Escaped
characters in String literals can be expanded by replacing the \x with %, then using the decodeURIComponent() function. Syntax escape(str) Parameters str A string to be encoded. Return value A new string in which certain
characters have been escaped. Description The escape function is a property of the global object. Special
characters are encoded with the exception of: @*_+-./ The hexadecimal form for
characters, whose code unit value is 0xFF or less, is a two-digit escape sequence: %xx. For
characters with a greater code unit, the four-digit format %uxxxx is used. ...
... Please do not add polyfills to reference pages. ...
parseInt() - JavaScript
Optional An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string. Be careful--this does not default to 10! The description below explains in more detail what happens when radix is not provided. Return value An integer parsed from the given string. Or NaN when the radix is smaller than 2 or bigger than 36, or the first non-whitespace
character cannot be converted to a number. Description The parseInt function converts its first argument to a string, parses that string, then returns an integer or NaN. If not NaN, the return value will be the integer that is the first argument taken as a number in the specified radix. (For example, a radix of 10 converts from a decimal number, 8 converts from octal, 16 from hexadecimal, and so o...
...urn value will be the integer that is the first argument taken as a number in the specified radix. (For example, a radix of 10 converts from a decimal number, 8 converts from octal, 16 from hexadecimal, and so on.) For radices above 10, letters of the English alphabet indicate numerals greater than 9. For example, for hexadecimal numbers (base 16), A through F are used. If parseInt encounters a
character that is not a numeral in the specified radix, it ignores it and all succeeding
characters and returns the integer value parsed up to that point. parseInt truncates numbers to integer values. Leading and trailing spaces are allowed. Because some numbers use the e
character in their string representation (e.g. 6.022e23 for 6.022 x 1023), using parseInt to truncate numbers will produce unexpec...
...he input string begins with "0" (a zero), radix is assumed to be 8 (octal) or 10 (decimal). Exactly which radix is chosen is implementation-dependent. ECMAScript 5 clarifies that 10 (decimal) should be used, but not all browsers support this yet. For this reason, always specify a radix when using parseInt. If the input string begins with any other value, the radix is 10 (decimal). If the first
character cannot be converted to a number, parseInt returns NaN. For arithmetic purposes, the NaN value is not a number in any radix. You can call the isNaN function to determine if the result of parseInt is NaN. If NaN is passed on to arithmetic operations, the operation result will also be NaN. To convert a number to its string literal in a particular radix, use thatNumber.toString(radix). BigIn...
...erpret a numeric string beginning with a leading 0 as octal. The following may have an octal result, or it may have a decimal result. Always specify a radix to avoid this unreliable behavior. parseInt('0e0') // 0 parseInt('08') // 0, because '8' is not an octal digit. The ECMAScript 5 specification of the function parseInt no longer allows implementations to treat Strings beginning with a 0
character as octal values. ECMAScript 5 states: The parseInt function produces an integer value dictated by interpretation of the contents of the string argument according to the specified radix. Leading whitespace in string is ignored. If radix is undefined or 0, it is assumed to be 10 except when the number begins with the
character pairs 0x or 0X, in which case a radix of 16 is assumed. This d...
Destructuring assignment - JavaScript
ohn', lastName: 'Doe' } }; function userId({id}) { return id; } function whois({displayName, fullName: {firstName: name}}) { return `${displayName} is ${name}`; } console.log(userId(user)); // 42 console.log(whois(user)); // "jdoe is John" This unpacks the id, displayName and firstName from the user object and prints them. Setting a function parameter's default value function draw
Chart({size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}) { console.log(size, coords, radius); // do some
chart drawing } draw
Chart({ coords: {x: 18, y: 30}, radius: 30 }); In the function signature for draw
Chart above, the destructured left-hand side is assigned to an empty object literal on the right-hand side: {size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}. You could have a...
...hand side is assigned to an empty object literal on the right-hand side: {size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}. You could have also written the function without the right-hand side assignment. However, if you leave out the right-hand side assignment, the function will look for at least one argument to be supplied when invoked, whereas in its current form, you can simply call draw
Chart() without supplying any parameters. The current design is useful if you want to be able to call the function without supplying any parameters, the other can be useful when you want to ensure an object is passed to the function. Nested object and array destructuring const metadata = { title: 'Scratchpad', translations: [ { locale: 'de', localization_tags: [], last_edi...
... let k...
...mith', sister: 'Samantha Smith' }, age: 35 }, { name: 'Tom Jones', family: { mother: 'Norah Jones', father: 'Ri
chard Jones', brother: 'Howard Jones' }, age: 25 } ]; for (const {name: n, family: {father: f}} of people) { console.log('Name: ' + n + ', Father: ' + f); } // "Name: Mike Smith, Father: Harry Smith" // "Name: Tom Jones, Father: Ri
chard Jones" Computed object property names and destructuring Computed property names, like on object literals, can be used with destructuring. let key = 'z'; let {[key]: foo} = {z: 'bar'}; console.log(foo); // "bar" Rest in Object Destructuring The Rest/Spread Properties for ECMAScript proposal (stage 4) adds the rest syntax to destructuring. Rest properties collect the remaining own enumerab...
Template literals (Template strings) - JavaScript
ions. You can use multi-line strings and string interpolation features with them. They were called "template strings" in prior editions of the ES2015 specification. Syntax `string text` `string text line 1 string text line 2` `string text ${expression} string text` tag`string text ${expression} string text` Description Template literals are enclosed by the backtick (` `) (grave accent)
character instead of double or single quotes. Template literals can contain placeholders. These are indicated by the dollar sign and curly braces (${expression}). The expressions in the placeholders and the text between the backticks (` `) get passed to a function. The default function just concatenates the parts into a single string. If there is an expression preceding the template literal (tag her...
...e string. If there is an expression preceding the template literal (tag here), this is called a tagged template. In that case, the tag expression (usually a function) gets called with the template literal, which you can then manipulate before outputting. To escape a backtick in a template literal, put a backslash (\) before the backtick. `\`` === '`' // --> true Multi-line strings Any newline
characters inserted in the source are part of the template literal. Using normal strings, you would have to use the following syntax in order to get multi-line strings: console.log('string text line 1\n' + 'string text line 2'); // "string text line 1 // string text line 2" Using template literals, you can do the same like this: console.log(`string text line 1 string text line 2`); // "string text...
...DN. I'm almost 30 years old." Raw strings The special raw property, available on the first argument to the tag function, allows you to access the raw strings as they were entered, without processing escape sequences. function tag(strings) { console.log(strings.raw[0]); } tag`string text line 1 \n string text line 2`; // logs "string text line 1 \n string text line 2" , // including the two
characters '\' and 'n' In addition, the String.raw() method exists to create raw strings--just like the default template function and string concatenation would create. let str = String.raw`Hi\n${2+3}!`; // "Hi\n5!" str.length; // 6 Array.from(str).join(','); // "H,i,\,n,5,!" Tagged templates and escape sequences ES2016 behavior As of ECMAScript 2016, tagged templates conform to the rules of ...
...The ECMAScript proposal Template Literal Revision (Stage 4, to be integrated in the ECMAScript 2018 standard) removes the syntax restriction of ECMAScript escape sequences from tagged templates. However...
Image file type and format guide - Web media technologies
ossy methods are available. PNG icons are always compressed losslessly. Licensing -- JPEG (Joint Photographic Experts Group image) The JPEG (typically pronounced "jay-peg") image format is currently the most widely used lossy compression format for still images. It's particulary useful for photographs; applying lossy compression to content requiring sharpness, like diagrams or
charts, can produce unsatisfactory results. JPEG is actually a data format for compressed photos, rather than a file type. The JFIF (JPEG File Interchange Format) specification describes the format of the files we think of as "JPEG" images. MIME type image/jpeg File extension(s) .jpg, .jpeg, .jpe, .jif, .jfif Specification jpeg.org/jpeg/ Browser compatibi...
...have not supported XBM files in many years, but when dealing with older content, you may find some still around. XBM uses a snippet of C code to represent the contents of the image as an array of bytes. ...
...tspot, if the image is designed as a cursor), followed by an array of unsigned
char, where each value contains 8 1-bit monochrome pixels. The image must be a multiple of 8 pixels wide. ...
...'s any text in your screenshot, as text easily becomes fuzzy and unclear under lossy compression. PNG is probably your best bet, but lossless WebP is arguably going to be better compressed. Best choice Fallback Lossless WebP or PNG; JPEG if compression artifacts aren't a concern PNG or JPEG; GIF for screenshots with low color counts Diagrams, drawings, and
charts For any image that can be represented using vector graphics, SVG is the best choice. Otherwise, you should use a lossless format like PNG. If you do choose a lossy format, such as JPEG or lossy WebP, carefully weigh the compression level to avoid causing text or other shapes to become fuzzy or unclear. Best choice Fallback SVG PNG Providing image fallbacks Whil...
Web video codec guide - Web media technologies
The simplest guideline is this: anything that makes the encoded video look more like the original, uncompressed, video will generally make the resulting data larger as well. Thus, it's always a tradeoff of size versus quality. In some situations, a greater sacrifice of quality in order to bring down the data size is worth t...
...resenting the image's pixels in grayscale) and the Cb and Cr samples (indicating how to alter the grays to create color pixels), the three channels are instead treated as three monochrome images, one for each color, which are then combined during rendering to produce a full-color image. HEVC is a proprietary format and is covered by a number of patents. Licensing is managed by MPEG LA; fees are
charged to developers rather than to content producers and distributors. Be sure to review the latest license terms and requirements before making a decision on whether or not to use HEVC in your app or web site! Supported bit rates Up to 800,000 Kbps Supported frame rates Varies by level; up to 300 FPS is possible Compression Lossy DCT-based algorithm Sup...
... need to adjust these values depending on hardware performance, your requirements, and the specific codecs you choose to use. This bit rate is obviously not realistic for network transmission and would likely only be used locally. Breaking down the value of the codecs parameter into its dot-delineated properties, we see the following: Value Desccription av01 The four-
character code (4CC) designation identifying the AV1 codec. 2 The profile. A value of 2 indicates the Professional profile. A value of 1 is the High profile, while a value of 0 would specify the Main profile. 19H The level and tier. This value comes from the table in section A.3 of the AV1 specification, and indicates the high tier of Level 6.3. 12 The color depth. ...
...pling mode, taken from section 6.4.2 in the AV1 specification. A value of 000, combined with the monochrome mode value 0, indicates that we want 4:4:4 chroma subsampling, or no loss of color data. 09 The color primaries to use. This value comes from section 6.4.2 in the AV1 specification; 9 indicates that we want to use BT.2020 color, which is used for HDR. 16 The transfer
characteristics to use. This comes from section 6.4.2 as well; 16 indicates that we want to use the
characteristics for BT.2100 PQ color. 09 The matrix coefficents to use, from the section 6.4.2 again. A value of 9 specifies that we want to use BT.2020 with variable luminance; this is also known as BT.2010 YbCbCr. 1 The video "full range" flag. A value of 1 indicates that we wa...
xml:space - SVG: Scalable Vector Graphics
Child elements inside an element may also have an xml:space attribute that overrides the parent's one. Note: Instead of using the xml:space attribute, use the white-space CSS property. This attribute influences how browsers parse text content and therefore changes the way the DOM is built. Therefore, changing this attribute's value through the DOM API may have no effect. All elements are using this attribute. ...
...e. html, body, svg { height: 100%; } <svg viewBox="0 0 140 50" xmlns="http://www.w3.org/2000/svg"> <text y="20" xml:space="default">Default spacing</text> <text y="40" xml:space="preserve">Preserved spacing</text> </svg> Usage notes Value default | preserve Default value default Animatable No default With this value set, whitespace
characters will be processed in this order: All newline
characters are removed. All tab
characters are converted into space
characters. All leading and trailing space
characters are removed. All contiguous space
characters are collapsed into a single space
character. preserve This value tells the user agent to convert all newline and tab
characters into spaces. Then, it draws all s...
... For example, the string "a b" (three spaces between "a" and "b") separates "a" and "b" more than "a b" (one space between "a" and "b"). ...
... For example, the string "a b" (three spaces between "a" and "b") separates "a" and "b" more than "a b" (one space between "a" and "b"). Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'xml:space' in that specification. ...
XML introduction - XML: Extensible Markup Language
"?> <message> <warning> Hello World </warning> </message> A document that contains an undefined tag is invalid. For example, if we never defined the <warning> tag, the document above wouldn't be valid. Most browsers offer a debugger that can identify poorly-formed XML documents. ...
...hat contains an undefined tag is invalid. For example, if we never defined the <warning> tag, the document above wouldn't be valid. Most browsers offer a debugger that can identify poorly-formed XML documents. Entities Like HTML, XML offers methods (called entities) for referring to some special reserved
characters (such as a greater than sign which is used for tags). ...
..., if we never defined the <warning> tag, the document above wouldn't be valid. Most browsers offer a debugger that can identify poorly-formed XML documents. Entities Like HTML, XML offers methods (called entities) for referring to some special reserved
characters (such as a greater than sign which is used for tags). There are five of these
characters that you should know: Entity
Character Description < < Less than sign > > Greater than sign & & Ampersand " " One double-quotation mark ' ' One apostrophe (or single-quotation mark) Even though there are only 5 declared entities, more can be added using the document's Document Type Definition. For example, to create a new ...
... Even though there are only 5 declared entities, more can be added using the document's Document Type Definition. For example, to create a new &warning; entity, you can do this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE body [ <!ENTITY warning "Warning: Something bad happened... please refresh and try again."> ]> <body> <message> &warning; </message> </body> You can also use numeric
character references to specify special
characters; for example, © is the "(C)" symbol. Displaying XML XML is usually used for descriptive purposes, but there are ways to display XML data. If you don't define a specific way for the XML to be rendered, the raw XML is displayed in the browser. One way to style XML output is to specify CSS to apply to the document using the xml-stylesheet process...
base64 - Archive of obsolete content
Data encoding and decoding using Base64 algorithms. var base64 = require("sdk/base64"); var encodedData = base64.encode("Hello, World"); var decodedData = base64.decode(encodedData); Globals Functions encode(data,
charset) Creates a base-64 encoded ASCII string from a string of binary data. Parameters data : string The data to encode
charset : string The
charset of the string to encode (optional). The only accepted value is "utf-8". In order to encode and decode Unicode strings, the
charset parameter needs to be set: var base64 = require("sdk/base64"); var encodedData = base64.encode(unicodeString, "utf-8"); Returns string : The encoded string decode(data,
charset) Decodes a string of data which has been encoded using base-64 encoding. Parameters data : string The encod...
.... The only accepted value is "utf-8". In order to encode and decode Unicode strings, the
charset parameter needs to be set: var base64 = require("sdk/base64"); var encodedData = base64.encode(unicodeString, "utf-8"); Returns string : The encoded string decode(data,
charset) Decodes a string of data which has been encoded using base-64 encoding. Parameters data : string The encoded data
charset : string The
charset of the string to encode (optional). The only accepted value is "utf-8". ...
...se64"); var encodedData = base64.encode(unicodeString, "utf-8"); Returns string : The encoded string decode(data,
charset) Decodes a string of data which has been encoded using base-64 encoding. Parameters data : string The encoded data
charset : string The
charset of the string to encode (optional). The only accepted value is "utf-8". ...
io/file - Archive of obsolete content
which you could then use with join. For now, you need to require("chrome") and use the XPCOM directory service as described in this article about File I/O. Note that if you do decide to hardcode Windows-style paths, be sure to escape backslashes in strings. For example, to specify the file at C:\Users\Myk, you need to use the string "C:\\Users\\Myk", not "C:\Users\Myk". Read more about escaping
characters in strings. Globals Functions basename(path) The path parameter must be an absolute path, relative paths will cause an error. Use the fs/path module for relative path support. Returns the last component of the given path. For example, basename("/foo/bar/baz") returns "baz". If the path has no components, the empty string is returned. Parameters path : string The path of a file. ...
.... mkpath(path) Makes a new directory named by the given path. Any subdirectories that do not exist are also created. mkpath can be called multiple times on the same path. Parameters path : string The path to create. open(path, mode) Returns a stream providing access to the contents of a file. Parameters path : string The path of the file to open. mode : string An optional string, each
character of which describes a
characteristic of the returned stream. If the string contains "r", the file is opened in read-only mode. "w" opens the file in write-only mode. "b" opens the file in binary mode. If "b" is not present, the file is opened in text mode, and its contents are assumed to be UTF-8. If mode is not given, "r" is assumed, and the file is opened in read-only text mode. Apa...
...d, and if binary write-only mode, a ByteWriter is returned. See byte-streams for more information on these byte stream objects. Opened files should always be closed after use by calling close on the returned stream. read(path, mode) Opens a file and returns a string containing its entire contents. Parameters path : string The path of the file to read. mode : string An optional string, each
character of which describes a
characteristic of the returned stream. If the string contains "b", the contents will be returned in binary mode. If "b" is not present or mode is not given, the file contents will be returned in text mode. Returns string : A string containing the file's entire contents. remove(path) Removes a file from the file system. To remove directories, use rmdir. Parameters p...
File I/O - Archive of obsolete content
ata is a string // You can also optionally pass a flags parameter here. It defaults to // FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE; var ostream = FileUtils.openSafeFileOutputStream(file); var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. createInstance(Components.interfaces.nsIScriptableUnicodeConverter); converter.
charset = "UTF-8"; var istream = converter.convertToInputStream(data); // The last argument (the callback) is optional. NetUtil.asyncCopy(istream, ostream, function(status) { if (!Components.isSuccessCode(status)) { // Handle error! return; } // Data has been written to the file. }); Copy a stream to a file This function copies all of the data from an input stream to a file asyncron...
... // open an input stream from file var istream = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); istream.init(file, 0x01, 0444, 0); istream.QueryInterface(Components.interfaces.nsILineInputStream); // read lines into array ...
... (str = {}) { let read = 0; do { read = cstream.readString(0xffffffff, str); // read as much as we can and put it in str.value data += str.value; } while (read != 0); } cstream.close(); // this closes fstream alert(data); Reading Line by Line NOTE: The sample code below does not handle text with non-ASCII
characters. See Reading textual data details on how to read text from other
character sets. // open an input stream from file var istream = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); istream.init(file, 0x01, 0444, 0); istream.QueryInterface(Components.interfaces.nsILineInputStream); // read lines into array var line = {}, lines = [], hasmore; do { hasmore = istream.readLine(line);...
How to convert an overlay extension to restartless - Archive of obsolete content
from a standardized file automatically. Restartless extensions don't (for no good reason). This part is fairly easy to implement yourself, at least. ...
... return undefined; // PREF_INVALID case 32: return getU
CharPref(prefName,branch); // PREF_STRING case 64: return branch.getIntPref(prefName); // PREF_INT case 128: return branch.getBoolPref(prefName); // PREF_BOOL } } function setGenericPref(branch,prefName,prefValue) { switch (typeof prefValue) { case "string": setU
CharPref(prefName,prefValue,branch); return; case "number": branch.setIntPref(prefName,prefValue); return; case "boolean": branch.setBoolPref(prefName,prefValue); return; } } function setDefaultPref(prefName,prefValue) { var defaultBranch = Services.prefs.getDefaultBranch(null); setGenericPref(defaultBranch,prefName,prefValue); ...
...refValue,branch); return; case "number": branch.setIntPref(prefName,prefValue); return; case "boolean": branch.setBoolPref(prefName,prefValue); return; } } function setDefaultPref(prefName,prefValue) { var defaultBranch = Services.prefs.getDefaultBranch(null); setGenericPref(defaultBranch,prefName,prefValue); } function getU
CharPref(prefName,branch) // Unicode get
CharPref { branch = branch ? branch : Services.prefs; return branch.getComplexValue(prefName, Components.interfaces.nsISupportsString).data; } function setU
CharPref(prefName,text,branch) // Unicode set
CharPref { var string = Components.classes["@mozilla.org/supports-string;1"] .createInstance(Components.interfaces.nsISupp...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
or the session-management extension will look like. Under the Tool menu, the Session Store submenu contains two items--Save Session and Clear Sessions; in between them is a list of previously saved sessions that you can restore, most recent first. FIXME: Figure 12: Session-management extension interface: the menu As discussed in the part "The Session Store API", sessions are represented as JSON
character strings. Sessions are stored in a subdirectory of the profile directory (called "sessionstore"), with each session stored as a text file in it (Figure 13). FIXME: Figure 13: Schematic of session saving and restorin Source file structure FIXME: Figure 14 shows the directory structure for this project Creating install manifest Create your work folder, and create an install manifest with t...
...1"]. createInstance(Components.interfaces.nsIFileInputStream); stream.init(aFile, 0x01, 0, 0); var cvstream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]. createInstance(Components.interfaces.nsIConverterInputStream); cvstream.init(stream, "UTF-8", 1024, Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_
CHARACTER); var content = ""; var data = {}; while (cvstream.readString(4096, data)) { content += data.value; } cvstream.close(); return content.replace(/\r\n?/g, "\n"); } catch (ex) { } return null; }, _writeFile method Creates a new file for the nslFile object passed as a parameter, and writes the text string, also passed as a parameter. U...
...sses["@mozilla.org/network/safe-file-output-stream;1"]. createInstance(Components.interfaces.nsIFileOutputStream); stream.init(aFile, 0x02 | 0x08 | 0x20, 0600, 0); // convert to UTF-8 var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. ...
The Essentials of an Extension - Archive of obsolete content
tion/x-javascript" src="chrome://xulschoolhello/content/browserOverlay.js" /> Just like in HTML, this includes a JavaScript script file. You can have as many script elements in a XUL document as you need. We'll look into its code later. You also probably noticed how we format our code, and wonder about the rules we follow. ...
...er. You also probably noticed how we format our code, and wonder about the rules we follow. Our general rule on line length is not having lines longer than 80
characters. This feels very restrictive, specially with XML files, but the number was chosen to allow pretty much any text editor to handle these files easily. Even old command line editors work well with files that cut their lines at 80
characters. The tabulation is very straightforward: 2 blank space indents. We never use actual tab
characters, with the exception of Makefiles, which will be covered later on. Most of our coding standards are based on Mozilla's or other known and used standards. We'll skip some code that is covered in the locale section, moving on to the most important part of the content: <menubar id="main-menu...
...ppend your element as the last child of the parent element. All you need for the string bundle is an id (to be able to fetch the element later) and the chrome path to the properties file. And, of course, you need the properties file: xulschoolhello.greeting.label = Hi! How are you? The whitespace around the equals sign is ignored. Just like in install.rdf, comments can be added using the #
character at the beginning of the line. Empty lines are ignored as well. You will often want to include dynamic content as part of localized strings, like when you want to inform the user about some stat related to the extension. For example: "Found 5 words matching the search query". Your first idea would probably be to simply concatenate strings, and have one "Found" property and another "words mat...
Search Extension Tutorial (Draft) - Archive of obsolete content
first run. var firstRun = false; // Get the root user preference branch. var userPrefs = Services.prefs.getBranch(""); // Get the root default preference branch. var defaultPrefs = Services.prefs.getDefaultBranch(""); // Save the original values. var savedPrefs = {} // Change the default value of the preference *name* to *value*. // A default for this preference must exist, and it must be a //
character preference. function setPref(name, value, localized) { // If this is a localized preference, transform the value into an // appropriate data: URL. if (localized) value = "data:text/plain," + encodeURIComponent(name + "=" + value.replace(/ /g, "\\u0020")); // Save the original and new values. savedPrefs[name] = [defaultPrefs.get
CharPref(name), value]; // Chan...
...name, value, localized) { // If this is a localized preference, transform the value into an // appropriate data: URL. if (localized) value = "data:text/plain," + encodeURIComponent(name + "=" + value.replace(/ /g, "\\u0020")); // Save the original and new values. savedPrefs[name] = [defaultPrefs.get
CharPref(name), value]; // Change the default defaultPrefs.set
CharPref(name, value); // Clear the user value if this is the first run, or the // new default is the same as the user value. if (firstRun || userPrefs.get
CharPref(name) == value) userPrefs.clearUserPref(name); } function startup(data, reason) { firstRun = reason == ADDON_INSTALL; // Change the default engine name. // An engine with this name must already exist. ...
...dy exist. setPref("browser.search.defaultenginename", "Example Engine", true); } function shutdown(data, reason) { // No need to do this if this is app shutdown. if (reason == APP_SHUTDOWN) return; // Reset our changes if the values have not been changed // in the meantime. for (let [name, [origValue, value]] in Iterator(savedPrefs)) { if (defaultPrefs.get
CharPref(name) == value) defaultPrefs.set
CharPref(name, origValue); } } function install() {} function uninstall() {} Changing the Default Search Engine This change comes in two parts: 1) installing a new search engine (and removing it when your extension is disabled), and 2) setting it as a default (and restoring the previous default when your extension is uninstalled). Adding a New...
CSS3 - Archive of obsolete content
Substring matching attribute selectors, E[attribute^="value"], E[attribute$="value"], E[attribute*="value"] . New pseudo-classes: :target, :enabled and :disabled, :checked, :indeterminate, :root, :nth-child and :nth-last-child, :nth-of-type and :nth-last-of-type, :last-child, :first-of-type and :last-of-type, :only-child and :only-of-type,:empty, and :not. Pseudo-elements are now
characterized by two colons rather than one: :after becomes ::after, :before becomes ::before, :first-letter becomes ::first-letter, and :first-line becomes ::first-line. The new general sibling combinator ( h1~pre ). The next iteration of the Selectors specification is already in progress, though it still hasn't reached the First Public Working Draft stage. Media Querie...
...k) with the CSS box-decoration-break property. CSS Custom Properties for Cascading Variables Module Level 1 Candidate Recommendation Defines a mechanism allowing to define variables in CSS. Compositing and Blending Level 1 Candidate Recommendation CSS Syntax Level 3 Candidate Recommendation Clarifies how
charsets are determined; minor changes in parsing and tokenization algorithms. CSS Grid Layout Candidate Recommendation Add a grid layout to the CSS display property and several new CSS properties to control it: grid, grid-area, grid-auto-columns, grid-auto-flow, grid-auto-position, grid-auto-rows, grid-column, grid-column-start, grid-column-end, grid-row, grid-row-start, g...
...Draft CSS Text Module Level 3 Working Draft Extends: the CSS text-transform 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...
Mozilla Application Framework in Detail - Archive of obsolete content
he Gecko browser engine represents a major advance for developers. With Gecko, developers seeking a streamlined way to create and distribute web-based services across multiple platforms and devices can write once to W3C standards and their content and web applications will be accessible from across computing platforms and devices. Gecko is based on contributions from mozilla.org, the organization
chartered with managing Netscape's open source initiative among thousands of Internet developers and participating vendors such as Netscape. The Gecko browser engine offers several key benefits including: Size: Gecko has been designed to be lean and modular, bringing full-functionality browsing to a variety of new consumer devices. Because it is small, Gecko can be embedded on devices with limited ...
... interfaces such as the Web Shell API, the Java wrapper API and the Gecko ActiveX Control make Gecko easily embeddable into applications and devices. Full Browser Functionality: Gecko allows any desktop application as well as new devices, products and appliances to be web-enabled, with complete browser functionality. Supported standards and features include Data Transport Protocols, Multilingual
Character Data, Image Data, Java and Plugins. Open Source: Gecko represents the first software release from Netscape and mozilla.org's open source initiative. By harnessing the talent of thousands of developers worldwide, mozilla.org has accelerated Internet software development and increased the quality of the final product, delivering unmatched support for web standards. In addition, independent so...
...velopment and increased the quality of the final product, delivering unmatched support for web standards. In addition, independent software developers and corporate Information Technology departments now have complete access to the modular source code and freedom to freely license the source, make changes and build customized versions to accommodate their individual needs. Free: Gecko is free of
charge. There is no
charge for using the Gecko browser engine or Gecko Technologies, including distributing Gecko inside another product. Furthermore, when embedding Gecko, developers are free to choose what modules to include. There is no requirement for distribution of any other software. The Necko Network Library Mozilla's Network library (aka Necko) provides an extensible, platform-independent AP...
Index - Archive of obsolete content
Files | Uploading and Downloading Files | Working With Directories ] 433 Writing to Files To write to a file, an output stream is used. An output stream is an object which can be used to write bytes, strings and other values to a file. To create an output stream, use nsIScriptableIO.newOutputStream(). This method has a number of options to specify text or binary writing, the
character set, and whether to append to an existing file or create a new one. 434 How to Quit a XUL Application XUL, XULRunner Script can attempt to quit a XUL application, or force the application to quit, using the nsIAppStartup interface. 435 How to implement a custom XUL query processor component XUL supports templating to create a block of content from a...
...mplates. XUL provides template query processors for RDF, XML and SQL (mozStorage). The templating system also supports building custom query processors. Custom query processors are XPCOM components, must implement the nsIXULTemplateQueryProcessor interface and follow some conventions for when registering the component. 436 Index Found 1218 pages: 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 arrangement and even presenc...
...n NeedsHelp, XUL Properties, XUL Reference No summary! 690 disableautoselect XUL Properties, XUL Reference No summary! 691 disabled XUL Properties, XUL Reference No summary! 692 dlgType XUL Properties, XUL Reference No summary! 693 docShell XUL Properties, XUL Reference No summary! 694 document
CharsetInfo XUL Properties, XUL Reference No summary! 695 editable XUL Properties, XUL Reference No summary! 696 editingColumn XUL Properties, XUL Reference No summary! 697 editingRow XUL Properties, XUL Reference No summary! 698 editingSession XUL Properties, XUL Reference No summary! 699 editor ...
Accesskey display rules - Archive of obsolete content
elements display their accesskeys in their label automatically if it's necessary. This document describes the rules of generating a label text. XUL elements don't display any accesskeys on Mac XUL elements don't display any accesskeys on Mac. Because MacOS X doesn't have the conception of accesskey function on its native widgets/applications. Basic accesskey display rules On non-Mac platforms, a
character which is same as its accesskey is underlined. E.g., when an accesskey of "File" is 'F', the generated label will be "File". If a label has two or more
characters which are same as its accesskey, the first
character of them will be underlined. If a label doesn't have the
character, XUL elements append the accesskey
character with parentheses. E.g., when an accesskey of "Open" is 'A', the ge...
...I.e., when an accesskey of "Open..." is 'A', the generated label will be "Open (A)...". And also when an accesskey of "Your Name:" is 'B', the generated label will be "Your Name (B):". ...
...his document calls the appended text "accesskey text". Always appends accesskey text The basic rules are enough for Western locales. However, in some locales, e.g., Japanese localized build, its most UI labels don't have alphabets but alphabets are used to accesskey. For coherence of the labels on such localized builds, the accesskey text is always appended even if the labels have their accesskey
characters. E.g., when an accesskey of "OK" is 'O' and an accesskey of "?????" (means "cancel") is 'C', the labels will be "OK(O)" and "?????(C)" on Japanese localized build. XUL elements check "intl.menuitems.alwaysappendaccesskeys" pref value whether they should append accesskey text always. If the value is "true" (string), the accesskey text will be appended always. Don't change the pref value from...
Property Files - Archive of obsolete content
the formatting codes %1$S and %2$S is used, and replaced different order in the array. Formatting code %n$S is specify the position of corresponding parameter directly. Although the word order is not the same in all the languages, by using getFormattedString() the specification of the order can be put out the property files. In case you need to format a string that already contains the percentage
character in it (to get something like "50% Off" returned), escape the percentage
character with another percentage
character, like this: my.percentage.string = %S%% Off Not escaping the percentage
character will generate an incorrect string that strips the space
character between the percentage
character and the next word of the string ("50%Off"). Non-ASCII
Characters, UTF-8 and escaping Gecko 1.8.x...
...ith another percentage
character, like this: my.percentage.string = %S%% Off Not escaping the percentage
character will generate an incorrect string that strips the space
character between the percentage
character and the next word of the string ("50%Off"). Non-ASCII
Characters, UTF-8 and escaping Gecko 1.8.x (or later) supports property files encoded in UTF-8. You can and should write non-ASCII
characters directly without escape sequences, and save the file as UTF-8 without BOM. Double-check the save options of your text editor, because many don't do this by default. See Localizing extension descriptions for more details. In some cases, it may be useful or needed to use escape sequences to express some
characters. Property files support escape sequences of the form: \uXXXX , where XXXX is a ...
...irectly without escape sequences, and save the file as UTF-8 without BOM. Double-check the save options of your text editor, because many don't do this by default. See Localizing extension descriptions for more details. In some cases, it may be useful or needed to use escape sequences to express some
characters. Property files support escape sequences of the form: \uXXXX , where XXXX is a Unicode
character code. For example, to put a space at the beginning or end of a string (which would normally be stripped by the properties file parser), use \u0020 . In the next section, we will look at XBL, which can be used to define the behavior of an element. << PreviousNext >> See Also How to localize html pages, xul files, and js/jsm files from bootstrapped add-ons: Bootstrapped Extensions :...
menulist - Archive of obsolete content
crop Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place ...
... crop Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box dir...
...removeItemAt, select Examples <menulist> <menupopup> <menuitem label="option 1" value="1"/> <menuitem label="option 2" value="2"/> <menuitem label="option 3" value="3"/> <menuitem label="option 4" value="4"/> </menupopup> </menulist> 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. crop Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. ...
application/http-index-format specification - Archive of obsolete content
ile format data if there is one. This data should be presented to the user when they are viewing data drawn from the file. This data should be parsed as HTML. 200 Defines the field names for the 201 file index code. A valid 200 line consists of one or more white space separated tokens that describe the name or purpose of the associated column of data. Tokens may not contain spaces. Any illegal
characters must be escaped via the URL escaping syntax defined by RFC 1738. Note that multiple 200 lines override previous 200 lines. 201 Data whose definition stems from a prior 200 line. A valid 201 line consists of one or more white space separated tokens that represent data described by a previous 200 line. Tokens may be quoted or unquoted. Unquoted tokens may not contain white space. Quoted to...
... override previous 200 lines. 201 Data whose definition stems from a prior 200 line. A valid 201 line consists of one or more white space separated tokens that represent data described by a previous 200 line. Tokens may be quoted or unquoted. Unquoted tokens may not contain white space. Quoted tokens are terminated by the next quote but may not contain carrage returns or new lines. Any illegal
characters must be escaped via the URL escaping syntax defined by RFC 1738. Note that a 201 line encountered before a 200 line should be ignored. 300 A URL pointing to the directory represented by the index if there is one. A valid path token must be URL escaped. Valid 200 tokens Note that all tokens are case insensitive. Filename The name of file that can be used to retrieve the file when co...
...te that a 201 line encountered before a 200 line should be ignored. 300 A URL pointing to the directory represented by the index if there is one. A valid path token must be URL escaped. Valid 200 tokens Note that all tokens are case insensitive. Filename The name of file that can be used to retrieve the file when combined with the full path provided by the 300 line. White space and 8 bit
characters must be URL encoded. Content-Length Base 10 digits representing the size of the file in bytes. Only digits are legal. Last-Modified RFC 1123 date format URL encoded. Content-type MIME content type. Whitespace and 8-bit
characters must be URL-encoded. The MIME-type for a directory can be given as application/http-index-format. File-type One of the following keywords to represent ...
Vulnerabilities - Archive of obsolete content
ses three high-level vulnerability categories: software flaws, security configuration issues, and software feature misuse. These categories are described below. Vulnerability Categories A software flaw vulnerability is caused by an unintended error in the design or coding of software. An example is an input validation error, such as user-provided input not being properly evaluated for malicious
character strings and overly long values associated with known attacks. Another example is a race condition error that allows the attacker to perform a specific action with elevated privileges. A security configuration setting is an element of a software's security that can be altered through the software itself. Examples of settings are an operating system offering access to control lists that set t...
...rating a single failed login attempt for each user account. Because of the number of vulnerabilities inherent in security configuration settings and software feature misuse possibilities, plus the number of software flaw vulnerabilities on a system at any given time, there may be dozens or hundreds of vulnerabilities on a single system. These vulnerabilities are likely to have a wide variety of
characteristics. Some will be very easy to exploit, while others will only be exploitable under a combination of highly unlikely conditions. One vulnerability might provide root-level access to a system, while another vulnerability might only permit read access to an insignificant file. Ultimately, organizations need to know how difficult it is for someone to exploit each vulnerability and, if a vul...
... One vulnerability might provide root-level access to a system, while another vulnerability might only permit read access to an insignificant file. Ultimately, organizations need to know how difficult it is for someone to exploit each vulnerability and, if a vulnerability is exploited, what the possible impact would be. Website Vulnerabilities OWASP or Open Web Security Project is a non-profit
charitable organization focused on improving the security of software and web applications. According to the Open Web Application Security Project, XSS was the seventh most common Web app vulnerability in 2017. The organization publishes a list of top web security vulnerabilities based on the data from various security organizations. The web security vulnerabilities are prioritized depending on expl...
Developing cross-browser and cross-platform pages - Archive of obsolete content
rs or to decide to provide future browsers a safe fallback service. It assumes that web authors are able to correctly identify browsers and browser versions in the first place... which is far from being a reliable and easy task to achieve. The browser identification approach relies on functions that check the browser type string value and browser version string value and that search for certains
characters or sub-strings in the navigator.userAgent property string. Once "detected", the web author then uses different functions (aka code branching) or points the user to different pages (aka site branching) or web content. Site branching can be particularly dangerous as people may enter a page through a link, bookmark, search engine or cache with a "wrong" browser. Let's see a basic example of t...
...rty string. Once "detected", the web author then uses different functions (aka code branching) or points the user to different pages (aka site branching) or web content. Site branching can be particularly dangerous as people may enter a page through a link, bookmark, search engine or cache with a "wrong" browser. Let's see a basic example of this approach. ...
...As new browsers are released, it becomes necessary to make updates to such code which attempts to narrow down the browser and browser version and to make the appropriate switches. Another major problem with this approach is that the browser identity can be "spoofed" because, in many modern browsers, the navigator.appVersion and navigator.userAgent ...
Using workers in extensions - Archive of obsolete content
var self = this; this.worker.onmessage = function(event) { self.onworkermessage.call(self, event); }; this.worker.postMessage(this.tickerSymbol); ...
...bserve() method This method's job is to update which stock is being monitored when the user changes the preferences. It needs to be updated to post a message to the worker to tell it which stock symbol to track. observe: function(subject, topic, data) { if (topic != "nsPref:changed") { return; } switch(data) { case "symbol": this.tickerSymbol = this.prefs.get
CharPref("symbol").toUpperCase(); this.worker.postMessage(this.tickerSymbol); break; } }, The key here is line 10, which sends the new ticker symbol to monitor to the ticker thread by calling its postMessage() method. This results in the ticker's onmessage handler being called. The watchStock() and refreshInformation() methods These two methods are very simple. watchStock() i...
...two methods are very simple. watchStock() is updated to pass the symbol to the ticker thread, and refreshInformation(), whose main functionality is now in the worker, is updated to simply pass an empty message to the worker, which tells the worker to refresh the stock information immediately. watchStock: function(newSymbol) { this.tickerSymbol = newSymbol.toUpperCase(); this.prefs.set
CharPref("symbol", newSymbol); this.worker.postMessage(this.tickerSymbol); }, refreshInformation: function() { // Empty message just means 'refresh'. this.worker.postMessage(""); }, The onworkermessage() method This method is called when the worker posts a message back to the main thread. Its job is to update the ticker information that's currently displayed in the status bar, ...
XForms Output Element - Archive of obsolete content
epresent instance data of type date (xhtml/xul). 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 (Fx 3.0 only, xhtml/xul). text Displaying the data as text is the default presentation. XForms output is most often used when a form author needs to render simple text of an instance node (xhtml/xul).
Characteristics text is presented to the user when there is no type given for the bound node or a type is specified that is not handled by one of the other widgets (as documented below). analogous widgets are <xhtml:span/> and <xul:description/> calendar A form author may notice a XForms output element represented by a calendar widget in the Mozilla XForms processor if the control meets the foll...
...ted to the user when there is no type given for the bound node or a type is specified that is not handled by one of the other widgets (as documented below). analogous widgets are <xhtml:span/> and <xul:description/> calendar A form author may notice a XForms output element represented by a calendar widget in the Mozilla XForms processor if the control meets the following criteria (xhtml/xul).
Characteristics the bound instance node is of type xsd:date or a type derived from it in addition, the appearance attribute must also contain the value "full" firefox 2.0 doesn't currently have any similar widgets available for use with XHTML or XUL. image If the bound instance node contains an image then you are free to use this representation to show the image instead of the byte sequence of ...
...of type xsd:date or a type derived from it in addition, the appearance attribute must also contain the value "full" firefox 2.0 doesn't currently have any similar widgets available for use with XHTML or XUL. image If the bound instance node contains an image then you are free to use this representation to show the image instead of the byte sequence of the image data (Fx 3.0 only, xhtml/xul).
Characteristics the bound instance node is of type xsd:anyURI, xsd:base64Binary or a type derived from it either the mediatype attribute is present and contains the image's mimetype or the output element contains a mediatype element which specifies the image's mimetype (for example, image/*). ...
XForms Select1 Element - Archive of obsolete content
s bound to. Representations The XForms select1 element can be represented by the following widgets for the specified appearance attribute values: combobox - default representation (xhtml/xul) listbox - used when appearance = 'compact' (xhtml/xul) radio group - used when appearance = 'full' (xhtml/xul) combobox Displaying a combobox is the default representation (xhtml/xul). ...
...mbobox Displaying a combobox is the default representation (xhtml/xul). XHTML widget
characteristics analogous widgets is <html:select/> visual grouping by choices element is supported selection="open" is supported if incremental attribute value is false, the bound node is updated when the select1 control is blurred (i.e. loses focus), otherwise it is updated upon item selection XUL widget
characteristics analogous widgets are <html:select/> and <xul:menulist/> visual grouping by choices element isn't implemented selection="open" attribute isn't supported if incremental attribute value is false, the bound node is updated when the select control is blurred (i.e. loses focus), otherwise it is updated upon item selection listbox The select1 is represented as listbox (xhtml/xul). Ch...
...logous widgets are <html:select size="5"/> and <xul:listbox/> visual grouping by choices element isn't implemented selection="open" attribute isn't supported if incremental attribute value is false, the bound node is updated when the select control is blurred (i.e. loses focus), otherwise it is updated upon item selection radio group The select is represented as group of radios (xhtml/xul). ...
Game monetization - Game development
s -- with a fixed, up front price. Even though the digital market is key and you don't need to print covers and put your game in a physical store in boxes, to earn decent money on selling your games for a fixed price you have to invest your time and money in marketing. Only the best games will break even or earn more than they cost to make, and you still need a lot of luck for that. How much you
charge for your game depends on the market, quality of your game and a lot of other small factors. An arcade iOS title can be sold for 0.99 USD, but a longer RPG-style desktop game on Steam can cost 20 USD; both prices are ok. You have to follow the market and do your own research -- learning from your mistakes quickly is important. In-app purchases Instead of having people pay for your game up fron...
...worst cases were when you could use real money to pay for getting advantages over other players, or when they restricted access to the next stages of the game unless the players paid. The term "pay to win" was coined and this approach is disliked by many players and devs. ...
...s. If you want to implement IAPs try to add value to the game with something players will enjoy instead of taking it out and then
charging for it. Add-ons and DLCs Add-ons and downloadable content are a good way to provide extra value to an already released game, but remember that you'll have to offer decent, entertaining content to attract people to buy it. A totally new set of levels with new
characters, weapons and story is a good material for DLC, but to have enough sales the game itself has to be popular, or else there won't be any players interested in spending their hard earned money on it. Advertisements Instead of actively selling the games you can also try to get yourself a passive income -- showing adverts and relying on previous activities related to promoting your game may ben...
Tiles and tilemaps overview - Game development
(var row = 0; row < map.rows; row++) { var tile = map.getTile(column, row); var x = column * map.tileSize; var y = row * map.tileSize; drawTile(tile, x, y); } } You can read more about this and see an example implementation in Square tilemaps implementation: Static maps. Scrolling tilemaps Scrolling tilemaps only show a small portion of the world at a time. They can follow a
character -- like in platformers or RPGs -- or allow the player to control the camera -- like in strategy or simulation games. Positioning and camera In all scrolling games, we need a translation between world coordinates (the position where sprites or other elements are located in the level or game world) and screen coordinates (the actual position where those elements are rendered on the screen). ...
... of several layers. This allows us to have a richer game world with less tiles, since the same image can be used with different backgrounds. For instance, a rock that could appear on top of several terrain types (like grass, sand or brick) could be included on it's own separate tile which is then rendered on a new layer, instead of several rock tiles, each with a different background terrain. If
characters or other game sprites are drawn in the middle of the layer stack, this allows for interesting effects such as having
characters walking behind trees or buildings. The following screenshot shows an example of both points: a
character appearing behind a tile (the knight appearing behind the top of a tree) and a tile (the bush) being rendered over different terrain types. The logic grid S...
...haracter appearing behind a tile (the knight appearing behind the top of a tree) and a tile (the bush) being rendered over different terrain types. The logic grid Since tilemaps are an actual grid of visual tiles, it is common to create a mapping between this visual grid and a logic grid. The most common case is to use this logic grid to handle collisions, but other uses are possible as well:
character spawning points, detecting whether some elements are placed together in the right way to trigger a certain action (like in Tetris or Bejeweled), path-finding algorithms, etc. Note: You can take a look at our demo that shows how to use a logic grid to handle collisions. Isometric tilemaps Isometric tilemaps create the illusion of a 3D environment, and are extremely popular in 2D simulati...
Entity - MDN Web Docs Glossary: Definitions of Web-related terms
An HTML entity is a piece of text ("string") that begins with an ampersand (&) and ends with a semicolon (;) . Entities are frequently used to display reserved
characters (which would otherwise be interpreted as HTML code), and invisible
characters (like non-breaking spaces). You can also use them in place of other
characters that are difficult to type with a standard keyboard. Many
characters have memorable entities. For example, the entity for the copyright symbol ((C)) is ©. For less memorable
characters, such as — or —, you can use a reference
chart or decoder tool. Reserved
characters Some special
characters are reserved for use in HTML, meaning that your browser will parse them as HTML code. For example, if you use the less-than (<) sign, the browser inte...
... the copyright symbol ((C)) is ©. For less memorable
characters, such as — or —, you can use a reference
chart or decoder tool. Reserved
characters Some special
characters are reserved for use in HTML, meaning that your browser will parse them as HTML code. For example, if you use the less-than (<) sign, the browser interprets any text that follows as a tag. To display these
characters as text, replace them with their corresponding
character entities, as shown in the following table.
Character Entity Note & & Interpreted as the beginning of an entity or
character reference. < < Interpreted as the beginning of a tag > > Interpreted as the ending of a tag " " Interpreted as the be...
...table.
Character Entity Note & & Interpreted as the beginning of an entity or
character reference. ...
Unicode - MDN Web Docs Glossary: Definitions of Web-related terms
Unicode is a standard
character set that numbers and defines
characters from the world's different languages, writing systems, and symbols. By assigning each
character a number, programmers can create
character encodings, to let computers store, process, and transmit any combination of languages in the same file or program. Before Unicode, it was difficult and error-prone to mix languages in the same data. For example, one
character set would store Japanese
characters, and another would store the Arabic alphabet. If it was not clearly marked which parts of the data were in which
character set, other programs and computers would display the text incorrectly, or damage it during processing. ...
...Other encodings exist, like UTF-16 or the obsolete UCS-2, but UTF-8 is recommended. ...
...Other encodings exist, like UTF-16 or the obsolete UCS-2, but UTF-8 is recommended. ...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
// Fix: We test for file extensions as well in case file:// doesn't return content type (as seems to be the case); can some other tool be uesd in FF (or IE) to detect encoding of local file? Probably just need BOM test since other encodings must be specified var patternXML = /\.(svg|xml|xul|rdf|xhtml)...
... // Let the request be processed below } else { if (encoding === '' || encoding === null) { // Encoding has no effect on XML encoding = 'utf-8'; } request.overrideMimeType('text/plain;
charset='+encoding); //'x-user-defined' } responseType = 'responseText'; break; case null: case 'xml': responseType = 'responseXML'; break; default: alert('XInclude...
... encodingType = 'utf-8'; } // Need to make a whole new request apparently since cannot convert the encoding after receiving it (to know what the encoding was) var request2 = new XMLHttpRequest(); request2.overrideMimeType('text/plain;
charset='+encodingType); request2.open('GET', href, false); request2.setRequestHeader('If-Modified-Since', 'Thu, 1 Jan 1970 00:00:00 GMT'); request2.setRequestHeader('Cache-Control', 'no-cache'); request2.send(null); response = reques...
What is a Domain Name? - Learn web development
al TLDs such as .us, .fr, or .se can require the service to be provided in a given language or hosted in a certain country -- they are supposed to indicate a resource in a particular language or country. TLDs containing .gov are only allowed to be used by government departments. The .edu TLD is only for use by educational and academic institutions. ...
...ire the service to be provided in a given language or hosted in a certain country -- they are supposed to indicate a resource in a particular language or country. TLDs containing .gov are only allowed to be used by government departments. The .edu TLD is only for use by educational and academic institutions. TLDs can contain special as well as latin
characters. A TLD's maximum length is 63
characters, although 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, a...
...the right to use a domain name for one or more years. You can renew your right, and your renewal has priority over other people's applications. But you never own the domain name. Companies called registrars use domain name registries to keep track of technical and administrative information connecting you to your domain name. Note : For some domain name, it might not be a registrar which is in
charge of keeping track. For instance, every domain name under .fire is managed by Amazon. Finding an available domain name To find out whether a given domain name is available, Go to a domain name registrar's website. Most of them provide a "whois" service that tells you whether a domain name is available. Alternatively, if you use a system with a built-in shell, type a whois command into it, ...
HTML basics - Learn web development
nformation and other things. An attribute should always have the following: A space between it and the element name (or the previous attribute, if the element already has one or more attributes). The attribute name followed by an equal sign. The attribute value wrapped by opening and closing quotation marks. Note: Simple attribute values that don't contain ASCII whitespace (or any of the
characters " ' ` = < > ) can remain unquoted, but it is recommended that you quote all attribute values, as it makes the code more consistent and understandable. Nesting elements You can put elements inside other elements too -- this is called nesting. If we wanted to state that our cat is very grumpy, we could wrap the word "very" in a <strong> element, which means that the word is to be strongly...
...the HTML page in the place it appears. Anatomy of an HTML document That wraps up the basics of individual HTML elements, but they aren't handy on their own. Now we'll look at how individual elements are combined to form an entire HTML page. Let's revisit the code we put into our index.html example (which we first met in the Dealing with files article): <!DOCTYPE html> <html> <head> <meta
charset="utf-8"> <title>My test page</title> </head> <body> <img src="images/firefox-icon.png" alt="My test image"> </body> </html> Here, we have the following: <!DOCTYPE html> -- the doctype. It is required preamble. In the mists of time, when HTML was young (around 1991/92), doctypes were meant to act as links to a set of rules that the HTML page had to follow to be considered good...
...raps all the content on the entire page and is sometimes known as the root element. <head></head> -- the <head> element. This element acts as a container for all the stuff you want to include on the HTML page that isn't the content you are showing to your page's viewers. This includes things like keywords and a page description that you want to appear in search results, CSS to style our content,
character set declarations and more. <meta
charset="utf-8"> -- This element sets the
character set your document should use to UTF-8 which includes most
characters from the vast majority of written languages. Essentially, it can now handle any textual content you might put on it. There is no reason not to set this and it can help avoid some problems later on. <title></title> -- the <title> element. ...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
imations to run this kind of simple animation. However, this kind of example is very useful to demonstrate requestAnimationFrame() usage, and you'd be more likely to use this kind of technique when doing something more complex such as updating the display of a game on each frame. Grab a basic HTML template (such as this one). Put an empty <div> element inside the <body>, then add a ?
character inside it. This circular arrow
character will act as our spinner for this example. Apply the following CSS to the HTML template (in whatever way you prefer). This sets a red background on the page, sets the <body> height to 100% of the <html> height, and centers the <div> inside the <body>, horizontally and vertically. html { background-color: white; height: 100%; } body { he...
...ou can't choose your frame rate. This isn't a problem most of the time, as generally you want your animation to run as smoothly as possible. But what about when you want to create an old school, 8-bit-style animation? This was a problem, for example, in the Monkey Island-inspired walking animation from our Drawing Graphics article: In this example, you have to animate both the position of the
character on the screen, and the sprite being shown. There are only 6 frames in the sprite's animation. If you showed a different sprite frame for every frame displayed on the screen by requestAnimationFrame(), Guybrush would move his limbs too fast and the animation would look ridiculous. This example therefore throttles the rate at which the sprite cycles its frames using the following code: if (po...
...would move his limbs too fast and the animation would look ridiculous. This example therefore throttles the rate at which the sprite cycles its frames using the following code: if (posX % 13 === 0) { if (sprite === 5) { sprite = 0; } else { sprite++; } } So the code only cycles the sprite once every 13 animation frames. ...Actually, it's about every 6.5 frames, as we update posX (
character's position on the screen) by two each frame: if (posX > width/2) { newStartPos = -( (width/2) + 102 ); posX = Math.ceil(newStartPos / 13) * 13; console.log(posX); } else { posX += 2; } This is the code that calculates how to update the position in each animation frame. The method you use to throttle your animation will depend on your particular code. For instance, in the earlier s...
Server-side web frameworks - Learn web development
ed with users, and about users. Web frameworks often provide a database layer that abstracts database read, write, query, and delete operations. This abstraction layer is referred to as an Object-Relational Mapper (ORM). Using an ORM has two benefits: You can replace the underlying database without necessarily needing to change the code that uses it. This allows developers to optimize for the
characteristics of different databases based on their usage. Basic validation of data can be implemented within the framework. This makes it easier and safer to check that data is stored in the correct type of database field, has the correct format (e.g. an email address), and isn't malicious in any way (crackers can use certain patterns of code to do bad things such as deleting database records). ...
...o specify their maximum size, default values, selection list options, help text for documentation, label text for forms etc. The model doesn't state any information about the underlying database as that is a configuration setting that may be changed separately of our code. The first code snippet below shows a very simple Django model for a Team object. This stores the team name and team level as
character fields and specifies a maximum number of
characters to be stored for each record. The team_level is a choice field, so we also provide a mapping between choices to be displayed and data to be stored, along with a default value. #best/models.py from django.db import models class Team(models.Model): team_name = models.
CharField(max_length=40) TEAM_LEVELS = ( ('U09', 'Under...
...provide a mapping between choices to be displayed and data to be stored, along with a default value. #best/models.py from django.db import models class Team(models.Model): team_name = models.
CharField(max_length=40) TEAM_LEVELS = ( ('U09', 'Under 09s'), ('U10', 'Under 10s'), ('U11', 'Under 11s'), ... #list our other teams ) team_level = models.
CharField(max_length=3,choices=TEAM_LEVELS,default='U11') The Django model provides a simple query API for searching the database. This can match against a number of fields at a time using different criteria (e.g. exact, case-insensitive, greater than, etc.), and can support complex statements (for example, you can specify a search on U11 teams that have a team name that starts with "Fr" or ends wit...
Website security - Learn web development
atement that deletes the users table and selects all data from the userinfo table (which reveals the information of every user). This works because the first part of the injected text (a';) completes the original statement. To avoid this sort of attack, you must ensure that any user data that is passed to an SQL query cannot change the nature of the query. One way to do this is to escape all the
characters in the user input that have a special meaning in SQL. Note: The SQL statement treats the '
character as the beginning and end of a string literal. By putting a backslash in front of this
character (\'), we escape the symbol, and tell SQL to instead treat it as a
character (just a part of the string). In the following statement, we escape the '
character. The SQL will now interpret the n...
...Django, for example, ensures that any user-data passed to querysets (model queries) is escaped. Note: This section draws heavily on the information in Wikipedia here. ...
... through. These defenses are typically located before or in the web server (they are not part of the web application itself). Directory Traversal (File and disclosure). In this attack, a malicious user attempts to access parts of the web server file system that they should not be able to access. This vulnerability occurs when the user is able to pass filenames that include file system navigation
characters (for example, ../../). The solution is to sanitize input before using it. File Inclusion. In this attack, a user is able to specify an "unintended" file for display or execution in data passed to the server. When loaded, this file might be executed on the web server or the client-side (leading to an XSS attack). The solution is to sanitize input before using it. Command Injection. Command...
Command line crash course - Learn web development
midating to begin with, but at least you know it's there if you need it. Once you are finished looking through the man page, you need to quit out of it using your text viewer's quit command ("q" in less; you may have to search on the web to find it if it isn't obvious). Note: To run a command with multiple options at the same time, you can usually put them all in a single string after the dash
character, for example ls -lah, or ls -ltrh. Try looking at the ls man page to work out what these extra options do! Now that we've discussed two fundamental commands, have a little poke around your directory and see if you can navigate from one place to the next. Creating, copying, moving, removing There are a number of other basic utility commands that you'll probably end up using quite a lot as...
...xt called mdn-example.txt.bak (you can of course call it something else if you wish). rm -- removes the specified file. For example, rm mdn-example.txt deletes a single file called mdn-example.txt. Note that this delete is permanent and can't be undone via the recycle bin that you might have on your desktop user interface. Note: Many terminal commands allow you to use asterisks as "wild card"
characters, meaning "any sequence of
characters". This allows you to run an operation against a potentially large number of files at once, all of which match the specified pattern. As an example, rm mdn-* would delete all files beginning with mdn-. rm mdn-*.bak would delete all files that start with mdn- and end with .bak. Terminal -- considered harmful? We've alluded to this before, but to be clea...
...ogether using the | (pipe) symbol. Let's look at a very quick example of what this means. We've already looked at ls, which outputs the contents of the current directory: ls But what if we wanted to quickly count the number of files and directories inside the current directory? ls can't do that on its own. There is another Unix tool available called wc. This counts the number of words, lines,
characters, or bytes of whatever is inputted into it. This can be a text file -- the below example outputs the number of lines in myfile.txt: wc -l myfile.txt But it can also count the number of lines of whatever output is piped into it. For example, the below command counts the number of lines outputted by the ls command (what it would normally print to the terminal if run on its own) and outputs t...
Chrome registration
tion. The plaintext chrome manifests are in a simple line-based format. Each line is parsed individually; if the line is parsable the chrome registry takes the action identified by that line, otherwise the chrome registry ignores that line (and prints a warning message in the runtime error console). locale packagename localename path/to/files skin packagename skinname path/to/files Note: The
characters @ # ; : ? / are not allowed in the packagename. Firefox 2, Thunderbird 2, and SeaMonkey 1.1 will not find the chrome when packagename is mixed case. If the above example had a packagename of CamelCasePackage, you would get an error message similar to "No chrome registered for chrome://camelcasepackage/path/to/files". Firefox 3, Thunderbird 3, and SeaMonkey 2 support mixed case. Bug resolv...
...ple had a packagename of CamelCasePackage, you would get an error message similar to "No chrome registered for chrome://camelcasepackage/path/to/files". Firefox 3, Thunderbird 3, and SeaMonkey 2 support mixed case. Bug resolved in Mozilla 1.9; see bug 132183. Manifest instructions comments # this line is a comment - you can put here whatever you want A line is a comment if it begins with the
character '#'. Any following
character in the same line is ignored. manifest manifest subdirectory/foo.manifest [flags] This will load a secondary manifest file. This can be useful for separating component and chrome registration instructions, or separate platform-specific registration data. binary-component binary-component components/mycomponent.dll [flags] Instructs Mozilla to register ...
... installed into the application version identified. Multiple appversion flags may be included on a single line, in which case the line is applied if any of the flags match. The version string must conform to the Toolkit version format. Note: Versions of Gecko before Gecko 1.8.0.13 and Gecko 1.8.1.5 contained a bug where if you use the comparisons <, > or =, the version string had be two or more
characters long. If not, you would get a message in the error console that the appversion flag was not recognized. See bug 380398. platformversion When supporting more then one application, it is often more convenient for an extension to specify which Gecko version it is compatible with. This is particularly true for binary components. If there are chrome registration lines which only apply to a p...
How Mozilla's build system works
1: configure Phase 1 centers around the configure script. The configure script is a bash shell script. The file is generated from a file called configure.in, which is written in M4 and processed using Autoconf 2.13 to create the final configure script. You don't have to worry about how you obtain a configure file: the build system does this for you. The primary job of configure is to determine
characteristics of the system and compiler, apply options passed into it, and validate everything looks OK to build. The primary output of the configure script is an executable file in the object directory called config.status. configure also produces some additional files (like autoconf.mk). However, the most important file in terms of architecture is config.status. The existence of a config.status ...
...ed a config.status file, we proceed to Phase 2. Phase 2: Build Backend Preparation and the Build Definition Once configure has determined what the current build configuration is, we need to apply this to the source tree so we can actually build. What essentially happens is the automatically produced config.status Python script is executed as soon as configure has generated it. config.status is
charged with the task of telling a tool how to build the tree. To do this, config.status must first scan the build system definition. The build system definition consists of various moz.build files in the tree. There is roughly one moz.build file per directory or per set of related directories. Each moz.build file defines how its part of the build configuration works. For example, it says I want thes...
...er frequently used variable not specific to a particular build target is DIRS. DIRS is a list of subdirectories of the current directory to recursively build in. Subdirectories are traversed after their parent directories. For example, you could have: DIRS = \ public \ resources \ src \ $(NULL) This example demonstrates another concept called continuation lines. A backslash as the last
character on a line allows the variable definition to be continued on the next line. The extra whitespace is compressed. The terminating $(NULL) is a method for consistency; it allows you to add and remove lines without worrying about whether the last line has an ending backslash or not. Makefile examples Standard Makefile Header Installing headers using EXPORTS Compiling interfaces using XPIDLS...
Gecko Profiler FAQ
er is not a suitable tool for finding hotspots within a single function. For this purpose you should try to use a native profiler on your platform of choice (for example xperf/vtune on Windows, Instruments on OSX, and perf/Zoom on Linux.) One workaround is to break the hot function into several explicitly-non-inline helpers, recompile, and re-profile. This can change some performance
characteristics, but is a decent way to get a sense of which parts of a large function are expensive. How to profile startup code that regresses just a little (<10-15ms ts_paint/tpaint) [mstange] We currently don't have a good way to do that. You can write your own tools to assist you in this process, though. I did something like this a few years ago with the old profiler and ...
...ningful. profiler.firefox.com does not have a comparison view at the moment. I can help you add one, though. There is documentation for the Gecko profile format. Is it worth slowing down CPU to increase the profiler resolution? It depends on what you are trying to profile to some extent. Usually you should be really careful when changing the
characteristics of the environment that you are trying to measure to avoid measuring the wrong thing. 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. An...
...icro-benchmark that call malloc/free in a loop and the like and call it a day! A better idea would be picking up a real browser workload where through previous profiling we know that malloc overhead contributes a measurable percentage of overhead to the overall time and then study the change to that workload after replacing the allocator. You do want to think about various
characteristics of an allocator which may have an impact on performance. For example, see Julian's great investigation on the impact of cache line sharing across multiple cores on jemalloc's multi-core performance in https://bugzilla.mozilla.org/show_bug.cgi?id=1291355#c26. What's the best way to measure the cost of new compiler flags (that affect all or most functions)? [ehs...
NSS Developer Tutorial
Indentation level is 4. Tabs are used heavily in many NSS source files. Try to stay consistent when you modify existing code. The proper use of tabs has often been confusing for new NSS developers, so in nss/lib/ssl, we're gradually removing the use of tabs. Curly braces: both of the following styles are allowed: if (condition) { action1(); } else { action2(); } Or: if (condition) { action1(); } else { action2(); } The former style is more common. When modifying existing code, try to stay consistent. In new code, prefer the former style, as it conserves vertical space. ...
.... Global, but unexported functions, are usually named foo_DoOneAction. Variable, and function parameter names, always start with a lowercase letter. The most common style is fooBarBaz, although foobarbaz and foo_bar_baz are also used. Miscellaneous goto can be used, to simplify resource deallocation, before returning from a function. A data buffer is usually represented as: unsigned
char *data; unsigned int len; The buffer pointer is unsigned
char *, as opposed to void *, so we can perform pointer arithmetic without casting. Use
char * only if the data is interpreted as text
characters. For historical reasons, the buffer length is unsigned int, as opposed to size_t. Unfortunately, this can be a source of integer overflow bugs on 64-bit systems. C Features NSS requires C99. H...
...r, not all features from C99 are equally available. Variables can be declared, at the point they are first used. The inline keyword can be used. Variadic macro arguments are permitted, but their use should be limited to using __VA_ARGS__. The exact-width integer types in NSPR should be used, in preference to those declared in <stdint.h> (which will be used by NSPR in the future). Universal
character names are not permitted, as are wide
character types (
char16_t and
char32_t). NSS source should only include ASCII text. Escape non-printing
characters (with \x if there is no special escape such as \r, \n, and \t) and avoid defining string literals that use non-ASCII
characters. One line comments starting with // are permitted. Check with nss-dev@ before using a language feature not al...
NSS Sample Code sample3
* This code uses the simplest of the Init functions, which does...
... * This code uses the simplest of the Init functions, which does...
...iostream.h> #include "pk11pub.h" #include "nss.h" static void printDigest(unsigned
char *digest, unsigned int len) { int i; cout << "length: " << len << endl; for(i = 0;i < len;i++) printf("%02x ", digest[i]); cout << endl; } /* * main */ int main(int argc, const
char *argv[]) { int status = 0; PK11SlotInfo *slot = 0; PK11SymKey *key = 0; PK11Context *context = 0; unsigned
char data[80]; unsigned
char digest[20]; /*Is there a way to tell how large the output is?*/ unsigned int len; SECStatus s; /* Initialize NSS * If your application code has already initialized NSS, you can skip it * here. * This code uses the simplest of the Init functions, which does not * require a NSS database to exist */ NSS_NoDB_Init("."); /* Get a slot to use for the...
TLS Cipher Suite Discovery
of that block of memory. SSL_GetCipherSuiteInfo fills that caller-supplied memory with information from the SSLCipherSuiteInfo structure for that cipher suite. ...
...ry with information from the SSLCipherSuiteInfo structure for that cipher suite. ...
...s information, declared in "sslt.h": typedef struct SSLCipherSuiteInfoStr { PRUint16 length; PRUint16 cipherSuite; /* Cipher Suite Name */ const
char * cipherSuiteName; /* server authentication info */ const
char * authAlgorithmName; SSLAuthType authAlgorithm; /* key exchange algorithm info */ const
char * keaTypeName; SSLKEAType keaType; /* symmetric encryption info */ const
char * symCipherName; SSLCipherAlgorithm symCipher; PRUint16 symKeyBits; PRUint16 symKeySpace; PRUint16 effectiveKeyBits; /* MAC info */ const
char * macAlgorithmName; SSLMACAlgorithm macAlgorithm;...
Rhino shell
each file is read in and executed in turn. loadClass(className) Load and execute the class named by the string argument className. The class must be a class that implements the Script interface, as will any script compiled by Rhino JavaScript Compiler. print([expr ...]) Evaluate and print expressions. Evaluates each expression, converts the result to a string, and prints it. ...
...ass named by the string argument className. The class must be a class that implements the Script interface, as will any script compiled by Rhino JavaScript Compiler. print([expr ...]) Evaluate and print expressions. Evaluates each expression, converts the result to a string, and prints it. readFile(path [,
characterCoding]) Read given file and convert its bytes to a string using the specified
character coding or default
character coding if explicit coding argument is not given. readUrl(url [,
characterCoding]) Open an input connection to the given string url, read all its bytes and convert them to a string using the specified
character coding or default
character coding if explicit coding argument is not given. runCommand(commandName, [arg, ...] [options]) Execute the specified command...
...lize the given object to the specified file. spawn(functionOrScript) Run the given function or script in a different thread. sync(function) creates a synchronized function (in the sense of a Java synchronized method) from an existing function. The new function synchronizes on the this object of its invocation. quit() Quit shell. The shell will also quit in interactive mode if an end-of-file
character is typed at the prompt. version([number]) Get or set JavaScript version number. If no argument is supplied, the current version number is returned. If an argument is supplied, it is expected to be one of 100, 110, 120, 130, 140, 150, 160 or 170 to indicate JavaScript version 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 or 1.7 respectively. Examples Invocation Here the shell is invoked three times ...
GC Rooting Guide
cts, this is normally done by storing them in slots, which are automatically traced by the GC. Other JSObjects When defining a 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 arrange 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...
...see above) that casts the private pointer to your structure and invokes trace() on it: class MyObject : public JSObject { { ... ...
...->trace(trc, "MyClass private field"); } } class MyClass { Heap<JSString*> str; public: void trace(JSTracer* trc, const
char* name) { JS::TraceEdge(trc, &str, "my string"); } } If a pointer to your structure is stored in some other structure, then its trace() method should invoke yours: struct MyOwningStruct { MyClass* mything; void trace(JSTracer* trc, const
char* name) { if (mything) mything->trace(trc, "my thing"); } } If the toplevel structure is not stored in a JSObject, then how it gets traced depends on why it should be alive. The simplest approach is to use JS::PersistentRooted (usable on anything with a trace method with the appropriate signature): JS::PersistentRooted<MyOwningStruct> immortalStruct; But note that JS::P...
Hacking Tips
is to first replace the generated breakpoint by a nop instruction, and to set a breakpoint at the address of the nop. ...
...When gdb comes up, enter set annot 1 to get it to emit file location information so that emacs will pop up the corresponding source. Note that if you reverse-conti...
...e obtained from info().script(). bool CodeGeneratorX86Shared::visitGuardShape(LGuardShape *guard) { if (info().script()->lineno == 16934 && guard->id() == 522) { [... another impl only for this one ...] return true; } [... old impl ...] [Hack] Spewing all compiled code I usually just add this to the apropriate executableCopy. if (getenv("INST_DUMP")) {
char buf[4096]; sprintf(buf, "gdb /proc/%d/exe %d -batch -ex 'set pagination off' -ex 'set arm force-mode arm' -ex 'x/%di %p' -ex 'set arm force-mode auto'", getpid(), getpid(), m_buffer.size() / 4, buffer); system(buf); } If you aren't running on arm, you should omit the -ex 'set arm force-mode arm' and -ex 'set arm force-mode auto'. And you should change the size()/4 to be so...
JIT Optimization Strategies
optimized but most restrictive to the least optimized but least restrictive. For each strategy attempted, its outcome is tracked. An outcome is either success or a reason why the strategy failed to apply. This page documents the various optimization strategies and their outcomes. It provides information on what they attempt to do, what general level of speed-up they provide, what kind of program
characteristics can prevent them from being used, and common ways to enable the engine to utilize that optimization. GetProperty GetProperty_ArgumentsLength Attempts to optimize an arguments.length property access. This optimization only works if the arguments object is used in well-understood ways within the function. The function containing the arguments.length is allowed to use the arguments obj...
...sons. If the types observed at the property access are polymorphic (more than one type), this optimization cannot succeed. Furthermore, even if the object type is monomorphic, the optimization will fail if the property being accessed is not a definite slot as described above. GetProp_Unboxed Similar to GetProp_DefiniteSlot. Unboxed property reads are possible on properties which satisfy all the
characteristics of a definite slot, and additionally have been observed to only store values of one kind of value. Consider the following constructor: function Point(x, y) { this.x = x; this.y = y; } If only integers are ever stored in the x and y properties, then the instances of Point will be represented in an "unboxed" mode - with the property values stored as raw 4-byte values within t...
...sons. If the types observed at the property access are polymorphic (more than one type), this optimization cannot succeed. Furthermore, even if the object type is monomorphic, the optimization will fail if the property being written is not a definite slot as described above. SetProp_Unboxed Similar to SetProp_DefiniteSlot. Unboxed property writes are possible on properties which satisfy all the
characteristics of a definite slot, and additionally have been observed to only store values of one kind of value. Consider the following constructor: function Point(x, y) { this.x = x; this.y = y; } If only integers are ever stored in the x and y properties, then the instances of Point will be represented in an "unboxed" mode - with the property values stored as raw 4-byte values within t...
JS::Add*Root
oints at from garbage collection. These functions are obsoleted, use JS::PersistentRooted instead. ...
... JS::AddValueRoot(JSContext *cx, JS::Heap<JS::Value> *vp); bool JS::AddStringRoot(JSContext *cx, JS::Heap<JSString *> *rp); bool JS::AddObjectRoot(JSContext *cx, JS::Heap<JSObject *> *rp); bool JS::AddNamedValueRoot(JSContext *cx, JS::Heap<JS::Value> *vp, const
char *name); bool JS::AddNamedValueRootRT(JSRuntime *rt, JS::Heap<JS::Value> *vp, const
char *name); bool JS::AddNamedStringRoot(JSContext *cx, JS::Heap<JSString *> *rp, const
char *name); bool JS::AddNamedObjectRoot(JSContext *cx, JS::Heap<JSObject *> *rp, const
char *name); bool JS::AddNamedScriptRoot(JSContext *cx, JS::Heap<JSScript *> *rp, const
char *name); Name Type Description cx J...
... in which to add the new root. vp JS::Heap<JS::Value> The address of the JS::Value variable to root. rp JS::Heap<JSString *> The address of the JSString * variable to root. rp JS::Heap<JSObject *> The address of the JSObject * variable to root. rp JS::Heap<JSScript *> The address of the JSScript * variable to root. name const
char * The name of the new root, or NULL. Description The JS::Add*Root and functions add a C/C++ variable to the garbage collector's root set, the set of variables used as starting points each time the collector checks to see what memory is reachable. The garbage collector aggressively collects and recycles memory that it deems unreachable, so roots are often necessary to protect data from ...
JSErrorReport
If NULL, the error is local to the script in the current HTML page. lineno unsigned Line number in the source that caused the error. ...
...ow.onerror handler) for juicy morsels of its contents. To counter this attack, HTML5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded. Callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in JSErrorReports. linebuf const
char * Text of the line that caused the error, minus the trailing newline
character. tokenptr const
char * Pointer to the error token in *linebuf. uclinebuf const
char16_t * Unicode line buffer. This is the buffer that contains the original data. uctokenptr const
char16_t * Pointer to the error token in *uclinebuf. flags unsigned The ...
... should not be reported at all. We check the strictness of the context's top frame's script; where that isn't appropriate, the caller should do the right checks itself instead of using this flag. The constant JSREPORT_ERROR is 0 and can be used to indicate an error report without any of the above flags. errorNumber unsigned The error number. ucmessage const
char16_t * The default unicode error message. messageArgs const
char16_t ** Arguments for the error message. exnType int16_t One of the JSExnType constants. Description JSErrorReport describes a single error that occurs in the execution of script. In the event of an error, filename will either contain the name of the external source file or URL containing the scr...
JS_CallFunction
Calls a specified JS function. ...
...Requires request. In a JS_THREADSAFE build, the caller must be ...
...est. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject The "current" object on which the function operates; the object specified here is "this" when the function executes. fun JS::HandleFunction Pointer to the function to call. fun should be a native function or JSAPI-compiled function. See below. name const
char * Pointer to the name of function to call. fval JS::HandleValue Pointer to the function value to call. args const JS::HandleValueArray & Reference to the array of argument values to pass to the function. Added in SpiderMonkey 31 argc unsigned Number of arguments you are passing to the function. Obsolete since JSAPI 30 argv jsval * ...
JS_CompileUCFunctionForPrincipalsVersion
This article covers features introduced in SpiderMonkey 1.8.5 Please provide a description for this function. Syntax JSFunction * JS_CompileUCFunctionForPrincipalsVersion(JSContext *cx, JSObject *obj, JSPrincipals *principals, const
char *name, unsigned int nargs, const
char **argnames, const js
char *
chars, size_t length, const
char *filename, unsigned int lineno, JSVersion version); Name Type Description cx JSContext * The context. Requires request. ...
... See Also Please provide a description. ...
...me, unsigned int lineno, JSVersion version); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * principals JSPrincipals * name const
char * nargs unsigned int argnames const
char **
chars const js
char * length size_t filename const
char * lineno unsigned int version JSVersion Description Please provide a description. See Also Please provide a description. ...
JS_DefineFunction
Create a native function and assign it as a property to a specified JS object. ...
... Create a native function and assign it as a property to a specified JS object. ...
...nsigned nargs, unsigned attrs); // Added in SpiderMonkey 17 Name Type Description cx JSContext * The context in which to define the function. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::Handle<JSObject*> Object for which to define a function as a property (method). name const
char * or const
char16_t * Name to assign to the function. id JS::Handle<jsid> A pointer to jsid for name to assign to the function. Added in SpiderMonkey 17 call JSNative The native C/C++ function to be wrapped by the new function. nargs unsigned Number of arguments that are passed to the function when it is called. flags unsigned T...
JS_DeleteProperty2
Obsolete since JSAPI 39This 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. Removes a specified property from an object. Renamed to JS_DeleteProperty from JSAPI 39. ...
...ork in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Removes a specified property from an object. Renamed to JS_DeleteProperty from JSAPI 39. Syntax bool JS_DeleteProperty2(JSContext *cx, JS::HandleObject obj, const
char *name, bool *succeeded); bool JS_DeleteUCProperty2(JSContext *cx, JS::HandleObject obj, const
char16_t *name, size_t namelen, bool *succeeded); bool JS_DeletePropertyById2(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *succeeded); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build,...
... bool *succeeded); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object from which to delete a property. name or id const
char * or const
char16_t or JS::HandleId Name of the property to delete. namelen size_t (only in JS_DeleteUCProperty2) The length of name in
characters; or -1 to indicate that name is null-terminated. succeeded bool * Out parameter. On success, *succeeded receives false if the property was not deleted because it is permanent and true otherwise. Description JS_D...
JS_DumpNamedRoots
Obsolete since JSAPI 19This 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. Enumerate all the named roots in a runtime. Syntax void JS_DumpNamedRoots(JSRuntime *rt, void (*dump)(const
char *name, void *rp, void *data), void *data); Name Type Description rt JSRuntime * Pointer to a JSRuntime from which to dump named roots. dump void (*)(const
char *, void *, void *) Pointer to function that actually dumps the named roots. This may not be NULL. data void * A pointer that is passed to dump each time it is called. The JavaScript engine does not read from or write to this pointer at all. It is passed to the dump f...
...e explanation of what JS_DumpNamedRoots does */ void JS_DumpNamedRoots(JSRuntime *rt, DumpFn dump, void *data) { for each (root in rt->namedRoots) dump(root.name, root.address, data); } Callback syntax dump is a pointer to a function provided by the application. When JS_DumpNamedRoots calls it, it passes three arguments: Argument Type Description name const
char * The name of the named root. rp void * A pointer to the rooted variable, array element, or field. This is the pointer that the application passed to JS_AddNamedRoot. It points to a variable, array element, or field of type jsval, JSObject *, JSString *, or jsdouble *. data void * The data argument that the application passed to JS_DumpNamedRoots. Example st...
...ed root. rp void * A pointer to the rooted variable, array element, or field. This is the pointer that the application passed to JS_AddNamedRoot. It points to a variable, array element, or field of type jsval, JSObject *, JSString *, or jsdouble *. data void * The data argument that the application passed to JS_DumpNamedRoots. Example static void dumpRoot(const
char *name, void *addr, void *data) { /* The application may use `data` for anything. In this example, we use it to pass the desired output file. */ FILE *f = (FILE *) data; fprintf(f, "There is a root named '%s' at %p\n", name, addr); } int main() { ... JS_DumpNamedRoots(rt, dumpRoot, stderr); ... } See Also bug 803907 ...
JS_EncodeString
This article covers features introduced in SpiderMonkey 1.8 Convert a JavaScript string to a C string. Syntax
char * JS_EncodeString(JSContext *cx, JSString *str);
char * JS_EncodeStringToUTF8(JSContext *cx, JS::HandleString str); // Added in SpiderMonkey 24 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. str JSString * / JS::HandleString A string to encode. Description JS_EncodeString and JS_EncodeStringToUTF8 convert the specified JavaScript str to a C string (an array of 8-bit
chars). If JS_CStringsAreUTF8 is true, then the returned string of JS_EncodeString is UTF-8, and the conversion is lossless. Otherwise the high byte is si...
... JS_EncodeStringToUTF8 encode the string to UTF-8. The array returned by JS_EncodeString on success is allocated as though by a call to JS_malloc. ...
...simply dropped from each
char16_t. JS_EncodeStringToUTF8 encode the string to UTF-8. The array returned by JS_EncodeString on success is allocated as though by a call to JS_malloc. The caller may modify it and is responsible for freeing it. Note that for non-ASCII strings, if JS_CStringsAreUTF8 is false, these functions can return a corrupted copy of the contents of the string. Use JS_GetString
Chars to access the 16-bit
characters of a JavaScript string without conversions or copying. On success, JS_EncodeString and JS_EncodeStringToUTF8 return a pointer to the
char array, which is null-terminated. On failure, JS_EncodeString and JS_EncodeStringToUTF8 return NULL See Also MXR ID Search for JS_EncodeString MXR ID Search for JS_EncodeStringToUTF8 JS_EncodeStringToBuffer bug 397215 - ...
JS_EvaluateScript
Obsolete since JSAPI 36This 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. Compile and execute a script. Syntax JSBool JS_EvaluateScript(JSContext *cx, JSObject *obj, const
char *src, unsigned int length, const
char *filename, unsigned int lineno, jsval *rval); JSBool JS_EvaluateUCScript(JSContext *cx, JSObject *obj, const js
char *src, unsigned int length, const
char *filename, unsigned int lineno, jsval *rval); Name Type Description cx JSContext * The context in which to run the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The scope in whi...
...e, unsigned int lineno, jsval *rval); Name Type Description cx JSContext * The context in which to run the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The scope in which to execute the script. This parameter is documented in detail at JS_ExecuteScript. src const
char * or const js
char * String containing the script to compile and execute. length unsigned int The length of src, in
characters. filename const
char * Name of file or URL containing the script. Used to report filename or URL in error messages. lineno unsigned int Line number. Used to report the offending line in the file or URL if an error occurs. ...
...n error occurs. rval jsval * Out parameter. On success, if rval is not NULL, *rval receives the result value. Description JS_EvaluateScript compiles and executes a script in the specified scope, obj. JS_EvaluateUCScript is the Unicode version of the function. src is the string containing the text of the script. length indicates the size of the text version of the script in
characters. filename is the name of the file (or URL) containing the script. This information is used in messages if an error occurs during compilation. Similarly, lineno is used to report the line number of the script or file where an error occurred during compilation. rval is an optional out parameter. If it is non-null, then on success, the result value is stored in *rval. This value is determine...
JS_GetPropertyAttributes
Obsolete since JSAPI 26This 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. Get the attributes of a specified property. Syntax JSBool JS_GetPropertyAttributes(JSContext *cx, JSObject *obj, const
char *name, unsigned int *attrsp, JSBool *foundp); JSBool JS_GetUCPropertyAttributes(JSContext *cx, JSObject *obj, const js
char *name, size_t namelen, unsigned int *attrsp, JSBool *foundp); Name Type Description cx JSContext * The context in which to look up property attributes. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The object that has the property to be queried. ...
... attrsp unsigned int * Out parameter. If the specified property is found on obj, *attrsp receives its attributes. ...
...ame, size_t namelen, unsigned int *attrsp, JSBool *foundp); Name Type Description cx JSContext * The context in which to look up property attributes. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The object that has the property to be queried. name const
char * or const js
char * Name of the property from which to retrieve attributes. namelen size_t (only in JS_GetUCPropertyAttributes) The length of name in
characters; or (size_t) -1 to indicate that name is null-terminated. attrsp unsigned int * Out parameter. If the specified property is found on obj, *attrsp receives its attributes. foundp JSBool * Out parameter. If no ...
JS_GetPropertyAttrsGetterAndSetter
Obsolete since JSAPI 26This 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. Retrieve the attributes, getter, and setter of a specified property. ...
...d be removed at any time. Try to avoid using it. Retrieve the attributes, getter, and setter of a specified property. ...
...pertyOp *getterp, JSPropertyOp *setterp); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * The context in which to perform the property lookup. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object from which to retrieve property attributes. name or id const
char * or const js
char * or jsid The name of the property to examine. namelen size_t (only in JS_GetUCPropertyAttrsGetterAndSetter) The length of name in
characters; or (size_t) -1 to indicate that name is null-terminated. attrsp unsigned int * Out parameter. Pointer to the storage area into which to place retrieves attributes. foundp JSBool * Out parame...
JS_GetStringBytes
Obsolete since JSAPI 1.8.5This 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. Convert a JavaScript string to a C string. Syntax
char * JS_GetStringBytes(JSString *str); const
char * JS_GetStringBytesZ(JSContext *cx, JSString *str); // Added in JSAPI 1.8.2 Name Type Description cx JSContext * (JS_GetStringBytesZ and JS_EncodeString only) A context. str JSString * String to retrieve bytes from. Description JS_GetStringBytes and JS_GetStringBytesZ convert the specified JavaScript string, str, to a C string (an array of 8-bit
chars). If JS_CStringsAreUTF8 is true, then the returned string is UTF-8, and the conversion is lossless. Otherwis...
...esZ and JS_EncodeString only) A context. str JSString * String to retrieve bytes from. Description JS_GetStringBytes and JS_GetStringBytesZ convert the specified JavaScript string, str, to a C string (an array of 8-bit
chars). If JS_CStringsAreUTF8 is true, then the returned string is UTF-8, and the conversion is lossless. Otherwise the high byte is simply dropped from each js
char. On success, the return value is a pointer to the
char array, which is null-terminated. On failure, JS_GetStringBytes returns a pointer to a null-terminated empty string; JS_GetStringBytesZ returns NULL. Note: JS_GetStringBytes() and JS_GetStringBytesZ() have both been removed as of JavaScript 1.8.5 (Firefox 4). Instead, you should use JS_EncodeString, JS_GetStringEncodingLength, JS_EncodeStrin...
...gth, JS_EncodeStringToBuffer. The array returned by JS_GetStringBytes or JS_GetStringBytesZ is automatically freed when str is finalized by the JavaScript garbage collection mechanism. The application must not modify the contents of the array. Note that for non-ASCII strings, if JS_CStringsAreUTF8 is false, these functions can return a corrupted copy of the contents of the string. Use JS_GetString
Chars to access the 16-bit
characters of a JavaScript string without conversions or copying. See Also JS_EncodeString JS_EncodeStringToUTF8 JS_GetStringEncodingLength JS_EncodeStringToBuffer JS_CompareStrings JS_GetStringLength JS_ValueToString bug 607292 ...
JS_MakeStringImmutable
Try to avoid using it. Make a JSString thread-safe. Syntax JSBool JS_MakeStringImmutable(JSContext *cx, JSString *str); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. s JSString * The string to operate on. s must not be null. Description A string's
characters can never be changed, but SpiderMonkey uses two string optimization techniques behind the scenes: A growable string (see JS_NewGrowableString ) has a buffer that the JavaScript engine can reallocate so that concatenating it with another string is much faster. A dependent string (see JS_NewDependentString) is a substring of another (growable, dependent, or immutable) string. In memory it...
...uffer that the JavaScript engine can reallocate so that concatenating it with another string is much faster. A dependent string (see JS_NewDependentString) is a substring of another (growable, dependent, or immutable) string. In memory it is represented as a pointer to the other string and a pair of integers for the substring's starting point and length, rather than as a separate copy of all the
characters. This makes the substring operation, and regular expression matches, faster. In both cases, the JavaScript engine may change the fields of the JSString. These changes are not atomic. Therefore such strings must not be used by more than one thread at a time. Applications must call JS_MakeStringImmutable before sharing a JSString among threads by storing it in a C/C++ variable, field, or arr...
...eStringImmutable before sharing a JSString among threads by storing it in a C/C++ variable, field, or array element that another thread can read. (When an application shares a string by storing it in a JavaScript object that another thread can read, the JavaScript engine automatically makes the string thread-safe.) After a successful call to JS_MakeStringImmutable, subsequent calls to JS_GetString
CharsZ on the same string are guaranteed to succeed, and subsequent calls to JS_GetString
Chars on the same string are guaranteed to return a null-terminated string. See Also bug 1115986 ...
JS_NewFunction
Create a new JavaScript function that is implemented in C/C++ as a JSNative. ...
...Requires request. ...
...is function. nargs unsigned Number of arguments the function expects. flags unsigned Pass JSFUN_CONSTRUCTOR to make a native that can be called as a constructor, otherwise 0. parent JS::Handle<JSObject*> Pointer to the parent object for this function. If this is NULL, a default parent object is used. Obsolete since JSAPI 39 name const
char * Name to assign to the new function. If this is NULL, the new function has no name. id JS::Handle<jsid> A pointer to jsid of the name to assign to the new function. Added in SpiderMonkey 17 Description JS_NewFunction creates a new JavaScript function implemented in C/C++. (To create a new function implemented in JavaScript, use JS_CompileFunction instead.) call i...
JS_PSGS
fineProperties and JS_InitClass. Syntax #define JS_PSG(name, getter, flags) ... #define JS_PSGS(name, getter, setter, flags) ... #define JS_SELF_HOSTED_GET(name, getterName, flags) ... // Added in SpiderMonkey 31 #define JS_SELF_HOSTED_GETSET(name, getterName, setterName, flags) ... // Added in SpiderMonkey 31 #define JS_PS_END ... ...
... Description These macros encapsulate the definition of JSNative-backed JSPropertySpecs, by defining the JSNativeWrappers for them. ...
... getter JSNative Pointer to the C/C++ implementation of the getter function. setter JSNative Pointer to the C/C++ implementation of the setter function. flags uint16 The bitwise OR of any number of property attributes. getterName const
char * The function's name in Self-Hosted JavaScript code for getter function. setterName const
char * The function's name in Self-Hosted JavaScript code for setter function. Description These macros encapsulate the definition of JSNative-backed JSPropertySpecs, by defining the JSNativeWrappers for them. See Also MXR ID Search for JS_PSG MXR ID Search for JS_PSGS MXR ID Search for JS_SELF_HOSTED_GET MXR ID Search for JS_SELF_HOSTED_GETSET JSPropertySpec JS_DefineProperties J...
JS_PutEscapedString
This article covers features introduced in SpiderMonkey 1.8.5 Write a string into buffer with escaping. Syntax size_t JS_PutEscapedString(JSContext *cx,
char *buffer, size_t size, JSString *str,
char quote); size_t JS_PutEscapedFlatString(
char *buffer, size_t size, JSFlatString *str,
char quote); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. buffer
char * A pointer to
char buffer to write into. size size_t The size of buffer in bytes. str JSString * or JSFlatString * A string to write into the file. quote
char One of 0, single quote, and double quote. ...
... buffer
char * A pointer to
char buffer to write into. size size_t The size of buffer in bytes. str JSString * or JSFlatString * A string to write into the file. quote
char One of 0, single quote, and double quote. Description JS_PutEscapedString and JS_PutEscapedString write str into buffer escaping any non-printable or non-ASCII
character using \escapes for JS string literals. Guarantees that a NUL is at the end of the buffer unless size is 0. Returns the length of the written output, NOT including the NUL. Thus, a return value of size or more means that the output was truncated. If buffer is null, just returns the length of the output. ...
...any non-printable or non-ASCII
character using \escapes for JS string literals. Guarantees that a NUL is at the end of the buffer unless size is 0. Returns the length of the written output, NOT including the NUL. Thus, a return value of size or more means that the output was truncated. If buffer is null, just returns the length of the output. If quote is not 0, it must be a single or double quote
character that will quote the output. See Also MXR ID Search for JS_PutEscapedString MXR ID Search for JS_PutEscapedFlatString bug 609440 ...
JS_SET_TRACING_DETAILS
ext thing to be traced by a JSTracer. Syntax JS_SET_TRACING_DETAILS(trc, printer, arg, index) Name Type Description trc JSTracer * The tracer whose debugging hooks are to be set. printer JSTraceNamePrinter A callback function, described below; or NULL. arg void * See the description. index size_t See the description. ...
...dex) Name Type Description trc JSTracer * The tracer whose debugging hooks are to be set. printer JSTraceNamePrinter A callback function, described below; or NULL. arg void * See the description. index size_t See the description. Callback syntax typedef void (*JSTraceNamePrinter)(JSTracer *trc,
char *buf, size_t bufsize); Name Type Description trc JSTracer * The tracer. buf
char * Out parameter. The callback stores a string describing the reference traced in buf. ...
...allback function, described below; or NULL. arg void * See the description. index size_t See the description. Callback syntax typedef void (*JSTraceNamePrinter)(JSTracer *trc,
char *buf, size_t bufsize); Name Type Description trc JSTracer * The tracer. buf
char * Out parameter. The callback stores a string describing the reference traced in buf. bufsize size_t The size of buf, in
chars. Description Set debugging information about a reference to a traceable thing to prepare for the following call to JS_CallTracer. When printer is null, arg must be const
char * or
char * C string naming the reference and index must be either (size_t)-1 indicating that the name alone describes the reference or it must be an index into some array vector that stores the reference. When printer i...
JS_SetProperty
Requires request. ...
...Requires request. ...
... JS::HandleValue v); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleValue Object to which the property to set belongs. name or id const
char * or const
char16_t *or JS::HandleId Name of the property to set. namelen size_t (only in JS_SetUCProperty) The length of name in
characters; or -1 to indicate that name is null-terminated. v JS::HandleValue In/out parameter. *vp is the value to assign to the property. Ordinarily this function leaves v unchanged, but it is possible for a JSClass.addProperty hook o...
Gecko Roles
window. A document window is always contained within an application window. ROLE_PANE Represents a pane within a frame or document window. Users can navigate between panes and within the contents of the current pane, but cannot navigate between items in different panes. Thus, panes represent a level of grouping lower than frame windows or documents, but above individual controls. ROLE_
CHART Represents a graphical image used to represent data. ROLE_DIALOG Represents a dialog box or message box. ROLE_BORDER Represents a window border. ROLE_GROUPING Logically groups other objects. ROLE_SEPARATOR Used to visually divide a space into two regions, such as a separator menu item or a bar that divides split panes within a window. ROLE_TOOLBAR Repr...
... ROLE_COLUMN Represents a column of cells within a table. ROLE_ROW Represents a row of cells within a table. ROLE_CELL Represents a cell within a table. ROLE_LINK Represents a link to something else. This object might look like text or a graphic, but it acts like a button. ROLE_HELPBALLOON Displays a Help topic in the form of a ToolTip or Help balloon. ROLE_
CHARACTER Represents a cartoon-like graphic object, such as Microsoft Office Assistant, which is displayed to provide help to users of an application. ROLE_LIST Represents a list box, allowing the user to select one or more items. ROLE_LISTITEM Represents an item in a list. ROLE_OUTLINE Represents an outline or tree structure, such as a tree view control, that displays a hi...
...tent. It is used in documents which are accessed by the user on a page by page basis. ROLE_SECTION A container of document content. ROLE_REDUNDANT_OBJECT An object which is redundant with another object in the accessible hierarchy. ATs typically ignore objects with this role. ROLE_FORM A container of form controls. ROLE_IME An object which is used to allow input of
characters not found on a keyboard, such as the input of Chinese
characters on a Western keyboard. ROLE_APP_ROOT ??? ROLE_PARENT_MENUITEM Represents a menu item, which is an entry in a menu that a user can choose to display another menu. ROLE_CALENDAR A calendar that allows the user to select a date. ROLE_COMBOBOX_LIST A list of items that is shown by combobox. ROL...
XPCshell Test Manifest Expressions
le. You can add conditions to tests in order to control when tests get run. The conditions accept a simple boolean expression syntax, described here. Operators In order of decreasing precedence: () == != && || Literal Values Booleans: the literal strings true and false. Integers: A series of contiguous digits. Only decimal integers are supported. Strings: any series of
characters enclosed in double quotes " or single quotes '. No escape sequences are supported. Variables Variables are supported as a series of letters, digits or underscores beginning with a letter or an underscore. There are a fixed set of variables provided by the test harness via mozinfo.py, with many of the values initialized at configure time by writemozinfo.py which writes mozinfo.json into...
... This is useful as the entire line will generally be reported whenever tests are reported as being skipped, meaning the comment as well as the expression itself will appear in any logs where this is reported. ...
...for One of: 'x86', 'x86_64', 'arm' bits - The pointer size of the CPU architecture, in bits One of 32, 64, possibly unknown debug - Set to true if this build is a debug build, false otherwise crashreporter - Set to true if this build has crash reporting code enabled, false otherwise. Comments If an expression contains a # (pound/hash)
character outside of a string, the
character and the rest of the line will be treated as a comment. This is useful as the entire line will generally be reported whenever tests are reported as being skipped, meaning the comment as well as the expression itself will appear in any logs where this is reported. ...
nsACString
<< XPCOM API Reference Summary The nsACString abstract class represents a
character string composed of single-byte storage units. This class is typically used to represent ASCII or UTF-8
character arrays. #include "nsStringAPI.h" class nsACString { ... }; Typedefs
char_type [
char] Storage unit for this class. self_type [nsACString] An alias for the type of this class. size_type [PRUint32] Type used to represent the number of bytes stored in the string. index_type [PRUint32] Type used to represent an offset into the string. Methods BeginReading The BeginReading function returns a const pointer to the first element of the string's internal buffer. ...
...tring] An alias for the type of this class. size_type [PRUint32] Type used to represent the number of bytes stored in the string. index_type [PRUint32] Type used to represent an offset into the string. Methods BeginReading The BeginReading function returns a const pointer to the first element of the string's internal buffer. EndReading The EndReading function returns a const
char_type pointer to the element just beyond the last element of the string's internal buffer. Length The Length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). Assign The Assign family of functions sets the value of a string's internal buffer. Replace The Replace family of functions sets the value of a string'...
... This operator is a shortcut for the Assign family of functions. operator+= This operator is a shortcut for the Append family of functions. Remarks The nsACString class is never instantiated directly. It should be instantiated using a subclass, such as nsEmbedCString. nsACString corresponds to the ACString and AUTF8String XPIDL data types. nsACString by itself does not imply a particular
character encoding. That is, it may be used to store UTF-8
characters, ASCII
characters, or any random binary data. The
character encoding in use for a particular nsACString instance depends on the context in which it is used. If used with XPIDL, then the
character encodings of the corresponding XPIDL data types applies. nsACString may even hold data with embedded null bytes. Thus, the length of the ...
nsAString
<< XPCOM API Reference Summary The nsAString abstract class represents a
character string composed of double-byte storage units. This class is typically used to represent Unicode
character arrays. #include "nsStringAPI.h" class nsAString { ... }; Typedefs
char_type [PRUni
char] Storage unit for this class. self_type [nsAString] An alias for the type of this class. size_type [PRUint32] Type used to represent the number of double-byte units stored in the string. index_type [PRUint32] Type used to represent an offset into the string. Methods BeginReading The BeginReading function returns a const pointer to the first element of the string's internal buffer. ...
...type of this class. size_type [PRUint32] Type used to represent the number of double-byte units stored in the string. index_type [PRUint32] Type used to represent an offset into the string. Methods BeginReading The BeginReading function returns a const pointer to the first element of the string's internal buffer. EndReading The EndReading function returns a const
char_type pointer to the element just beyond the last element of the string's internal buffer. Length The Length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). Assign The Assign family of functions sets the value of a string's internal buffer. Replace The Replace family of functions sets the value of ...
...r= This operator is a shortcut for the Assign family of functions. operator+= This operator is a shortcut for the Append family of functions. Remarks The nsAString class is never instantiated directly. It should be instantiated using a subclass, such as nsEmbedString . nsAString corresponds to the AString and DOMString XPIDL data types. nsAString by itself does not imply a particular
character encoding. That is, it may be used to store UTF-16
characters, UCS-2
characters, or any random double-byte data. The
character encoding in use for a particular nsAString instance depends on the context in which it is used. If used with XPIDL, then the
character encodings of the corresponding XPIDL data types applies. nsAString may even hold data with embedded null values. Thus, the length of ...
XPCOM glue classes
rationNS_LossyConvertUTF16toASCIIClass DeclarationNS_OVERRIDENS_OVERRIDE is a macro which allows C++ code in Mozilla to specify that a method is intended to override a base class method. If there is no base class method with the same signature, a compiler with static-checking enabled will fail to compile.NS_POSTCONDITIONMacroNS_PRECONDITIONMacronsACStringThe nsACString abstract class represents a
character string composed of single-byte storage units. This class is typically used to represent ASCII or UTF-8
character arrays.nsACString (External)Class DeclarationnsACString_internalClass DeclarationnsAdoptingCStringClass DeclarationnsAdoptingStringClass DeclarationnsAStringThe nsAString abstract class represents a
character string composed of double-byte storage units. This class is typically us...
... single-byte storage units. This class is typically used to represent ASCII or UTF-8
character arrays.nsACString (External)Class DeclarationnsACString_internalClass DeclarationnsAdoptingCStringClass DeclarationnsAdoptingStringClass DeclarationnsAStringThe nsAString abstract class represents a
character string composed of double-byte storage units. ...
...es from C++ code.nsCountedRefnsCountedRef<t> is a template class implementing an object that takes a strong reference to a reference-counted resource that must be released, typically on destruction of the object.</t>nsCStringClass DeclarationnsCString externalClass DeclarationnsCStringContainer (External)Class Declaration nsCStringEncodingThe nsCStringEncoding enumeration describes the set of
character encodings understood by the NS_CStringToUTF16 and NS_UTF16ToCString functions.nsDependentCStringClass DeclarationnsDependentCString externalClass DeclarationnsDependentCSubstringClass DeclarationnsDependentCSubstring externalClass DeclarationnsDependentStringClass DeclarationnsDependentString externalClass DeclarationnsDependentSubstringClass DeclarationnsDependentSubstring externalClass Dec...
mozIStorageStatement
oid finalize(); mozIStorageStatement clone(); AUTF8String getParameterName(in unsigned long aParamIndex); unsigned long getParameterIndex(in AUTF8String aName); AUTF8String getColumnName(in unsigned long aColumnIndex); unsigned long getColumnIndex(in AUTF8String aName); void reset(); AString escapeStringForLIKE(in AString aValue, in w
char aEscape
Char); void bindParameters(in mozIStorageBindingParamsArray aParameters); mozIStorageBindingParamsArray newBindingParamsArray(); void bindUTF8StringParameter(in unsigned long aParamIndex, in AUTF8String aValue); void bindStringParameter(in unsigned long aParamIndex, in AString aValue); void bindDoubleParameter(in unsigned long aParamIndex, in ...
...ound parameters and statement execution state. This must be called before reusing the statement. Note: JavaScript callers should always wrap their execution in a try block, and have a reset statement in a finally block. See the overview document on storage for more details. void reset() escapeStringForLIKE() Escapes a string for SQL LIKE search. ...
...n a try block, and have a reset statement in a finally block. See the overview document on storage for more details. void reset() escapeStringForLIKE() Escapes a string for SQL LIKE search. Note: Consumers will have to use same escape
char when doing statements such as: ...LIKE '?1' ESCAPE '/'.... See the sample code for more details. AString escapeStringForLIKE( in AString aValue, in w
char aEscape
Char ); Parameters aValue String to escape for SQL LIKE. aEscape
Char The escape
character to use. Generally, / will be sufficient. Return value An UTF-16 encoded string that has
characters that have special meaning escaped from aValue. Sample Code var statement = dbConn.createStatement( "SELECT * " + "FROM table_name " + "WHERE column_name LIKE :userInput ESCAPE '/'" ); ...
nsIAccessibleRole
. It is used for role="document". ROLE_PANE 16 Represents a pane within a frame or document window. Users can navigate between panes and within the contents of the current pane, but cannot navigate between items in different panes. Thus, panes represent a level of grouping lower than frame windows or documents, but above individual controls. It is used for the first child of a or iframe. ROLE_
CHART 17 Represents a graphical image used to represent data. ROLE_DIALOG 18 Represents a dialog box or message box. It is used for xul:dialog, role="dialog". ROLE_BORDER 19 Represents a window border. ROLE_GROUPING 20 Logically groups other objects. There is not always a parent-child relationship between the grouping object and the objects it contains. It is used for html:textfield, xul:groupbo...
...e. It is used for html:td, xul:tree cell and xul:listcell. Also, see ROLE_TABLE. ROLE_LINK 30 Represents a link to something else. This object might look like text or a graphic, but it acts like a button. It is used for xul:label@class="text-link", html:a, html:area, xforms:trigger@appearance="minimal". ROLE_HELPBALLOON 31 Displays a Help topic in the form of a ToolTip or Help balloon. ROLE_
CHARACTER 32 Represents a cartoon-like graphic object, such as Microsoft Office Assistant, which is displayed to provide help to users of an application. ROLE_LIST 33 Represents a list box, allowing the user to select one or more items. It is used for xul:listbox, html:select@size, role="list". See also ROLE_LIST_ITEM. ROLE_LISTITEM 34 Represents an item in a list. See also ROLE_LIST. ROLE_OUTLI...
...ocument content. An example of the use of this role is to represent an html:div. ROLE_REDUNDANT_OBJECT 108 An object which is redundant with another object in the accessible hierarchy. ATs typically ignore objects with this role. ROLE_FORM 109 A container of form controls. An example of the use of this role is to represent an html:form. ROLE_IME 110 An object which is used to allow input of
characters not found on a keyboard, such as the input of Chinese
characters on a Western keyboard. ROLE_APP_ROOT 111 ROLE_PARENT_MENUITEM 112 Represents a menu item, which is an entry in a menu that a user can choose to display another menu. ROLE_CALENDAR 113 A calendar that allows the user to select a date. ROLE_COMBOBOX_LIST 114 A list of items that is shown by combobox. ROLE_COMBOBOX_OP...
nsIFileProtocolHandler
RL string. Should only be called on files which are not directories. Otherwise identical to getURLSpecFromFile(), but is usually more efficient. Warning: This restriction may not be enforced at runtime! AUTF8String getURLSpecFromActualFile( in nsIFile file ); Parameters file The nsIFile to convert. Return value Corresponding url string. The resulting string may contain URL-escaped
characters. getURLSpecFromDir() Converts the nsIFile to the corresponding URL string. Should only be called on files which are directories. Otherwise identical to getURLSpecFromFile(), but is usually more efficient. WARNING: This restriction may not be enforced at runtime! AUTF8String getURLSpecFromDir( in nsIFile file ); Parameters file The nsIFile to convert. Return value Corresponding ...
...orresponding URL string. Should only be called on files which are directories. Otherwise identical to getURLSpecFromFile(), but is usually more efficient. WARNING: This restriction may not be enforced at runtime! AUTF8String getURLSpecFromDir( in nsIFile file ); Parameters file The nsIFile to convert. Return value Corresponding url string. The resulting string may contain URL-escaped
characters. getURLSpecFromFile() Converts the nsIFile to the corresponding URL string. If the nsIFile is a local file, then the result will be a file:// URL string. The resulting string may contain URL-escaped
characters. Note: Under some platforms this is a lossy conversion. Note: Callers should use getURLSpecFromActualFile() if possible, for performance reasons. AUTF8String getURLSpecFromFile( ...
...newFileURI() This method constructs a new file URI. nsIURI newFileURI( in nsIFile aFile ); Parameters aFile The nsIFile to convert. Return value A reference to a new nsIURI object. readURLFile() Takes a local file and tries to interpret it as an Internet shortcut (for example .url files on windows). ...
nsIMarkupDocumentViewer
erview void scrollToNode(in nsIDOMNode node); void sizeToContent(); Attributes Attribute Type Description allowPlugins boolean If true, plugins are allowed within the doc shell. default = true. Obsolete since Gecko 1.8 authorStyleDisabled boolean Disable entire author style level (including HTML presentation hints) bidi
CharacterSet octet Whether to force the user's
character set 1 - use the document
character set 2 - use the
character set chosen by the user. Obsolete since Gecko 6.0 bidiControlsTextMode octet The order of bidirectional text in form controls. 1 - logical 2 - visual 3 - like the containing document. Obsolete since Gecko 2.0 bidiNumeral octet The type of numerals to ...
...individual Bidi options. The default direction for the layout of bidirectional text. 1 - left to right 2 - right to left. bidiTextType octet The ordering of bidirectional text. This may be either "logical" or "visual". Logical text will be reordered for presentation using the Unicode Bidi Algorithm. Visual text will be displayed without reordering. 1 - the default order for the
charset 2 - logical order 3 - visual order. default
CharacterSet ACString force
CharacterSet ACString fullZoom float The amount by which to scale all lengths. Default is 1.0. hint
CharacterSet ACString hint
CharacterSetSource PRInt32 minFontSize long The minimum font size to allow. Note: This attri...
...Default is 1.0. Methods scrollToNode() Scroll the make the specified node visible. void scrollToNode( in nsIDOMNode node ); Parameters node The nsIDOMNode of the node to make visible. ...
nsIMsgFolder
tring oldValue, in ACString newValue); void NotifyIntPropertyChanged(in nsIAtom property, in long oldValue, in long newValue); void NotifyBoolPropertyChanged(in nsIAtom property, in boolean oldValue, in boolean newValue); void NotifyPropertyFlagChanged(in nsIMsgDBHdr item, in nsIAtom property, in unsigned long oldValue, in unsigned long newValue); void NotifyUni
charPropertyChanged(in nsIAtom property, in AString oldValue, in AString newValue); void NotifyItemAdded(in nsISupports item); void NotifyItemRemoved(in nsISupports item); void NotifyFolderEvent(in nsIAtom event); void ListDescendents(in nsISupportsArray descendents); void Shutdown(in boolean shutdownChildren); void setInVFEditSearchScope(in boolea...
... you might want to associate an identity with a particular newsgroup, or for IMAP shared folders in the other users namespace, you might want to create a delegated identity. gettingNewMessages boolean Are we running a url as a result of the user clicking get msg. filePath nsILocalFile Local path of this folder. baseMessageURI ACString readonly
charset ACString The
charset of this folder.
charsetOverride boolean biffState unsigned long locked boolean readonly flags unsigned long Direct access to the set/get all the flags at once. knowsSearchNntpExtension boolean readonly allowsPosting boolean readonly relativePathName ACString rea...
...nged(in nsIAtom property, in boolean oldValue, in boolean newValue); NotifyPropertyFlagChanged() void NotifyPropertyFlagChanged(in nsIMsgDBHdr item, in nsIAtom property, in unsigned long oldValue, in unsigned long newValue); NotifyUni
charPropertyChanged() void NotifyUni
charPropertyChanged(in nsIAtom property, in AString oldValue, in AString newValue); NotifyItemAdded() void NotifyItemAdded(in nsISupports item); NotifyItemRemoved() void NotifyItemRemoved(in nsISupports item); NotifyFolderEvent() void NotifyFolderEvent(in nsIAtom event); ListDescen...
nsIMsgHeaderParser
ame The name of the sender. This should be in UTF-8. aAddress The address of the sender. This should be in UTF-8. Return value A string of the form name <address>. Exceptions thrown Missing Exception Missing Description Native code only!makeFullAddressString Given an e-mail address and a person's name, cons them together into a single string, doing all the necessary quoting (const
char* version). string makeFullAddressString( in string aName, in string aAddress ); Parameters aName The name of the sender. This should be in UTF-8. aAddress The address of the sender. This should be in UTF-8. Return value A string of the form name <address>. Exceptions thrown Missing Exception Missing Description makeFullAddressWString() Obsolete since Gecko ...
...ng which contains a list of Header addresses, parses it into their component names and mailboxes. The returned value is the number of addresses, or a negative error code; the names and addresses are returned into the provided pointers as consecutive null-terminated strings. It is up to the caller to free them. Note that some of the strings may be zero-length. The caller may pass nsnull for
charset and it will be interpreted as "us-ascii". Either of the provided pointers may be NULL if the caller is not interested in those components. void parseHeaderAddresses( in string line, out string names, out string addresses, out PRUint32 numAddresses ); Parameters line The header line to parse. names A string of the names in the header line. The names are separated by null-ter...
...s set to true, quote will not be removed in case the name part of the email contains a comma. wstring unquotePhraseOrAddrWString( in wstring line, in boolean preserveIntegrity ); Parameters line The header line to parse. preserveIntegrity Missing Description Return value Missing Description Exceptions thrown Missing Exception Missing Description Remarks I think some of the
charset parameters might be obsolete... So this page is still W.I.P. See also ...
nsIScriptError
egory, in unsigned long long innerWindowID); AUTF8String toString(); Attributes Attribute Type Description category string A string indicating the category of error that occurred See Categories for a list. Read only. columnNumber PRUint32 The column number where the error occurred. This is used to draw the arrow pointing to the problem
character. Read only. errorMessage AString The error message in a string format without any context/line number information. Note: nsIConsoleMessage.message will return the error formatted with file/line information. Read only. flags PRUint32 Flags; see Flag constants for a list. Read only. innerWindowID unsigned long long The inner...
...e. sourceLine The line number in the source file on which the error occurred. You are responsible for providing that line. You may pass null if you are lazy; that will prevent showing the source line in JavaScript Console. lineNumber The number of the line where the error occurred. columnNumber The column number where the error occurred. This is used to draw an arrow pointing to the problem
character. flags One of flags listed in Flag constants. category A string indicating what kind of code caused the message. There are quite a few category strings and they don't seem to be listed in a single place. See Categories for a partial list. initWithWindowID() Initializes the nsIScriptError object with the given inner window's ID. Note: Prior to Gecko 12.0, this method was provided by ...
...e. sourceLine The line number in the source file on which the error occurred. You are responsible for providing that line. You may pass null if you are lazy; that will prevent showing the source line in JavaScript Console. lineNumber The number of the line where the error occurred. columnNumber The column number where the error occurred. This is used to draw an arrow pointing to the problem
character. flags One of the script error Flag constants category A string indicating what kind of code caused the message. There are quite a few category strings and they aren't listed in a single place, so you may need to search the Firefox code to find the one you want. See Categories for a partial list. innerWindowID The ID of the inner window associated with the error. toString() Outputs ...
nsIStandardURL
: nsIMutable Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/network/standard-url;1. To create an instance, use: var standardURL = Components.classes["@mozilla.org/network/standard-url;1"] .createInstance(Components.interfaces.nsIStandardURL); Method overview void init(in unsigned long aUrlType, in long aDefaultPort, in AUTF8String aSpec, in string aOrigin
Charset, in nsIURI aBaseURI); Attributes Attribute Type Description mutable boolean Control whether or not this URL can be modified. Protocol handlers can set this flag before handing out an URL to ensure that it is not inadvertently modified. Obsolete since Gecko 1.9 Constants These constants describe how to normalize an URL. Constant Value Description URLTYPE_STANDARD 1 blah:foo/ba...
...://foo/bar => blah://foo/bar blah:///foo/bar => blah://foo/bar URLTYPE_NO_AUTHORITY 3 blah:foo/bar => blah:///foo/bar blah:/foo/bar => blah:///foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah:///foo/bar Methods init() Normalizes a given URL to an Standard URL. void init( in unsigned long aUrlType, in long aDefaultPort, in AUTF8String aSpec, in string aOrigin
Charset, in nsIURI aBaseURI ); Parameters aUrlType One of the constants listed above. aDefaultPort If the port parsed from the URL string matches this port, then the port will be removed from the canonical form of the URL. aSpec URL string. aOrigin
Charset The
charset from which this URI string originated. this corresponds to the
charset that should be used when communicating this URI to an origin ...
...aultPort If the port parsed from the URL string matches this port, then the port will be removed from the canonical form of the URL. aSpec URL string. aOrigin
Charset The
charset from which this URI string originated. this corresponds to the
charset that should be used when communicating this URI to an origin server, for example. if null, then provide aBaseURI implements this interface, the origin
charset of aBaseURI will be assumed, otherwise defaulting to UTF-8 (that is, no
charset transformation from aSpec). aBaseURI If null, aSpec must specify an absolute URI. Otherwise, aSpec will be resolved relative to aBaseURI. See also nsIURL ...
nsITextInputProcessor
cancelComposition() can take a KeyboardEvent which causes modifying the composition state. Specifying a keyboard event is strongly recommended if the TextInputProcessor emulates input from keyboard. For example: TIP.setPendingCompositionString("a"); TIP.appendClauseToPendingComposition("a".length, TIP.ATTR_RAW_CLAUSE); TIP.setCaretPosition("a".length); // This means that the first composition
character is inputted by a keypress of "a" key. var AKeyEvent = new KeyboardEvent("", { key: "a", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_A }); TIP.flushPendingComposition(AKeyEvent); // Pressing shift key for next input. var shiftKeyEvent = new KeyboardEvent("", { key: "Shift", code: "ShiftLeft", keyCode: KeyboardEvent.DOM_VK_SHIFT }); TIP.keydown(shiftKeyEvent); TIP.setPendingCompositionSt...
...Composition(AKeyEvent); // Pressing shift key for next input. var shiftKeyEvent = new KeyboardEvent("", { key: "Shift", code: "ShiftLeft", keyCode: KeyboardEvent.DOM_VK_SHIFT }); TIP.keydown(shiftKeyEvent); TIP.setPendingCompositionString("aB"); TIP.appendClauseToPendingComposition("aB".length, TIP.ATTR_RAW_CLAUSE); TIP.setCaretPosition("aB".length); // This means that the second composition
character is inputted by a keypress of "b" key during left shift key is down. var BKeyEvent = new KeyboardEvent("", { key: "b", code: "KeyB", keyCode: KeyboardEvent.DOM_VK_B }); TIP.flushPendingComposition(BKeyEvent); // Releasing shift key TIP.keyup(shiftKeyEvent); TIP.setPendingCompositionString("AB"); TIP.appendClauseToPendingComposition("AB".length, TIP.ATTR_SELECTED_CLAUSE); TIP.setCaretPositio...
...ode Values. keyCode Optional, but should be specified when you dispatch printable key events. When you emulate PC keyboard, deciding the value may be complicated. Although the rules to decide the keyCode value are different on each web browser, you should use same rules as Gecko because your events are dispatched on Gecko. Basically, Gecko decides a keyCode value for a printable key from ASCII
character which is inputted with a far simpler modifier state. See "Printable keys in standard position" section of KeyboardEvent.keyCode for the strict rules of Gecko. When you dispatch non-printable key events, preferred keyCode value is computed from key value automatically if you don't initialize this value. But the computation doesn't emulate the mapping of native key event handling completely b...
XPCOM Interface Reference
amnsIBinaryOutputStreamnsIBlocklistPromptnsIBlocklistServicensIBoxObjectnsIBrowserBoxObjectnsIBrowserHistorynsIBrowserSearchServicensICRLInfonsICRLManagernsICachensICacheDeviceInfonsICacheEntryDescriptornsICacheEntryInfonsICacheListenernsICacheMetaDataVisitornsICacheServicensICacheSessionnsICacheVisitornsICachingChannelnsICancelablensICategoryManagernsIChannelnsIChannelEventSinknsIChannelPolicynsI
CharsetResolvernsIChromeFrameMessageManagernsIChromeRegistrynsIClassInfonsIClipboardnsIClipboardCommandsnsIClipboardDragDropHookListnsIClipboardDragDropHooksnsIClipboardHelpernsIClipboardOwnernsICollectionnsICommandControllernsICommandLinensICommandLineHandlernsICommandLineRunnernsIComponentManagernsIComponentRegistrarnsICompositionStringSynthesizernsIConsoleListenernsIConsoleMessagensIConsoleServicen...
...IContentPrefService2nsIContentSecurityPolicynsIContentSniffernsIContentViewnsIContentViewManagernsIContentViewernsIControllernsIControllersnsIConverterInputStreamnsIConverterOutputStreamnsICookiensICookie2nsICookieAcceptDialognsICookieConsentnsICookieManagernsICookieManager2nsICookiePermissionnsICookiePromptServicensICookieServicensICookieStoragensICrashReporternsICryptoHMACnsICryptoHashnsICurrent
CharsetListenernsICycleCollectorListenernsIDBChangeListenernsIDBFolderInfonsIDNSListenernsIDNSRecordnsIDNSRequestnsIDNSServicensIDOMCanvasRenderingContext2DnsIDOMChromeWindownsIDOMClientRectnsIDOMDesktopNotificationnsIDOMDesktopNotificationCenternsIDOMElementnsIDOMEventnsIDOMEventGroupnsIDOMEventListenernsIDOMEventTargetnsIDOMFilensIDOMFileErrornsIDOMFileExceptionnsIDOMFileListnsIDOMFileReadernsIDOMFo...
...uestManagernsISmsServicensISocketProvidernsISocketProviderServicensISocketTransportnsISocketTransportServicensISoundnsISpeculativeConnectnsIStackFramensIStandardURLnsIStreamConverternsIStreamListenernsIStringBundlensIStringBundleOverridensIStringBundleServicensIStringEnumeratornsIStructuredCloneContainernsIStyleSheetServicensISupportsnsISupports proxiesnsISupportsArraynsISupportsCStringnsISupports
CharnsISupportsDoublensISupportsFloatnsISupportsIDnsISupportsInterfacePointernsISupportsPRBoolnsISupportsPRInt16nsISupportsPRInt32nsISupportsPRInt64nsISupportsPRTimensISupportsPRUint8nsISupportsPRUint16nsISupportsPRUint32nsISupportsPRUint64nsISupportsPrimitivensISupportsPrioritynsISupportsStringnsISupportsVoidnsISupportsWeakReferencensISyncJPAKEnsISyncMessageSendernsITXTToHTMLConvnsITaggingServicensIT...
NS_CStringAppendData
aDataLength [in] The length of aData, measured in storage units. ...
... aDataLength [in] The length of aData, measured in storage units. ...
...nated. 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_CStringSetDataRange. 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. See Also NS_CStringSetDataRange, nsACString ...
NS_CStringContainerInit2
This parameter may be null. ...
...This parameter may be null. aDataLength [in] An optional parameter that specifies the length of the array pointed to by aData. ...
...ne of the helper classes, such as nsCString, instead of coding directly to NS_CStringContainerInit2 because those classes take care of cleaning up the string object when it goes out of scope. When NS_CStringContainerInit2 is told to copy aData, the copy it creates is null-terminated. This is significant as it allows the programmer to be certain that NS_CStringGetData will return a null-terminated
character array. The NS_CStringContainerInit function is equivalent to calling NS_CStringContainerInit with aData=nsnull and aFlags=0. History This function was finalized for Mozilla 1.8. See bug 264274 for details. See Also NS_CStringContainerInit, NS_CStringContainerFinish ...
NS_CStringGetMutableData
<< XPCOM API Reference Summary The NS_CStringGetMutableData function gives the caller write access to the string's internal buffer. #include "nsStringAPI.h" PRUint32 NS_CStringGetMutableData( nsACString& aString, PRUint32 aDataLength,
char** aData ); Parameters aString [in] A nsACString instance to modify. aDataLength [in] The number of
characters to resize the string's internal buffer to or PR_UINT32_MAX to return the buffer as-is. aData [out] Upon return, if the function was successful, then *aData references the string's internal buffer. Return Values This function returns the number of
characters contained in the string's internal buffer (excluding any null-terminator). This value will be zero if the function failed to resize its internal buffer to the size requested. Re...
...The returned pointer remains valid until the string object is passed to some other string function. This function does not necessarily null-terminate aString's internal buffer after resizing it. That behavior depends on the implementation of aString. ...
...es not necessarily null-terminate aString's internal buffer after resizing it. That behavior depends on the implementation of aString. If aString is a reference to a nsCStringContainer, then its data will be null-terminated by this function. The caller is not responsible for writing a null-terminator. Example // Convert any uppercase ASCII letters to lowercase void ToLowerCase(nsCString &str) {
char *iter; PRUint32 len = NS_CStringGetMutableData(str, PR_UINT32_MAX, &iter);
char *end = iter + len; while (iter != end) {
char c = *iter; if (c >= 'A' && c <= 'Z') *iter = c + ('a' - 'A'); ++iter; } } History This function was finalized for Mozilla 1.8. See bug 288786 for details. See Also NS_CStringGetData ...
NS_CStringSetDataRange
<< XPCOM API Reference Summary The NS_CStringSetDataRange function copies data into a section of the string's internal buffer. This is a low-level API. #include "nsStringAPI.h" nsresult NS_CStringSetDataRange( nsACString& aString, PRUint32 aCutStart, PRUint32 aCutLength, const
char* aData, PRUint32 aDataLength = PR_UINT32_MAX ); Parameters aString [in] A nsACString instance to modify. 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. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise...
...o be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_CStringSetDataRange function returns NS_OK if successful. Otherwise, it returns an error code. ...
... 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(matchVal, &mp); nl = NS_CStringGetData(newVal, &np); for (const
char* iter = sp; iter <= sp + sl - ml; ++iter) { if (memcmp(iter, mp, ml) == 0) { PRUint32 offset = iter - sp; NS_CStringSetDataRange(str, offset, ml, np, nl); sl = NS_CStringGetData(str, &sp); iter = sp + offset + nl - 1; } } } History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also nsACString ...
NS_StringCutData
its. 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_StringSetDataRange. ...
...n 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_StringSetDataRange. Note: GCC requires the -fshort-w
char option to compile this example since PRUni
char is an unsigned short. ...
...See bug 239123 for details. ...
NS_StringSetDataRange
<< XPCOM API Reference Summary The NS_StringSetDataRange function copies data into a section of the string's internal buffer. This is a low-level API. #include "nsStringAPI.h" nsresult NS_StringSetDataRange( nsAString& aString, PRUint32 aCutStart, PRUint32 aCutLength, const PRUni
char* aData, PRUint32 aDataLength = PR_UINT32_MAX ); Parameters aString [in] A nsAString instance to modify. 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. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Other...
...inated. Otherwise, aData need not be null terminated. Return Values The NS_StringSetDataRange function returns NS_OK if successful. Otherwise, it returns an error code. ...
...See bug 239123 for details. See Also nsAString ...
Streams - Plugins
ea to check that the file exists in the directory at the start of this method. If an error occurs during data retrieval or writing to the file, the browser passes null for the filename. If the file is created from a stream from the network, the file is locked in the the browser disk cache until the stream or its instance is destroyed. void NPP_StreamAsFile(NPP instance, NPStream *stream, const
char* fname); The instance parameter is the current plug-in; the stream parameter specifies the current stream. The fname parameter specifies the full path to a local file (or null if an error occurs during data retrieval or writing to the file). Sending a Stream When a plug-in sends a data stream to the browser, it performs several tasks. The plug-in calls the methods NPN_NewStream, NPN_Write, ...
... to the plug-in as an output parameter. The plug-in can use this stream object in subsequent NPN_Write calls to the browser. When all the plug-in data is written into the stream, the plug-in must terminate the stream and deallocate the NPStream object by calling the NPN_DestroyStream function. NPError NPN_NewStream(NPP instance, NPMIMEType type, const
char* target, NPStream** stream); The instance parameter is the plug-in instance that is creating the stream; the type specifies the MIME type of the stream. The target parameter specifies the window or frame. For the possible values of named targets, see the reference entry for NPN_NewStream. The target should not be the same window. The stream parameter represents the strea...
... the complete list of codes, see "Result Codes." For an example that demonstrates using this function with NPN_NewStream and NPN_Write, see "Example of Sending a Stream." Example of Sending a Stream The following code creates a new stream of HTML text displayed by the browser in a new window, writes it, and destroys the stream. Error handling has been omitted for simplicity. NPStream* stream;
char* myData = "<html><head><title>This is a message from my plug-in!</title></head><body><p><strong>This is a message from my plug-in!</strong></p></body>/html>"; int32 myLength = strlen(myData) + 1; /* Create the stream. */ err = NPN_NewStream(instance, "text/html", "_blank", &stream); /* Push data into the stream. */ err = NPN_Write(instance, stream, myLength, myData); /* Delete the stream. */ e...
BatteryManager - Web APIs
The BatteryManager interface provides ways to get information about the system's battery
charge level. The navigator.getBattery() method returns a battery promise that is resolved in a BatteryManager interface which you can use to interact with the Battery Status API. Properties BatteryManager.
charging Read only A Boolean value indicating whether or not the battery is currently being
charged. BatteryManager.
chargingTime Read only A number representing the remaining time in seconds until the battery is fully
charged, or 0 if the battery is already fully
charged. BatteryManager.dis
chargingTime Read only A number representing the remaining time in seconds until the battery is completely dis
charged and the system will suspend. BatteryManager.level Read only A number representing...
...gingTime Read only A number representing the remaining time in seconds until the battery is fully
charged, or 0 if the battery is already fully
charged. BatteryManager.dis
chargingTime Read only A number representing the remaining time in seconds until the battery is completely dis
charged and the system will suspend. BatteryManager.level Read only A number representing the system's battery
charge level scaled to a value between 0.0 and 1.0. Event handlers BatteryManager.on
chargingchange A handler for the
chargingchange event; This event is sent when the battery
charging state is updated. ...
...emaining time in seconds until the battery is completely dis
charged and the system will suspend. BatteryManager.level Read only A number representing the system's battery
charge level scaled to a value between 0.0 and 1.0. Event handlers BatteryManager.on
chargingchange A handler for the
chargingchange event; This event is sent when the battery
charging state is updated. BatteryManager.on
chargingtimechange A handler for the
chargingtimechange event; This event is sent when the battery
charging time is updated BatteryManager.ondis
chargingtimechange A handler for the dis
chargingtimechange event; This event is sent when the battery dis
charging time is updated. BatteryManager.onlevelchange A handler for the levelchange event; This event is sent when the battery level is updated. Me...
BluetoothDevice - Web APIs
BluetoothDevice.name Read only A DOMString that provices a human-readable name for the device. BluetoothDevice.gatt Read only A reference to the device's BluetoothRemoteGATTServer. BluetoothDevice.uuids Read only Lists ...
...d on Google's Chrome OS 45 and removed from Chrome 52. BluetoothDevice.adData Read only An instance of BluetoothAdvertisingData containing the most recent advertising data received for the device. BluetoothDevice.deviceClass Read only A number representing the Bluetooth devices "Class of Device". BluetoothDevice.vendorIDSource Read only The Vendor ID Source field in the pnp_id
characteristic in the device_information service. BluetoothDevice.vendorID Read only The 16-bit Vendor ID field in the pnp_id
characteristic in the device_information service. BluetoothDevice.productID Read only The 16-bit Product ID field in the pnp_id
characteristic in the device_information service. BluetoothDevice.productVersion Read only The 16-bit Product Version field in the p...
... BluetoothDevice.paired Read only A Boolean value indicating whether the device is paired with the system. BluetoothDevice.gattServer Read only A reference to the device's GATT server or null if the device is disconnected. ...
CSSRule - Web APIs
Added value NAMESPACE_RULE. C...
... Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSRule' in that specification. Working Draft Obsoleted values
CHARSET_RULE and UNKNOWN_RULE. Added value NAMESPACE_RULE. CSS AnimationsThe definit...
...Added value NAMESPACE_RULE. CSS AnimationsThe definition of 'CSSRule' in that specification. Working Draft Added values KEYFRAMES_RULE and KEYFRAME_RULE. CSS Fonts Module Level 4The definition of 'CSSRule' in that specification. ...
Binary strings - Web APIs
JavaScript strings are UTF-16 encoded strings. This means that each code unit requires two bytes of 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 strin...
...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. 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 manipul...
...s 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 data. In the past, this had to be simulated by treating the raw data as a string and using the
charCodeAt() method to read the bytes from the data buffer (i.e., using binary strings). However, this is slow and error-prone, due to the need for multiple conversions (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats). JavaScript typed arrays provide a mechanism for accessing raw binary data much more efficiently. The StringView Non native ...
Element.innerHTML - Web APIs
Use Node.textContent to get a raw copy of these text nodes' contents. To insert the HTML into the document rather than replace the contents of an element, use the method insertAdjacentHTML(). ...
...Use Node.textContent to get a raw copy of these text nodes' contents. To insert the HTML into the document rather than replace the contents of an element, use the method insertAdjacentHTML(). ...
...riginal page markup. Replacing the contents of an element Setting the value of innerHTML lets you easily replace the existing contents of an element with new content. For example, you can erase the entire contents of a document by clearing the contents of the document's body attribute: document.body.innerHTML = ""; This example fetches the document's current HTML markup and replaces the "<"
characters with the HTML entity "<", thereby essentially converting the HTML into raw text. This is then wrapped in a <pre> element. Then the value of innerHTML is changed to this new string. As a result, the document contents are replaced with a display of the page's entire source code. document.documentElement.innerHTML = "<pre>" + document.documentElement.innerHTML.replace(/</g,"<")...
Element: keypress event - Web APIs
Since this event has been deprecated, you should look to use beforeinput or keydown instead. ...
... Since this event has been deprecated, you should look to use beforeinput or keydown instead. ...
... Since this event has been deprecated, you should look to use beforeinput or keydown instead. ...
Using files from web applications - Web APIs
ame as a read-only string. This is just the file name, and does not include any path information. size The size of the file in bytes as a read-only 64-bit integer. type The MIME type of the file as a read-only string or "" if the type couldn't be determined. ...
... Before actually transferring the data, several preparatory steps are taken: The XMLHtt...
...ch uses PHP on the server side and JavaScript on the client side, demonstrates asynchronous uploading of a file. <?php if (isset($_FILES['myFile'])) { // Example: move_uploaded_file($_FILES['myFile']['tmp_name'], "uploads/" . ...
HTMLAnchorElement - Web APIs
"12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLAnchorElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement, and implements those from HTMLHyperlinkElementUtils. Element.accessKey Is a DOMString representing a single
character that switches input focus to the hyperlink. HTMLAnchorElement.download Is a DOMString indicating that the linked resource is intended to be downloaded rather than displayed in the browser. The value represent the proposed name of the file. If the name is not a valid filename of the underlying OS, browser will adapt it. HTMLHyperlinkElementUtils.hash Is a USVString representing the frag...
...isplay the linked resource. HTMLAnchorElement.text Is a DOMString being a synonym for the Node.textContent property. HTMLAnchorElement.type Is a DOMString that reflects the type HTML attribute, indicating the MIME type of the linked resource. HTMLHyperlinkElementUtils.username Is a USVString containing the username specified before the domain name. Obsolete properties HTMLAnchorElement.
charset Is a DOMString representing the
character encoding of the linked resource. HTMLAnchorElement.coords Is a DOMString representing a comma-separated list of coordinates. HTMLAnchorElement.name Is a DOMString representing the anchor name. HTMLAnchorElement.rev Is a DOMString representing that the rev HTML attribute, specifying the relationship of the link object to the target object...
...thname, port, protocol, search, and hash, have been moved to the HTMLHyperlinkElementUtils mixin, and HTMLAnchorElement implements this mixin. HTML5The definition of 'HTMLAnchorElement' in that specification. Recommendation The methods blur() and focus(), as well as the properties tabindex and accessKey, are now defined on HTMLElement. The following properties are now obsolete:
charset, coords, name, rev, and shape. The following properties have been added: hash, host, hostname, media, pathname, port, protocol, relList, search, and text. Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLAnchorElement' in that specification. Obsolete No change from Document Object Model (DOM) Level 1 Specification. Document Object Model (...
HTMLFormElement - Web APIs
on HTML attribute, containing the URI of a program that processes the information submitted by the form. HTMLFormElement.encoding or HTMLFormElement.enctype A DOMString reflecting the value of the form's enctype HTML attribute, indicating the type of content that is used to transmit the form to the server. Only specified values can be set. The two properties are synonyms. HTMLFormElement.accept
Charset A DOMString reflecting the value of the form's accept-
charset HTML attribute, representing the
character encoding that the server accepts. HTMLFormElement.autocomplete A DOMString reflecting the value of the form's autocomplete HTML attribute, indicating whether the controls in this form can have their values automatically populated by the browser. HTMLFormElement.noValidate A Boolean ref...
...utton type="button" onclick="setFormInfo(this.form);">Set</button> <button type="reset">Reset</button> </p> <textarea id="form-info" rows="15" cols="20"></textarea> </form> <script> function getFormInfo(){ // Get a reference to the form via its name var f = document.forms["formA"]; // The form properties we're interested in var properties = [ 'elements', 'length', 'name', '
charset', 'action', 'accept
Charset', 'action', 'enctype', 'method', 'target' ]; // Iterate over the properties, turning them into a string that we can display to the user var info = properties.map(function(property) { return property + ": " + f[property] }).join("\n"); // Set the form's <textarea> to display the form's properties document.forms["formA"].elements['form-info'].value = i...
...to display the form's properties document.forms["formA"].elements['form-info'].value = info; // document.forms["formA"]['form-info'].value would also work } function setFormInfo(f){ // Argument should be a form element reference. ...
HTMLOrForeignElement.dataset - Web APIs
rectly written. Instead, all writes must be to the individual properties within the dataset, which in turn represent the data attributes. Note also that an HTML data-attribute and its corresponding DOM dataset.property do not share the same name, but they are always similar: In HTML, the name of a custom data attribute begins with data-. It must contain only letters, numbers, and the following
characters: dash (-), dot (.), colon (:), underscore (_)--but NOT any ASCII capital letters (A to Z). In JavaScript, the name of a custom data attribute is the name of the same HTML attribute, but in camelCase and with no dashes, dots, etc. In addition to the information below, you'll find a how-to guide for using HTML data attributes in our article Using data attributes. Name conversion dash-s...
...ing data attributes. Name conversion dash-style to camelCase conversion A custom data attribute name is transformed to a key for the DOMStringMap entry with the following rules The prefix data- is removed (including the dash); For any dash (U+002D) followed by an ASCII lowercase letter a to z, the dash is removed, and the letter is transformed into its uppercase counterpart; Other
characters (including other dashes) are left unchanged. camelCase to dash-style conversion The opposite transformation, which maps a key to an attribute name, uses the following rules: Restriction: Before the transformation, a dash must not be immediately followed by an ASCII lowercase letter a to z; The prefix data- is added; Any ASCII uppercase letter A to Z is transformed into a da...
... The restriction in the rules above ensures that the two transformations are the inverse one of the other. For example, the attribute named data-abc-def corresponds to the key abcDef. Accessing values Attributes can be set and read by using the camelCase name (the key) like an object property of the dataset, as in element.dataset.keyname Attributes can also be...
KeyboardEvent.initKeyEvent() - Web APIs
s; other browsers implemented KeyboardEvent.initKeyboardEvent based on early drafts of Document Object Model (DOM) Level 3 Events Specification. Favor the modern constructor structure as the only cross-browser way of building events. Syntax event.initKeyEvent (type, bubbles, cancelable, viewArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, keyCodeArg,
charCodeArg) Parameters type Is a DOMString representing the type of event. bubbles Is a Boolean indicating whether the event should bubble up through the event chain or not (see bubbles). cancelable Is a Boolean i indicating whether the event can be canceled (see cancelable). viewArg Specifies the UIEvent.view; this value may be null. ctrlKeyArg Is a Boolean that is true if the virtual ...
...olean that is true if the virtual key to be generated is a combination of keys containing the Shift key. metaKeyArg Is a Boolean that is true if the virtual key to be generated is a combination of keys containing the Meta key. keyCodeArg Is a unsigned long representing the virtual key code value of the key which was depressed, otherwise 0. See KeyboardEvent.keyCode for the list of key codes.
charCodeArg Is a unsigned long representingthe Unicode
character associated with the depressed key otherwise 0. Example var event = document.createEvent('KeyboardEvent'); // create a key event // define the event event.initKeyEvent("keypress", // typeArg, true, // canBubbleArg, true, // cancelableArg, null, ...
..., null, // viewArg, Specifies UIEvent.view. This value may be null. false, // ctrlKeyArg, false, // altKeyArg, false, // shiftKeyArg, false, // metaKeyArg, 9, // keyCodeArg, 0); //
charCodeArg); document.getElementById('blah').dispatchEvent(event); Specification This implementation of keyboard events is based on the key events spec in the early versions of DOM 2 Events, later removed from that spec. The initKeyEvent is the current Gecko equivalent of the DOM Level 3 Events (initially drafted and also deprecated in favor of KeyboardEvent() Keyboard.initKeyboardEvent() method...
MutationObserverInit - Web APIs
Otherwise, a TypeError exception will be thrown. subtree Optional Set to true to extend monitoring to the entire subtree of nodes rooted at target. ...
...ored. If this property isn't included, changes to all attributes cause mutation notifications. attributeOldValue Optional Set to true to record the previous value of any attribute that changes when monitoring the node or nodes for attribute changes; see Monitoring attribute values in MutationObserver for details on watching for attribute changes and value recording. The default value is false. ...
... to record the previous value of any attribute that changes when monitoring the node or nodes for attribute changes; see Monitoring attribute values in MutationObserver for details on watching for attribute changes and value recording. The default value is false.
characterData Optional Set to true to monitor the specified target node (and, if subtree is true, its descendants) for changes to the
character data contained within the node or nodes. The default value is true if
characterDataOldValue is specified, otherwise the default value is false.
characterDataOldValue Optional Set to true to record the previous value of a node's text whenever the text changes on nodes being monitored. For details and an example, see Monitoring text content changes in MutationObserver. The default value is f...
MutationRecord - Web APIs
A MutationRecord represents an individual DOM mutation. It is the object that is passed to MutationObserver's callback. Properties Property Type Description MutationRecord.type String Returns "attributes" if the mutation was an attribute mutation, "
characterData" if it was a mutation to a
CharacterData node, and "childList" if it was a mutation to the tree of nodes. MutationRecord.target Node Returns the node the mutation affected, depending on the MutationRecord.type. For attributes, it is the element whose attribute changed. For
characterData, it is the
CharacterData node. For childList, it is the node whose children changed. MutationRecord.addedNodes NodeList Return the nodes added. Will be an empty NodeList ...
...nRecord.attributeName String Returns the local name of the changed attribute, or null. MutationRecord.attributeNamespace String Returns the namespace of the changed attribute, or null. MutationRecord.oldValue String The return value depends on the MutationRecord.type. For attributes, it is the value of the changed attribute before the change. ...
...f the changed attribute, or null. MutationRecord.oldValue String The return value depends on the MutationRecord.type. For attributes, it is the value of the changed attribute before the change. For
characterData, it is the data of the changed node before the change. For childList, it is null. Note that for this to work as expected, attributeOldValue or
characterDataOldValue must be set to true in the corresponding MutationObserverInit parameter of the MutationObserver observe method Specifications Specification Status Comment DOMThe definition of 'MutationRecord' in that specification. Living Standard ...
NonDocumentTypeChildNode.nextElementSibling - Web APIs
ementSibling')) { return; } Object.defineProperty(item, 'nextElementSibling', { configurable: true, enumerable: true, get: function () { var el = this; while (el = el.nextSibling) { if (el.nodeType === 1) { return el; } } return null; }, set: undefined }); }); })([Element.prototype,
CharacterData.prototype]); Specifications Specification Status Comment DOMThe definition of 'ChildNodenextElementSibling' in that specification. Living Standard Split the ElementTraversal interface in ChildNode, ParentNode, and NonDocumentTypeChildNode. This method is now defined on the former. The Element and
CharacterData interfaces implemented the new interface. ...
...See polyfill.Opera Full support 10Safari Full support 4WebView Android...
... 12Notes Full support 12Notes Notes Before Edge 79, this property was only implemented for Element, not for
CharacterData.Firefox Full support 3.5IE Partial support 9Notes Partial support 9Notes Notes Only implemented for Element, not for
CharacterData. See polyfill.Opera Full support 10Safari Full support 4WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android ...
RTCDTMFToneChangeEvent.RTCDTMFToneChangeEvent() - Web APIs
DTMFToneChangeEvent() constructor creates a new RTCDTMFToneChangeEvent. Syntax var event = new RTCDTMFToneChangeEvent(type, options); Parameters type A DOMString containing the name of the event. This is always "tonechange". options A dictionary of type RTCDTMFToneChangeEventInit, which may contain one or more of the following fields: tone A DOMString containing a single DTMF tone
character which has just begun to play, or an empty string ("") to indicate that the previous tone has stopped playing. See Tone
characters for details on what
characters are permitted. Return value A newly-created RTCDTMFToneChangeEvent, configured as specified in the provided options. Tone
characters The digits 0-9 These
characters represent the digit keys on a telephone keypad. The let...
...These are not interpreted as digits. Lower-case "a"-"d" automatically gets converted to upper-case. ...
...racters represent the "A" through "D" keys which are part of the DTMF standard but not included on most telephones. These are not interpreted as digits. Lower-case "a"-"d" automatically gets converted to upper-case. The pound/hash sign ("#") and the asterisk ("*") These correspond to the similarly-labeled keys which are typically on the bottom row of the telephone keypad. The comma (",") This
character instructs the dialing process to pause for two seconds before sending the next
character in the buffer. All other
characters are unrecognized and will cause insertDTMF() to throw an Invalid
CharacterError exception. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCDTMFToneChangeEvent()' in that ...
RTCIceCandidate.usernameFragment - Web APIs
usernameFragment is extracted from the m-line. Syntax var ufrag = RTCIceCandidate.usernameFragment; Value A DOMString containing the username fragment (usually referred to in shorthand as "ufrag" or "ice-ufrag") that, along with the ICE password ("ice-pwd"), uniquely identifies a single ongoing ICE interaction, including for any communication with the STUN server. ...
... Usage notes ICE uses the usernameFragment and password to ensure message integrity. ...
... no default value. Randomization At least 24 bits of the text in the ufrag are required to be randomly selected by the ICE layer at the beginning of the ICE session. The specifics for which bits are random and what the remainder of the ufrag text are are left up to the browser implementation to decide. For example, a browser might choose to always use a 24-
character ufrag in which bit 4 of each
character is randomly selected between 0 and 1. Another example: it might take a user-defined string and append three 8-bit random bytes to the end. Or perhaps every
character is entirely random. Usage notes ICE uses the usernameFragment and password to ensure message integrity. This avoids crosstalk among multiple ongoing ICE sessions, but, more importantly, helps secure ICE transactions (and all o...
RTCIceCandidateInit.usernameFragment - Web APIs
andidateInit dictionary specifies the value of the RTCIceCandidate object's usernameFragment property. Value A DOMString containing the username fragment (usually referred to in shorthand as "ufrag" or "ice-ufrag") that, along with the ICE password ("ice-pwd"), uniquely identifies a single ongoing ICE interaction, including for any communication with the STUN server. ...
... Example ... ...
... no default value. Randomization At least 24 bits of the text in the ufrag are required to be randomly selected by the ICE layer at the beginning of the ICE session. The specifics for which bits are random and what the remainder of the ufrag text are are left up to the browser implementation to decide. For example, a browser might choose to always use a 24-
character ufrag in which bit 4 of each
character is randomly selected between 0 and 1. Another example: it might take a user-defined string and append three 8-bit random bytes to the end. Or perhaps every
character is entirely random. Example ... Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidateInit.usernameFragment' in that spe...
Range.setStart() - Web APIs
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. ...
...nodeValue}`; log.appendChild(li); }); // Highlight the street and city const startOffset = 2; // Start at third node: 101 E. Main St. const endOffset = 5; // End at fifth node: Dodge City, KS const range = document.createRange(); range.setStart(address, startOffset); range.setEnd(address, endOffset); const mark = document.createElement('mark'); range.surroundContents(mark); Result Get
characters from a text node This example uses the Range.setStart() and Range.setEnd() methods to define the contents of a range. The resulting range contains the first through fifth
characters within a text node. HTML <p id="content">0123456789</p> <p id="log"></p> JavaScript const element = document.getElementById('content'); const textNode = element.childNodes[0]; const range = document.createR...
...Start() and Range.setEnd() methods to define the contents of a range. The resulting range contains the first through fifth
characters within a text node. HTML <p id="content">0123456789</p> <p id="log"></p> JavaScript const element = document.getElementById('content'); const textNode = element.childNodes[0]; const range = document.createRange(); range.setStart(textNode, 0); // Start at first
character range.setEnd(textNode, 5); // End at fifth
character document.getElementById('log').textContent = range; Result Specifications Specification Status Comment DOMThe definition of 'Range.setStart()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.setStar...
ReadableStreamDefaultReader.read() - Web APIs
efaultReader created using getReader(). (see our Simple random stream example for the full code). Each chunk is read sequentially and output to the UI as an array of UTF-8 bytes, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the UI. function fetchStream() { const reader = stream.getReader(); let
charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.
...d reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; } // value for fetch streams is a Uint8Array
charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Received ' +
charsReceived + '
characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Example 2 - handling text line by...
... Living Standard Initial definition. ...
Selection.modify() - Web APIs
xtend the current selection. direction The direction in which to adjust the current selection. You can specify "forward" or "backward" to adjust in the appropriate direction based on the language at the selection point. If you want to adjust in a specific direction, you can specify "left" or "right". granularity The distance to adjust the current selection or cursor position. You can move by "
character", "word", "sentence", "line", "paragraph", "lineboundary", "sentenceboundary", "paragraphboundary", or "documentboundary". Note: Gecko does not implement "sentence", "paragraph", "sentenceboundary", "paragraphboundary", or "documentboundary". WebKit and Blink do. Note: Starting in Gecko 5.0, the "word" granularity no longer includes the following space, regardless of the default platform...
... button below to expand the selection. Watch what happens!</p> <p>Et harum quidem rerum facilis est et expedita distinctio. ...
...ow to expand the selection. Watch what happens!</p> <p>Et harum quidem rerum facilis est et expedita distinctio. ...
Using server-sent events - Web APIs
("EventSource failed:", err); }; Closing event streams By default, if the connection between the client and server closes, the connection is restarted. The connection is terminated with the .close() method. evtSource.close(); Event stream format The event stream is a simple stream of text data which must be encoded using UTF-8. Messages in the event stream are separated by a pair of newline
characters. A colon as the first
character of a line is in essence a comment, and is ignored. Note: The comment line can be used to prevent connections from timing out; a server can send a comment periodically to keep the connection alive. Each message consists of one or more lines of text listing the fields for that message. Each field is represented by the field name, followed by a colon, followed...
...will be dispatched on the browser to the listener for the specified event name; the website source code should use addEventListener() to listen for named events. The onmessage handler is called if no event name is specified for a message. data The data field for the message. When the EventSource receives multiple consecutive lines that begin with data:, it concatenates them, inserting a newline
character between each one. Trailing newlines are removed. id The event ID to set the EventSource object's last event ID value. retry The reconnection time to use when attempting to send the event. This must be an integer, specifying the reconnection time in milliseconds. If a non-integer value is specified, the field is ignored. All other field names are ignored. Note: If a line doesn't contai...
...ing the reconnection time in milliseconds. If a non-integer value is specified, the field is ignored. All other field names are ignored. Note: If a line doesn't contain a colon, the entire line is treated as the field name with an empty value string. Examples Data-only messages In the following example, there are three messages sent. The first is just a comment, since it starts with a colon
character. As mentioned previously, this can be useful as a keep-alive mechanism if messages might not be sent regularly. The second message contains a data field with the value "some text". The third message contains a data field with the value "another message\nwith two lines". Note the newline special
character in the value. : this is a test stream data: some text data: another message data: wi...
Using readable streams - Web APIs
tController.enqueue() is then used to enqueue it into the stream. When the button is pressed, the interval is cancelled, and a function called readStream() is invoked to read the data back out of the stream again. We also close the stream, as we've stopped enqueuing chunks to it. ...
...am() function itself, we lock a reader to the stream using ReadableStream.getReader(), then follow the same kind of pattern we saw earlier -- reading each chunk with read(), checking whether done is true and then ending the process if so, and reading the next chunk and processing it if not, before running the read() method again. function readStream() { const reader = stream.getReader(); let
charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.
...hat resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; }
charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Read ' +
charsReceived + '
characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Closing and cancelling streams We've...
Text - Web APIs
eight="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/
CharacterData" target="_top"><rect x="266" y="1" width="130" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="331" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">
CharacterData</text></a><polyline points="396,25 406,20 406,30 396,25" stroke="#D4DDE4" fill="none"/><line x1="406" y1="25"...
...width="2px" /><text x="473.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Text</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor Text() Returns a Text node with the parameter as its textual content. Properties Inherits properties from its parent,
CharacterData. Text.isElementContentWhitespace Read only Returns a Boolean flag indicating whether or not the text node contains only whitespace. Text.wholeText Read only Returns a DOMString containing the text of all Text nodes logically adjacent to this Node, concatenated in document order. Text.assignedSlot Read only Returns the HTMLSlotElement object associated with the element. ...
...atenated in document order. Text.assignedSlot Read only Returns the HTMLSlotElement object associated with the element. Properties included from Slotable The Text interface includes the following property, defined on the Slotable mixin. Slotable.assignedSlot Read only Returns a HTMLSlotElement representing the <slot> the node is inserted in. Methods Inherits methods from its parent,
CharacterData. Text.replaceWholeText Replaces the text of the current node and all logically adjacent nodes with the specified text. Text.splitText Breaks the node into two nodes at a specified offset. Specifications Specification Status Comment DOMThe definition of 'Text' in that specification. Living Standard Removed the isElementContentWhitespace p...
TextEncoder - Web APIs
lustrate how the polyfill works. ...
... UTF-16 // takes up the equivelent space of 3 UTF-8
characters to encode it properly. However, Array's // have an auto expanding length and 1.5x should be just the right balance for most uses. ...
...; if (point >= 0xD800 && point <= 0xDBFF) { if (i === Len) { resArr[resPos += 1] = 0xef/*0b11101111*/; resArr[resPos += 1] = 0xbf/*0b10111111*/; resArr[resPos += 1] = 0xbd/*0b10111101*/; break; } // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae nextcode = str.
charCodeAt(i); if (nextcode >= 0xDC00 && nextcode <= 0xDFFF) { point = (point - 0xD800) * 0x400 + nextcode - 0xDC00 + 0x10000; i += 1; if (point > 0xffff) { resArr[resPos += 1] = (0x1e/*0b11110*/<<3) | (point>>>18); resArr[resPos += 1] = (0x2/*0b10*/<<6) | ((point>>>12)&0x3f/*0b0...
Using Web Workers - Web APIs
etc): calls a Worker's queryable function * postMessage(string or JSON Data): see Worker.prototype.postMessage() * terminate(): terminates the...
...> elements do for normal scripts. But a <script> element that does not have a src attribute and has a type attribute that does not identify an executable MIME type can be considered a data block element that JavaScript could use. "Data blocks" is a more general feature of HTML5 that can carry almost any textual data. So, a worker could be embedded in this way: <!DOCTYPE html> <html> <head> <meta
charset="UTF-8" /> <title>MDN Example - Embedded worker</title> <script type="text/js-worker"> // This script WON'T be parsed by JS engines because its MIME type is text/js-worker. var myVar = 'Hello World!'; // Rest of your worker code goes here. </script> <script type="text/javascript"> // This script WILL be parsed by JS engines because its MIME type is text/javascript. function pageLog(s...
...at name, or defining a function with that name. var onmessage and function onmessage will define global properties with those names, but they will not register the function to receive messages sent by the web page that created the worker). This starts the recursion, spawning new copies of itself to handle each iteration of the calculation. ...
ARIA Test Cases - Accessibility
ZoomText - - - - Orca - - - - Textbox dojo nightly build Expected AT Behavior: (MZ) When focus first lands on the textbox, its label and role should be indicated. If it also contains content, an indication should be given as for regular textboxes. If the text is automatically selected on focus, this should be indicated. Arrow keys should read by
character or line as usual. (AL) I think we need more here. For example, what about reading the line number if the user requests that info? Markup used: Notes: Results: AT Firefox IE Opera Safari JAWS 9 - - n/a n/a JAWS 10 - - - - VoiceOver (Leopard) n/a n/a - fail Window-Eyes - - - - ...
... aria-live aria-live="off" aria-live="polite" aria-live="assertive" aria-live="rude" aria-live attribute is missing nested live regions: "assertive" inside "off" MS IE8 Chat Example Expected AT Behavior: JAWS - Announces updates to live regions. Markup used: aria-live Notes: Results: AT Firefox IE Opera S...
...plete Expected AT Behavior: Screen reader should announce the fact that this is a control supporting autocomplete. When suggestions appear, if the AT supports it elsewhere in the operating system (e. g. the Run dialog), suggestions should be supported inside the web app as well. Screen magnifiers should indicate AutoCompletes as they do elsewhere in the operating system. Optional: for each
character typed, screen readers may choose to indicate how many options are remaining in the autocomplete list (if that number has changed). Alternatively, screen readers could make a sound when there is only 1 autocomplete option remaining. Markup used: aria-autocomplete Notes: Results: AT Firefox IE Opera Safari JAWS 9 Fail Fail n/a n/a JAW...
Accessibility and Spacial Patterns - Accessibility
ical of the kinds of images that create problems, and stripes have been studied most closely. There's the potential for causing harm if there are more than five light-dark pairs of stripes in any orientation. They can be parallel, radial, curved or straight, and may be formed by rows of repeating elements. In 2005, Arnold Wilkins, John Emmett, and Graham Harding evaluated the guidelines for
characterizing patterned images that could precipitate seizures. They revised the guidelines to their fundamental core, and came up with a surprisingly simple, but powerful test. which they published in the paper,
Characterizing the Patterned Images That Precipitate Seizures and Optimizing Guidelines To Prevent Them The steps necessary to evaluate material reduce to the following: Look at the scre...
...he ability to represent spatial patterns accurate to those who are blind is critical for accessibility. For example, knowing Braille is not enough. The Braille dots have to be spatially apart from one another so as to be readable in a "human" way. The human touch does distinguish with ease braille dots that are too close or too far apart from one another. Space has to surround the braille
character. A user of braille does not simply lay a finger on "top" of a braille
character, the user has to move her finger over the
character, in the way that a sighted person must move her eyes across text written on a page. The nature of space can change depending upon what MIME type is being used, and its version. For example, borders on SVG can extend both inward and outward from its dimensions...
... ...
Perceivable - Accessibility
erted to large print, or represented on a braille display. Non-text content refers to multimedia such as images, audio, and video. Success criteria How to conform to the criteria Practical resource 1.1.1 Provide text equivalents (A) All images that convey meaningful content should be given suitable alternative text. Text alternatives. Complex images or
charts should have an accessible alternative provided, either on the same page or via a link. Use a regular link instead of a longdesc attribute. A text description may work, or an accessible data table (see HTML table advanced features and accessibility). See Other text alternative mechanisms for the argument against longdesc. Multimedia content (i.e., audio or video) should at l...
...) A sensible, logical reading order should be easy to determine for any content, even if it is visually presented in an unusual way. The order should be made obvious by use of correct semantic elements (e.g., headings, paragraphs), with CSS being used to create any unusual layout styles, irrespective of the markup. Again, refer to HTML: A good basis for accessibility. 1.3.3 Sensory
characteristics (A) Instructions for operating controls or understanding content do not rely on a single sense. This may prove inaccessible to people with a disability related to that sense, or a device that does not support that sense. So, for example: "Click the round button to continue" The button should be clearly labelled so that it is obvious that it is the button you ne...
... or no background audio (AAA) Prerecorded audio recordings that primarily feature speech should have minimal background noise, so the content can be easily understood. 1.4.8 Visual presentation (AAA) For text content presentation, the following should be true: Foreground and background colors should be user-selectable. Text blocks should be no wider than 80
characters (or glyphs), for maximum readability. Text should not be fully justified (e.g., text-align: justify;). Line height should be at least 1.5 times the text size within paragraphs (e.g., line-height: 1.5;), and at least 2.25 times the text size between paragraphs (e.g., padding: 2.25rem;). When the text size is doubled, the content should not need to be scrolled. ...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
r of the first line of a block-level element, but only when not preceded by other content (such as images or inline tables). /* Selects the first letter of a <p> */ p::first-letter { font-size: 130%; } The first letter of an element is not always trivial to identify: Punctuation that precedes or immediately follows the first letter is included in the match. Punctuation includes any Unicode
character defined in the open (Ps), close (Pe), initial quote (Pi), final quote (Pf), and other punctuation (Po) classes. Some languages have digraphs that are always capitalized together, like the IJ in Dutch. In these cases, both letters of the digraph should be matched by the ::first-letter pseudo-element. (This is poorly supported by browsers; see the browser compatibility table below.) A combin...
... HTML <p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p> <p>-The beginning of a special punctuation mark.</p> <p>_The beginning of a special punctuation mark.</p> <p>"The beginning of a special punctuation mark.</p> <p>'The beginning of a spec...
...CSS p { width: 500px; line-height: 1.5; } h2 + p::first-letter { color: white; background-color: black; border-radius: 2px; box-shadow: 3px 3px 0 red; font-size: 250%; padding: 6px 3px; margin-right: 6px; float: left; } Result Effect on special punctuation and non-Latin
characters This example illustrates the effect of ::first-letter on special punctuation and non-Latin
characters. HTML <p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p> <p>-The beginning of a special punctuation mark.</p> <p>_The beginning of a special punctuation mark.</p> <p>"The beginning of a special punctuation mark.</p> <p>'The beginning of a special punctuation mark.</p> <p>*The beginning of a special punctuation mark.</p> <p>#The beginning of a s...
@font-feature-values - CSS: Cascading Style Sheets
2 is valid, but ident2: 2 4 isn't. @styleset Specifies a feature name that will work with the styleset() functional notation of font-variant-alternates. A stylset feature value definition allows an unlimited number of values: ident1: 2 4 12 1 maps to the OpenType values ss02, ss04, ss12, and ss01. Note that values higher than 99 are valid, but don't map to any OpenType values and are ignored. @
character-variant Specifies a feature name that will work with the
character-variant() functional notation of font-variant-alternates. A
character-variant feature value definition allows either one or two values: ident1: 3 maps to cv03=1, and ident2: 2 4 maps to cv02=4, but ident2: 2 4 5 is invalid. Formal syntax @font-feature-values <family-name># { <feature-value-block-list> }where <family-nam...
...and ident2: 2 4 maps to cv02=4, but ident2: 2 4 5 is invalid. ...
...led From version 24: this feature is behind the layout.css.font-features.enabled preference (needs to be set to true). ...
Grid template areas - CSS: Cascading Style Sheets
specify anything at all on the individual grid items, everything happens on our grid container. We can see the layout described as the value of the grid-template-areas property. Leaving a grid cell empty We have completely filled our grid with areas in this example, leaving no white space. However you can leave grid cells empty with this method of layout. To leave a cell empty use the full stop
character, '.'. If I want to only display the footer directly under the main content I would need to leave the three cells underneath the sidebar empty. .header { grid-area: hd; } .footer { grid-area: ft; } .content { grid-area: main; } .sidebar { grid-area: sd; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #f...
...d-template-areas: "hd hd hd hd hd hd hd hd hd" "sd sd sd main main main main main main" ". . . ft ft ft ft ft ft"; } <div class="wrapper"> <div class="header">Header</div> <div class="sidebar">Sidebar</div> <div class="content">Content</div> <div class="footer">Footer</div> </div> In order to make the layout neater I can use multiple .
characters. As long as there is no white space between the full stops it will be counted as one cell. For a complex layout there is a benefit to having the rows and columns neatly aligned. It means that you can actually see, right there in the CSS, what this layout looks like. Spanning multiple cells In our example each of the areas spans multiple grid cells and we achieve this by repeating the name...
...} <div class="wrapper"> <div class="header">Header</div> <div class="sidebar">Sidebar</div> <div class="content">Content</div> <div class="footer">Footer</div> </div> The value of grid-template-areas must show a complete grid, otherwise it is invalid (and the property is ignored). This means that you must have the same number of cells for each row, if empty with a full stop
character demonstrating that the cell is to be left empty. You will also create an invalid grid if your areas are not rectangular. Redefining the grid using media queries As our layout is now contained in one part of the CSS, this makes it very easy to make changes at different breakpoints. You can do this by redefining the grid, the position of items on the grid, or both at once. When doing this, ...
Using media queries - CSS: Cascading Style Sheets
Media queries are used for the following: To conditionally apply styles with the CSS @media and @import at-rules. To target specific media for the <style>, <link>, <source>, and other HTML elements with the media= attribute. To test and monitor media states using the Window.matchMedia() and MediaQueryList.addListener() JavaScript methods. ...
...primarily for screens. speech Intended for speech synthesizers. Deprecated media types: CSS2.1 and Media Queries 3 defined several additional media types (tty, tv, projection, handheld, braille, embossed, and aural), but they were deprecated in Media Queries 4 and shouldn't be used. The aural type has been replaced by speech, which is similar. Media features Media features describe specific
characteristics of the user agent, output device, or environment. Media feature expressions test for their presence or value, and are entirely optional. Each media feature expression must be surrounded by parentheses. Name Summary Notes any-hover Does any available input mechanism allow the user to hover over elements? Added in Media Queries Level 4. any-poi...
...ultiple devices. For instance, this @media rule uses two media queries to target both screen and print devices: @media screen, print { ... } See Media types for a list of all media types. Because they describe devices in only very broad terms, just a few are available; to target more specific attributes, use media features instead. Targeting media features Media features describe the 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,...
Syntax - CSS: Cascading Style Sheets
uleset (or rule) is visualized in the diagram below. As an element of the page may be matched by several selectors, and therefore by several rules potentially containing a given property several times, with different values, the CSS standard defines which one has precedence over the other and must be applied: this is called the cascade algorithm. It is important to note that even if a ruleset
characterized by a group of selectors is a kind of shorthand replacing rulesets with a single selector each, this doesn't apply to the validity of the ruleset itself. This leads to an important consequence: if one single basic selector is invalid, like when using an unknown pseudo-element or pseudo-class, the whole selector is invalid and therefore the entire rule is ignored (as invalid too). CSS st...
...e single basic selector is invalid, like when using an unknown pseudo-element or pseudo-class, the whole selector is invalid and therefore the entire rule is ignored (as invalid too). CSS statements Rulesets are the main building blocks of a style sheet, which often consists of only a big list of them. But there is other information that a Web author wants to convey in the style sheet, like the
character set, other external style sheets to import, font face or list counter descriptions and many more. It will use other and specific kinds of statements to do that. A statement is a building block that begins with any non-space
characters and ends at the first closing brace or semi-colon (outside a string, non-escaped and not included into another {}, () or [] pair). There are two kinds of s...
...ctor. At-rules that start with an at sign, '@' (U+0040 COMMERCIAL AT), followed by an identifier and then continuing up to the end of the statement, that is up to the next semi-colon (;) outside of a block, or the end of the next block. Each type of at-rules, defined by the identifier, may have its own internal syntax, and semantics of course. They are used to convey meta-data information (like @
charset or @import), conditional information (like @media or @document), or descriptive information (like @font-face). Any statement which isn't a ruleset or an at-rule is invalid and ignored. There is another group of statements - the nested statements. These are statements that can be used in a specific subset of at-rules - the conditional group rules. These statements only apply if a specific co...
animation - CSS: Cascading Style Sheets
></div> </div> </div> </div> </div> html,body { height: 100%; box-sizing: border-box; } pre { margin-bottom: 0; } svg { width: 1.5em; height: 1.5em; } button { width: 27px; height: 27px; background-size: 16px; background-position: center; background-repeat: no-repeat; border-radius: 3px; cursor: pointer; } button.play { background-image: url('data:image/svg+xml;
charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cstyle%3Epath%20%7Bdisplay%3Anone%7D%20path%3Atarget%7Bdisplay%3Ablock%7D%3C%2Fstyle%3E%3Cpath%20id%3D%22play%22%20d%3D%22M3%2C3%20L3%2C13%20L13%2C8%20Z%22%20%2F%3E%3Cpath%20id%3D%22pause%22%20d%3D%22M5%2C4%20L7%2C4%20L7%2C13%20L5%2C13%20Z%20M9%2C4%20L11%2C4%20L11%2C13%20L9%2C13%20Z%22%20%2F...
...3Cpath%20id%3D%22pause%22%20d%3D%22M5%2C4%20L7%2C4%20L7%2C13%20L5%2C13%20Z%20M9%2C4%20L11%2C4%20L11%2C13%20L9%2C13%20Z%22%20%2F%3E%3Cpath%20id%3D%22restart%22%20d%3D%22M13%2C9%20A5%2C5%2C1%2C1%2C1%2C8%2C4%20L8%2C2%20L12%2C5%20L8%2C8%20L8%2C6%20A3%2C3%2C1%2C1%2C0%2C11%2C9%20A1%2C1%2C1%2C1%2C1%2C13%2C9%20z%22%20%2F%3E%3C%2Fsvg%3E#play'); } button.pause { background-image: url('data:image/svg+xml;
charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cstyle%3Epath%20%7Bdisplay%3Anone%7D%20path%3Atarget%7Bdisplay%3Ablock%7D%3C%2Fstyle%3E%3Cpath%20id%3D%22play%22%20d%3D%22M3%2C3%20L3%2C13%20L13%2C8%20Z%22%20%2F%3E%3Cpath%20id%3D%22pause%22%20d%3D%22M5%2C4%20L7%2C4%20L7%2C13%20L5%2C13%20Z%20M9%2C4%20L11%2C4%20L11%2C13%20L9%2C13%20Z%22%20%2F...
...ath%20id%3D%22pause%22%20d%3D%22M5%2C4%20L7%2C4%20L7%2C13%20L5%2C13%20Z%20M9%2C4%20L11%2C4%20L11%2C13%20L9%2C13%20Z%22%20%2F%3E%3Cpath%20id%3D%22restart%22%20d%3D%22M13%2C9%20A5%2C5%2C1%2C1%2C1%2C8%2C4%20L8%2C2%20L12%2C5%20L8%2C8%20L8%2C6%20A3%2C3%2C1%2C1%2C0%2C11%2C9%20A1%2C1%2C1%2C1%2C1%2C13%2C9%20z%22%20%2F%3E%3C%2Fsvg%3E#pause'); } button.restart { background-image: url('data:image/svg+xml;
charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cstyle%3Epath%20%7Bdisplay%3Anone%7D%20path%3Atarget%7Bdisplay%3Ablock%7D%3C%2Fstyle%3E%3Cpath%20id%3D%22play%22%20d%3D%22M3%2C3%20L3%2C13%20L13%2C8%20Z%22%20%2F%3E%3Cpath%20id%3D%22pause%22%20d%3D%22M5%2C4%20L7%2C4%20L7%2C13%20L5%2C13%20Z%20M9%2C4%20L11%2C4%20L11%2C13%20L9%2C13%20Z%22%20%2F...
font-variant-east-asian - CSS: Cascading Style Sheets
-east-asian: proportional-width; /* <east-asian-width-values> */ font-variant-east-asian: ruby full-width jis83; /* Global values */ font-variant-east-asian: inherit; font-variant-east-asian: initial; font-variant-east-asian: unset; Syntax Values normal This keyword leads to the deactivation of the use of such alternate glyphs. ruby This keyword forces the use of special glyphs for ruby
characters. As these are usually smaller, font creators often designs specific forms, usually slightly bolder to improve the contrast. This keyword corresponds to the OpenType values ruby. <east-asian-variant-values> These values specify a set of logographic glyph variants which should be used for display. Possible values are: Keyword Standard defining the glyphs OpenType equiva...
...It corresponds to the OpenType values fwid. Formal definition Initial valuenormalApplies toall elements. It also a...
...p90 jis04 JIS X 0213:2004 jp04 simplified None, use the simplified Chinese glyphs smpl traditional None, use the traditional Chinese glyphs trad <east-asian-width-values> These values control the sizing of figures used for East Asian
characters. Two values are possible: proportional-width activating the set of East Asian
characters which vary in width. It corresponds to the OpenType values pwid. full-width activating the set of East Asian
characters which are all of the same, roughly square, width metric. It corresponds to the OpenType values fwid. Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typ...
font-variant - CSS: Cascading Style Sheets
, <discretionary-lig-values>, <historical-lig-values>, <contextual-alt-values> Specifies the keywords related to the font-variant-ligatures longhand property. The possible values are: common-ligatures, no-common-ligatures, discretionary-ligatures, no-discretionary-ligatures, historical-ligatures, no-historical-ligatures, contextual, and no-contextual. stylistic(), historical-forms, styleset(),
character-variant(), swash(), ornaments(), annotation() Specifies the keywords and functions related to the font-variant-alternates longhand property. small-caps, all-small-caps, petite-caps, all-petite-caps, unicase, titling-caps Specifies the keywords and functions related to the font-variant-caps longhand property. <numeric-figure-values>, <numeric-spacing-values>, <numeric-fraction-values>, or...
...rmal definition Initial valuenormalApplies toall elements. ...
...: this feature is behind the layout.css.font-features.enabled preference (needs to be set to true). ...
hyphens - CSS: Cascading Style Sheets
licitly defined by the specification, so the exact hyphenation may vary from browser to browser. Syntax /* Keyword values */ hyphens: none; hyphens: manual; hyphens: auto; /* Global values */ hyphens: inherit; hyphens: initial; hyphens: unset; The hyphens property is specified as a single keyword value chosen from the list below. Values none Words are not broken at line breaks, even if
characters inside the words suggest line break points. Lines will only wrap at whitespace. manual Words are broken for line-wrapping only where
characters inside the word suggest line break opportunities. See Suggesting line break opportunities below for details. auto The browser is free to automatically break words at appropriate hyphenation points, following whatever rules it chooses. However, s...
...ak opportunities below) will override automatic break point selection when present. Note: The auto setting's behavior depends on the language being properly tagged to select the appropriate hyphenation rules. You must specify a language using the lang HTML attribute to guarantee that automatic hyphenation is applied in that language. ...
...avior depends on the language being properly tagged to select the appropriate hyphenation rules. You must specify a language using the lang HTML attribute to guarantee that automatic hyphenation is applied in that language. Suggesting line break opportunities There are two Unicode
characters used to manually specify potential line break points within text: U+2010 (HYPHEN) The "hard" hyphen
character indicates a visible line break opportunity. Even if the line is not actually broken at that point, the hyphen is still rendered. U+00AD (SHY) An invisible, "soft" hyphen. This
character is not rendered visibly; instead, it marks a place where the browser should break the word if hyphenation is necessary. In HTML, use ­ to insert a soft hyphen. When the HTML <wbr> element leads to a ...
ident - CSS: Cascading Style Sheets
The <ident> CSS data type denotes an arbitrary string used as an identifier. Syntax The syntax of <custom-ident> is similar to CSS identifiers (such as property names), except that it is case-sensitive. It consists of one or more
characters, where
characters can be any of the following: any alphabetical
character (A to Z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped
character (preceded by a backslash, \), a Unicode
character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its Unicode code point) Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. On the other hand, as there are several ways to escape a
character, toto\? and toto\3F are the same identifiers. Exa...
...icode
character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its Unicode code point) Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. On the other hand, as there are several ways to escape a
character, toto\? and toto\3F are the same identifiers. Examples Valid identifiers nono79 A mix of alphanumeric
characters and numbers ground-level A mix of alphanumeric
characters and a dash -test A dash followed by alphanumeric
characters --toto A custom-property like identifier _internal An underscore followed by alphanumeric
characters \22 toto A Unicode
character followed by a sequence of alphanumeric
characters bili\.bob A correctly escaped period Invalid identifiers 34rem It ...
...'bilibob' This would be a <string>. "bilibob" This would be a <string>. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<ident>' in that specification. ...
tab-size - CSS: Cascading Style Sheets
The tab-size CSS property is used to customize the width of tab
characters (U+0009). Syntax /* <integer> values */ tab-size: 4; tab-size: 0; /* <length> values */ tab-size: 10px; tab-size: 2em; /* Global values */ tab-size: inherit; tab-size: initial; tab-size: unset; Values <integer> A multiple of the advance width of the space
character (U+0020) to be used as the width of tabs. Must be nonnegative. <length> The width of tabs. Must be nonnegative. ...
...es <integer> A multiple of the advance width of the space
character (U+0020) to be used as the width of tabs. Must be nonnegative. <length> The width of tabs. Must be nonnegative. Formal definition Initial value8Applies toblock containersInheritedyesComputed valuethe specified integer or an absolute lengthAnimation typea length Formal syntax <integer> | <length> Examples Expanding by
character count pre { tab-size: 4; /* Set tab size to 4
characters wide */ } Collapse tabs pre { tab-size: 0; /* Remove indentation */ } Comparing to the default size This example compares a default tab size with a custom tab size. Note that white-space is set to pre to prevent the tabs from collapsing. ...
...ength> Examples Expanding by
character count pre { tab-size: 4; /* Set tab size to 4
characters wide */ } Collapse tabs pre { tab-size: 0; /* Remove indentation */ } Comparing to the default size This example compares a default tab size with a custom tab size. Note that white-space is set to pre to prevent the tabs from collapsing. HTML <p>no tab</p> <p>	default tab size of 8
characters wide</p> <p class="custom">	custom tab size of 3
characters wide</p> <p> 3 spaces, equivalent to the custom tab size</p> CSS p { white-space: pre; } .custom { tab-size: 3; -moz-tab-size: 3; } Result Specifications Specification Status Comment CSS Text Module Level 3The definition of 'tab-size' in that specification. Workin...
text-emphasis - CSS: Cascading Style Sheets
It is a shorthand for text-emphasis-style and text-emphasis-color. 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. The text-emphasis property is quite different from text-decoration. The text-decoration property does not inherit, and the decoration specified is applied across the whole element. However, text-emphasis does inherit, which means it is possible to change emphasis marks for descendents. ...
...U+25CE). triangle Display triangles as marks. The filled triangle is '?' (U+25B2), and the open triangle is '?' (U+25B3). sesame Display sesames as marks. The filled sesame is '?' (U+FE45), and the open sesame is '?' (U+FE46). This is the default shape in vertical writing modes when no other shape is given. <string> Display the given string as marks. Authors should not specify more than one
character in <string>. The UA may truncate or ignore strings consisting of more than one grapheme cluster. <color> Defines the color of the mark. If no color is present, it defaults to currentcolor. Formal definition Initial valueas each of the properties of the shorthand:text-emphasis-style: nonetext-emphasis-color: currentcolorApplies toall elementsInheritednoComputed valueas each of the proper...
... CSS h2 { text-emphasis: triangle #D55; } HTML <h2>This is important!</h2> Result Specifications Specification Status Comment CSS Text Decoration Module Level 3The definition of 'text-emphasis' in that specification. Candidate Recommendation Initial definition ...
Getting Started - Developer guides
This article guides you through the AJAX basics and gives you some simple hands-on examples to get you started. What's AJAX? AJAX stands for Asynchronous JavaScript And XML. In a nutshell, it is the use of the XMLHttpRequest object to communicate with servers. It can send and receive information in various formats, including JSON, XML, HTML, and text files. AJAX's most appealing
characteristic is its "asynchronous" nature, which means it can communicate with the server, exchange data, and update the page without having to refresh the page. The two major features of AJAX allow you to do the following: Make requests to the server without reloading the page Receive and work with data from the server Step 1 - How to make an HTTP request In order to make an HTTP request to the server wit...
...($array); For more on DOM methods, be sure to check out Document Object Model (DOM). Simple timed XHR example Another simple example follows -- here we are loading a text file via XHR, the structure of which is assumed to be like this: TIME: 312.05 TIME: 312.07 TIME: 312.10 TIME: 312.12 TIME: 312.14 TIME: 312.15 Once the text file is loaded, we split() the items into an array at each newline
character (\n -- basically where each line break is in the text file), and then print the complete list of timestamps, and the last timestamp, onto the page. This is repeated every 5 seconds, using a setInterval() call. The idea would be that a server-side script of some kind would continually update the text file with new timestamps, and our XHR code would be used to report the latest timestamp on t...
... file), and then print the complete list of timestamps, and the last timestamp, onto the page. This is repeated every 5 seconds, using a setInterval() call. The idea would be that a server-side script of some kind would continually update the text file with new timestamps, and our XHR code would be used to report the latest timestamp on the client-side. ...
Index - Developer guides
HTML5, Media, Video, Web Audio API, WebGL, developer recommendation The ability to read the pixel values from each frame of a video can be very useful. 17 Event developer guide DOM, Event, Guide, NeedsUpdate, events Events refers both to a design pattern used for the asynchronous handling of various incidents which occur in the lifetime of a web page and to the naming,
characterization, and use of a large number of incidents of different types. 18 Creating and triggering events Advanced, DOM, Guide, JavaScript, NeedsContent, events This article demonstrates how to create and dispatch DOM events. Such events are commonly called synthetic events, as opposed to the events fired by the browser itself. 19 DOM onevent handlers Beginner,...
...logy stack. 29 Index Guide, Index Found 31 pages: 30 Introduction to Web development Beginner, CSS, CodingScripting, Development, HTML, JavaScript, Web Whether you're just getting started with Web development, or are just expanding your horizons into new realms of Web awesomeness, the links here should help you get started. 31 Localizations and
character encodings
Character encodings, HTML, Localization, NeedsMarkupWork Browsers process text as Unicode internally. However, a way of representing
characters in terms of bytes (
character encoding) is used for transferring text over the network to the browser. The HTML specification recommends the use of the UTF-8 encoding (which can represent all of Unicode) and regardless of the encod...
...i.mozilla.org will be moved here, updated and expanded. 40 The Unicode Bidirectional Text Algorithm Algorithm, BiDi, Guide, Internationalization, Introduction, Localization, Text, Unicode, direction, i18n, l10n, ltr, rtl The Unicode(R) Bidirectional Algorithm (also known as the BiDi Algorithm) is part of the Unicode text standard that describes how the user agent should order
characters while rendering Unicode text. 41 The Web Open Font Format (WOFF) Fonts, NeedsMobileBrowserCompatibility, WOFF WOFF (the Web Open Font Format) is a web font format developed by Mozilla in concert with Type Supply, LettError, and other organizations. It adds metadata and private-use data structures, including predefined fields allowing foundries and vendors to provide lic...
Developer guides
GL or Web Audio API to modify audio and video directly, for example adding reverb/compression effects to audio, or grayscale/sepia filters to video. This article provides a reference to explain what you need to do. Events developer guide Events refer to two things: a design pattern used for the asynchronous handling of various incidents which occur in the lifetime of a web page; and the naming,
characterization, and use of a large number of incidents of different types. AJAX AJAX is a term that defines a group of technologies allowing web applications to make quick, incremental updates to the user interface without reloading the entire browser page. This makes the application faster and more responsive to user actions. Graphics on the web Modern web sites and applications often need to p...
...reloading the entire browser page. This makes the application faster and more responsive to user actions. Graphics on the web Modern web sites and applications often need to present graphics of varying sophistication. Guide to web APIs A list of all web APIs and what they do. JavaScript JavaScript is the powerful scripting language used to create applications for the Web. Localizations and
character encodings Browsers process text as Unicode internally. However, a way of representing
characters in terms of bytes (
character encoding) is used for transferring text over the network to the browser. The HTML specification recommends the use of the UTF-8 encoding (which can represent all of Unicode), and regardless of the encoding used requires Web content to declare that encoding. Mobile w...
...lizing XML The web platform provides different methods of parsing and serializing XML, each with its pros and cons. The Web Open Font Format (WOFF) WOFF (Web Open Font Format) is a font file format that is free for anyone to use on the web. Unicode Bidirectional Text Algorithm (BiDi) The Unicode(R) BiDi algorithm is part of the Unicode text standard. It describes how the browser should order
characters while rendering Unicode text. This guide covers the algorithm in general and how it applies to content you create--especially when you build properly localized and internationalized content. Using FormData objects The FormData object lets you compile a set of key/value pairs to send using XMLHttpRequest. It's primarily intended for sending form data, but can be used independently from for...
HTML attribute: pattern - HTML: Hypertext Markup Language
" type="tel" pattern="[0-9]{4}" placeholder="####" aria-label="4-digit number" size="3"/> </label> </p> Here we have 3 sections for a north American phone number with an implicit label encompassing all three components of the phone number, expecting 3-digits, 3-digits and 4-digits respectively, as defined by the pattern attribute set on each. If the values are too long or too short, or contain
characters that aren't digits, the patternMismatch will be true. When true, the element matches the :invalid CSS pseudo-classes. input:invalid { border: red solid 3px; } Had we used minlength and maxlength attributes instead, we may have seen validityState.tooLong or validityState.tooShort being true. Specifying a pattern You can use the pattern attribute to specify a regular expression that ...
...we may have seen validityState.tooLong or validityState.tooShort being true. Specifying a pattern You can use the pattern attribute to specify a regular expression that the inputted value must match in order to be considered valid (see Validating against a regular expression for a simple crash course on using regular expressions to validate inputs). ...
...ate inputs). The example below restricts the value to 4-8
characters and requires that it contain only lower-case letters. ...
<col> - HTML: Hypertext Markup Language
able does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. bgcolor The background color of the table. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. One of the predefined color kewords can also be used. To achieve a similar effect, use the CSS background-color property.
char This attribute is used to set the
character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values. If align is not set to
char, this attribute is ignored.
charoff This attribute is used to indicate the number of
characters to offset the column data from the alignment
characters specified by the
char attribute. v...
... bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. ...
... bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. ...
<form> - HTML: Hypertext Markup Language
otherwise no corresponding role Permitted ARIA roles search, none or presentation DOM interface HTMLFormElement Attributes This element includes the global attributes. accept Comma-separated content types the server accepts. This attribute was removed in HTML5 and should not be used. Instead, use the accept attribute on <input type=file> elements. ...
...ng role Permitted ARIA roles search, none or presentation DOM interface HTMLFormElement Attributes This element includes the global attributes. accept Comma-separated content types the server accepts. This attribute was removed in HTML5 and should not be used. Instead, use the accept attribute on <input type=file> elements. accept-
charset Space-separated
character encodings the server accepts. The browser uses them in the order in which they are listed. The default value means the same encoding as the page. (In previous versions of HTML,
character encodings could also be delimited by commas.) autocapitalize A nonstandard attribute used by iOS Safari that controls how textual form elements should be automatically capitalized. autocapitalize attrib...
...ed by commas.) autocapitalize A nonstandard attribute used by iOS Safari that controls how textual form elements should be automatically capitalized. autocapitalize attributes on a form elements override it on <form>. Possible values: none: No automatic capitalization. sentences (default): Capitalize the first letter of each sentence. words: Capitalize the first letter of each word.
characters: Capitalize all
characters -- that is, uppercase. autocomplete Indicates whether input elements can by default have their values automatically completed by the browser. autocomplete attributes on form elements override it on <form>. Possible values: off: The browser may not automatically complete entries. (Browsers tend to ignore this for suspected login forms; see The autocomplet...
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
ontent. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts flow content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLPreElement Attributes This element only includes the global attributes. cols Contains the preferred count of
characters that a line should have. It was a non-standard synonym of width. To achieve such an effect, use CSS width instead. width Contains the preferred count of
characters that a line should have. Though technically still implemented, this attribute has no visual effect; to achieve such an effect, use CSS width instead. wrap Is a hint indicating how the overflow must happen. In modern brows...
...t Accessibility concerns It is important to provide an alternate description for any images or diagrams created using preformatted text. The alternate description should clearly and concisely describe the image or diagram's content. People experiencing low vision conditions and browsing with the aid of assistive technology such as a screen reader may not understand what the preformatted text
characters are representing when they are read out in sequence. A combination of the <figure> and <figcaption> elements, supplemented by a combination of an id and the ARIA role and aria-labelledby attributes allow the preformatted text to be announced as an image, with the figcaption serving as the image's alternate description. Example <figure role="img" aria-labelledby="cow-caption"> <pre> _...
...="img" aria-labelledby="cow-caption"> <pre> ___________________________ < I'm an expert in my field. > --------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || </pre> <figcaption id="cow-caption"> A cow saying, "I'm an expert in my field." The cow is illustrated using preformatted text
characters. </figcaption> </figure> MDN Understanding WCAG, Guideline 1.1 explanations H86: Providing text alternatives for ASCII art, emoticons, and leetspeak | W3C Techniques for WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of '<pre>' in that specification. Living Standard No significant change from HTML5 ...
<script>: The Script element - HTML: Hypertext Markup Language
he HTML5 specification urges authors to omit the attribute rather than provide a redundant MIME type. In earlier browsers, this identified the scripting language of the embedded or imported (via the src attribute) code. JavaScript MIME types are listed in the specification. module: Causes the code to be treated as a JavaScript module. The processing of the script contents is not affected by the
charset and defer attributes. For information on using module, see our JavaScript modules guide. Unlike classic scripts, module scripts require the use of the CORS protocol for cross-origin fetching. Any other value: The embedded content is treated as a data block which won't be processed by the browser. Developers must use a valid MIME type that is not a JavaScript MIME type to denote data blocks. ...
... JavaScript modules guide. Unlike classic scripts, module scripts require the use of the CORS protocol for cross-origin fetching. Any other value: The embedded content is treated as a data block which won't be processed by the browser. Developers must use a valid MIME type that is not a JavaScript MIME type to denote data blocks. The src attribute will be ignored. Deprecated attributes
charset If present, its value must be an ASCII case-insensitive match for "utf-8". It's unnecessary to specify the
charset attribute, because documents must use UTF-8, and the script element inherits its
character encoding from the document. language Like the type attribute, this attribute identifies the scripting language in use. Unlike the type attribute, however, this attribute's possible va...
... Recommendation HTML 4.01 SpecificationThe definition of '<script>' in that specification. Recommendation ...
itemprop - HTML: Hypertext Markup Language
period or a colon (see below). If the item is a typed item it must be either: A defined property name, or A valid URL, which refers to the vocabulary definition, or A valid URL that is used as a proprietary item property name (i.e. ...
...e below). If the item is a typed item it must be either: A defined property name, or A valid URL, which refers to the vocabulary definition, or A valid URL that is used as a proprietary item property name (i.e. ...
...RL that is used as a proprietary item property name (i.e. one not defined in a public specification), or If the item is not a typed item it must be: A string that contains no "." (U+002E FULL STOP)
characters and no ":"
characters (U+003A COLON) and is used as a proprietary item property name (again, one not defined in a public specification). Note: the rules above disallow ":"
characters in non-URL values because otherwise they could not be distinguished from URLs. Values with "."
characters are reserved for future extensions. Space
characters are disallowed because otherwise the values would be parsed as multiple tokens. Values The property value of a name-value pair is as given for the first matching case in the following list: If the element has an itemscope attribu...
Global attributes - HTML: Hypertext Markup Language
, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onsort, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting. List of global attributes accesskey Provides a hint for generating a keyboard shortcut for the current element. This attribute consists of a space-separated list of
characters. The browser should use the first one that exists on the computer keyboard layout. autocapitalize Controls whether and how text input is automatically capitalized as it is entered/edited by the user. It can have the following values: off or none, no autocapitalization is applied (all letters default to lowercase) on or sentences, the first letter of each sentence defaults to a capit...
...capitalized as it is entered/edited by the user. It can have the following values: off or none, no autocapitalization is applied (all letters default to lowercase) on or sentences, the first letter of each sentence defaults to a capital letter; all other letters default to lowercase words, the first letter of each word defaults to a capital letter; all other letters default to lowercase
characters, all letters should default to uppercase class A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method Document.getElementsByClassName(). contenteditable An enumerated attribute indicating if the element should be editable by the user. If so, the browser modifi...
...nality of the element's text. It can have the following values: ltr, which means left to right and is to be used for languages that are written from the left to the right (like English); rtl, which means right to left and is to be used for languages that are written from the right to the left (like Arabic); auto, which lets the user agent decide. It uses a basic algorithm as it parses the
characters inside the element until it finds a
character with a strong directionality, then it applies that directionality to the whole element. draggable An enumerated attribute indicating whether the element can be dragged, using the Drag and Drop API. It can have the following values: true, which indicates that the element may be dragged false, which indicates that the element may not b...
MIME types (IANA media types) - HTTP
ubtype might be plain (plain text), html (HTML source code), or calendar (for iCalendar/.ics) files. Each type has its own set of possible subtypes, and a MIME type always has both a type and a subtype, never just one or the other. An optional parameter can be added to provide additional details: type/subtype;parameter=value For example, for any MIME type whose main type is text, the optional
charset parameter can be used to specify the
character set used for the
characters in the data. If no
charset is specified, the default is ASCII (US-ASCII) unless overridden by the user agent's settings. To specify a UTF-8 text file, the MIME type text/plain;
charset=UTF-8 is used. MIME types are case-insensitive but are traditionally written in lowercase, with the exception of parameter values, whose...
...ext/javascript1.1 text/javascript1.2 text/javascript1.3 text/javascript1.4 text/javascript1.5 text/jscript text/livescript text/x-ecmascript text/x-javascript Note: Even though any given user agent may support any or all of these, you should only use text/javascript. It's the only MIME type guaranteed to work now and into the future. Some content you find may have a
charset parameter at the end of the text/javascript media type, to specify the
character set used to represent the code's content. This is not valid, and in most cases will result in a script not being loaded. Image types Files whose MIME type is image contain image data. The subtype specifies which specific image file format the data represents. Only a few image types are used commonly enough to be...
...es a boundary to separate the pieces. Each piece has a Content-Type header with its actual type and a Content-Range of the range it represents. HTTP/1.1 206 Partial Content Accept-Ranges: bytes Content-Type: multipart/byteranges; boundary=3d6b6a416f9b5 Content-Length: 385 --3d6b6a416f9b5 Content-Type: text/html Content-Range: bytes 100-200/1270 eta http-equiv="Content-type" content="text/html;
charset=utf-8" /> <meta name="vieport" content --3d6b6a416f9b5 Content-Type: text/html Content-Range: bytes 300-400/1270 -color: #f0f0f2; margin: 0; padding: 0; font-family: "Open Sans", "Helvetica --3d6b6a416f9b5-- Importance of setting the correct MIME type Most web servers send unrecognized resources as the application/octet-stream MIME type. For security reasons, mos...
Content negotiation - HTTP
URL. These headers describe the preferred choice of the user. The server uses them as hints and an internal algorithm chooses the best content to serve to the client. The algorithm is server-specific and not defined in the standard. See, for example, the Apache negotiation algorithm. The HTTP/1.1 standard defines list of the standard headers that start server-driven negotiation (Accept, Accept-
Charset, Accept-Encoding, Accept-Language). Though strictly speaking User-Agent is not in this list, it is sometimes also used to send a specific representation of the requested resource, though this is not considered as a good practice. The server uses the Vary header to indicate which headers it actually used for content negotiation (or more precisely the associated response headers), so that caches...
...given by rounding to the nearest power of 2 and dividing that number by 1024. For example, 512 megabytes will be reported as 0.5. DPR Indicates the client's device pixel ratio. Viewport-Width Indicates the layout viewport width in CSS pixels. Width Indicates the resource width in physical pixels (in other words the intrinsic size of an image). The Accept-
Charset header The Accept-
Charset header indicates to the server what kinds of
character encodings are understood by the user-agent. Traditionally, it was set to a different value for each locale for the browser, like ISO-8859-1,utf-8;q=0.7,*;q=0.7 for a Western European locale. With UTF-8 now being well-supported, being the preferred way of encoding
characters, and to guarantee better privacy throu...
...what kinds of
character encodings are understood by the user-agent. Traditionally, it was set to a different value for each locale for the browser, like ISO-8859-1,utf-8;q=0.7,*;q=0.7 for a Western European locale. With UTF-8 now being well-supported, being the preferred way of encoding
characters, and to guarantee better privacy through less configuration-based entropy, browsers omit the Accept-
Charset header: Internet Explorer 8, Safari 5, Opera 11, Firefox 10 and Chrome 27 have abandoned this header. The Accept-CH-Lifetime header This is part of an experimental technology called Client Hints and is only available in Chrome 61 or later. The Accept-CH-Lifetime header is used with the Device-Memory value of the Accept-CH header and indicates the amount of time the device should opt-in to...
A typical HTTP session - HTTP
ng the client information about the data sent (e.g. type, data size, compression algorithm used, hints about caching). Similarly to the block of HTTP headers for a client request, these HTTP headers form a block ending with an empty line. The final block is a data block, which contains the optional data. ...
...: keep-alive Cache-Control: s-maxage=300, public, max-age=0 Content-Language: en-US Date: Thu, 06 Dec 2018 17:37:18 GMT ETag: "2e77ad1dc6ab0b53a2996dfd4653c1c3" Server: meinheld/0.6.1 Strict-Transport-Security: max-age=63072000 X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Vary: Accept-Encoding,Cookie Age: 7 <!DOCTYPE html> <html lang="en"> <head> <meta
charset="utf-8"> <title>A simple webpage</title> </head> <body> <h1>Simple HTML5 webpage</h1> <p>Hello, world!</p> </body> </html> Notification that the requested resource has permanently moved: HTTP/1.1 301 Moved Permanently Server: Apache/2.4.37 (Red Hat) Content-Type: text/html;
charset=utf-8 Date: Thu, 06 Dec 2018 17:33:08 GMT Location: https://developer.mozilla.org/ (this is the new link...
...5, max=98 Accept-Ranges: bytes Via: Moz-Cache-zlb05 Connection: Keep-Alive Content-Length: 325 (the content contains a default page to display if the user-agent is not able to follow the link) <!DOCTYPE html... ...
Groups and ranges - JavaScript
Groups and ranges indicate groups and ranges of expression
characters. 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]. ...
...a-d]. They match the "b" in "brisket", and the "c" in "chop". For example, [abcd-] and [-abcd] 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...
... (x) Capturing group: Matches x and remembers the match. For example, /(foo)/ matches and remembers "foo" in "foo bar". A regular expression may have multiple capturing groups. ...
URIError: malformed URI sequence - JavaScript
The JavaScript exception "malformed URI sequence" occurs when URI encoding or decoding wasn't successful. Message URIError: The URI to be encoded contains invalid
character (Edge) URIError: malformed URI sequence (Firefox) URIError: URI malformed (Chrome) Error type URIError What went wrong? URI encoding or decoding wasn't successful. An argument given to either the decodeURI, encodeURI, encodeURIComponent, or decodeURIComponent function was not valid, so that the function was unable encode or decode properly. Examples Encoding Encoding replaces each instance of certain
characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the
character. An URIError will be thrown if there is an attempt to encode a surrogate which is not part of a high-low pair,...
...l be thrown if there is an attempt to encode a surrogate which is not part of a high-low pair, for example: encodeURI('\uD800'); // "URIError: malformed URI sequence" encodeURI('\uDFFF'); // "URIError: malformed URI sequence" A high-low pair is ok. ...
...gate which is not part of a high-low pair, for example: encodeURI('\uD800'); // "URIError: malformed URI sequence" encodeURI('\uDFFF'); // "URIError: malformed URI sequence" A high-low pair is ok. ...
Array - JavaScript
ototype has methods to perform traversal and mutation operations. Neither the length of a JavaScript array nor the types of its elements are fixed. Since an array's length can change at any time, and data can be stored at non-contiguous locations in the array, JavaScript arrays are not guaranteed to be dense; this depends on how the programmer chooses to use them. In general, these are convenient
characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays. Arrays cannot use strings as element indexes (as in an associative array) but must use integers. Setting or accessing via non-integers using bracket notation (or dot notation) will not set or retrieve an element from the array list itself, but will set or access a variable associat...
...roperties that begin with a digit cannot be referenced with dot notation and must be accessed using bracket notation. For example, if you had an object with a property named 3d, it can only be referenced using bracket notation. let years = [1950, 1960, 1970, 1980, 1990, 2000, 2010] console.log(years.0) // a syntax error console.log(years[0]) // works properly renderer.3d.setTexture(model, '
character.png') // a syntax error renderer['3d'].setTexture(model, '
character.png') // works properly In the 3d example, '3d' had to be quoted (because it begins with a digit). But it's also possible to quote the array indexes as well (e.g., years['2'] instead of years[2]), although it's not necessary. The 2 in years[2] is coerced into a string by the JavaScript engine through an implicit toSt...
....exec('cdbBdbsbz') The properties and elements returned from this match are as follows: Property/Element Description Example input Read only The original string against which the regular expression was matched. "cdbBdbsbz" index Read only The zero-based index of the match in the string. 1 [0] Read only The last matched
characters. "dbBd" [1], ...[n] Read only Elements that specify the parenthesized substring matches (if included) in the regular expression. The number of possible parenthesized substrings is unlimited. [1]: "bB" [2]: "d" Constructor Array() Creates a new Array object. Static properties get Array[@@species] The constructor function is used to create derived o...
JSON.parse() - JavaScript
if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode
characters with escape sequences. JavaScript handles many
characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); rx_dangerous.lastIndex = 0; if (rx_dangerous.test(text)) { text = text.replace(rx_dangerous, function(a) { return ( "\\u" + ("0000" ...
...We are especially concerned with "()" and "new" // because they can cause invocation, and "=" because it can cause mutation. ...
...nd "new" // because they can cause invocation, and "=" because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with "@" (a non-JSON
character). Second, we // replace all simple value tokens with "]"
characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining
characters are only whitespace or "]" or // "," or ":" or "{" or "}". If that is so, then the text is safe for eval. if ( rx_one.test( ...
RegExp.prototype.dotAll - JavaScript
a read-only property of an individual regular expression instance. Property attributes of RegExp.prototype.dotAll Writable no Enumerable no Configurable yes Description The value of dotAll is a Boolean and true if the "s" flag was used; otherwise, false. ...
... Property attributes of RegExp.prototype.dotAll Writable no Enumerable no Configurable yes Description The value of dotAll is a Boolean and true if the "s" flag was used; otherwise, false. The "s" flag indicates that the dot special
character (".") should additionally match the following line terminator ("newline")
characters in a string, which it would not match otherwise: U+000A LINE FEED (LF) ("\n") U+000D CARRIAGE RETURN (CR) ("\r") U+2028 LINE SEPARATOR U+2029 PARAGRAPH SEPARATOR This effectively means the dot will match any
character on the Unicode Basic Multilingual Plane (BMP). To allow it to match astral
characters, the "u" (unicode) flag should be used. Using both flags in conjunction allows th...
... You cannot change this property directly. ...
String.prototype.codePointAt() - JavaScript
rce 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 str.codePointAt(pos) Parameters pos Position of an element in str to return the code point value from. Return value A number representing the code point value of the
character at the given pos. If there is no element at pos, returns undefined. Description If there is no element at the specified position, undefined is returned. If no UTF-16 surrogate pair begins at pos, the code unit at pos is returned. Polyfill The following extends Strings to include the codePointAt() function as specified in ECMAScript 2015 for browsers without native support. /*! https://...
...or(); } var string = String(this); var size = string.length; // `ToInteger` var index = position ? ...
...t-of-bounds indices: if (index < 0 || index >= size) { return undefined; } // Get the first code unit var first = string.
charCodeAt(index); var second; if ( // check if it's the start of a surrogate pair first >= 0xD800 && first <= 0xDBFF && // high surrogate size > index + 1 // there is a next code unit ) { second = string.
charCodeAt(index + 1); if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; } } return first; }; if (defineProperty) { defineProperty(String.prototype, 'codePointAt', { 'value': codePointAt, ...
String.prototype.split() - JavaScript
to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax str.split([separator[, limit]]) Parameters separator Optional The pattern describing where each split should occur. The separator can be a simple string or it can be a regular expression. The simplest case is when separator is just a single
character; this is used to split a delimited string. For example, a string containing tab separated values (TSV) could be parsed by passing a tab
character as the separator, like this: myString.split("\t"). If separator contains multiple
characters, that entire
character sequence must be found in order to split. If separator is omitted or does not occur in str, the returned array contains one ele...
...ccur in str, the returned array contains one element consisting of the entire string. If separator appears at the beginning (or end) of the string, it still has the effect of splitting. The result is an empty (i.e. zero length) string, which appears at the first (or last) position of the returned array. If separator is an empty string (""), str is converted to an array of each of its UTF-16 "
characters". Warning: When the empty string ("") is used as a separator, the string is not split by user-perceived
characters (grapheme clusters) or unicode
characters (codepoints), but by UTF-16 codeunits. This destroys surrogate pairs. See "How do you get a string to a
character array in JavaScript?" on StackOverflow. limit Optional A non-negative integer limiting the number of pieces.
... to include parts of the separator in the result If separator is a regular expression that contains capturing parentheses (), matched results are included in the array. const myString = 'Hello 1 word. Sentence number 2.' const splits = myString.split(/(\d)/) console.log(splits) This script displays the following: [ "Hello ", "1", " word. Sentence number ", "2", "." ] Note: \d matches the
character class for digits between 0 and 9. Reversing a String using split() This is not a robust way to reverse a string: const str = 'asdfghjkl' const strReverse = str.split('').reverse().join('') // 'lkjhgfdsa' // split() returns an array on which reverse() and join() can be applied It doesn't work if the string contains grapheme clusters, even when using a unicode-aware split. (Use, for ex...
String.prototype.substr() - JavaScript
The substr() method returns a portion of the string, starting at the specified index and extending for a given number of
characters afterwards. 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 str.substr(start[, length]) Parameters start The index of the first
character to include in the returned substring. length Optional. The number of
characters to extract. Return value A new string containing the specified part of the given string. Description substr() extracts length
characters from a str, counting from the start index. If start is a positive number, the index starts counting at the start ...
...tart is a positive number, the index starts counting at the start of the string. Its value is capped at str.length. If start is a negative number, the index starts counting from the end of the string. Its value is capped at -str.length. Note: In Microsoft JScript, negative values of the start argument are not considered to refer to the end of the string. If length is omitted, substr() extracts
characters to the end of the string. If length is undefined, substr() extracts
characters to the end of the string. If length is a negative number, it is treated as 0. For both start and length, NaN is treated as 0. Polyfill Microsoft's JScript does not support negative values for the start index. To use this feature in JScript, you can use the following code: // only run when the substr() func...
...h, NaN is treated as 0. Polyfill Microsoft's JScript does not support negative values for the start index. ...
Authoring MathML - MathML
head> <body> ... <div class="LaTeX"> \documentclass[12pt]{article} \begin{document} \title{LaTeXML Example} \maketitle \begin{abstract} This is a sample LaTeXML document. \end{abstract} \section{First Section} $$ \sum_{n=1}^{+\infty} \frac{1}{n^2} = \frac{\pi^2}{6} $$ \end{document} </div> ... jqMath is another script to parse a simple LaTeX-like syntax but which also accepts non-ASCII
characters like ?{??{n=1}?{+?} 6/n^2} = ? to write ? n = 1 + ? 6 n 2 = ? . The installation is similar: download and copy the relevant Javascript and CSS files on your Web site and reference them in your page header (see the COPY-ME.html file from the zip archive for an example). One of the advantage of jqMath over the previous scripts is that it will automatically add some simple C...
...th" for the source but MathML is also generated when the document is saved. To get the MathML code, save the document as mml and open it with any text editor. Alternatively, you can extract the odf file (which is actually a zip archive) and open an xml file called content.xml. Amaya is the W3C's web editor, which is able to handle MathML inside XHTML documents. ...
...l file called content.xml. Amaya is the W3C's web editor, which is able to handle MathML inside XHTML documents. Use the Elements and the Special
Chars panels to create various advanced mathematical constructs. Simple text such as a+2 is automatically parsed and the appropriate MathML markup is generated. Once you are done, you can directly save your XHTML page and open it in Mozilla. Optical
Character & Handwriting Recognition Inftyreader is able to perform some Optical
Character Recognition, including translation of mathematical equations into MathML. Other tools can do handwriting recognition such as the Windows Math Input Panel or the online converter Web Equation. Original Document Information Author(s): Frederic Wang Other Contributors: Florian Scholz Copyright Information: P...
id - SVG: Scalable Vector Graphics
stroke: #000066; fill: #00cc00; } ]]> </style> <rect id="smallRect" x="10" y="10" width="100" height="100" /> </svg> Usage notes Value <id> Default value None Animatable No <id> Specifies the element's ID. ...
... Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'id' in that specification. ...
...ed as an SVG view specification (e.g., MyDrawing.svg#svgView(viewBox(0,200,1000,1000))) or a basic media fragment when used as a URL target fragment. It must be valid in XML documents. A stand-alone SVG document uses XML 1.0 syntax, which specifies that valid IDs only include designated
characters (letters, digits, and a few punctuation marks), and do not start with a digit, a full stop (.)
character, or a hyphen-minus (-)
character. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'id' in that specification. Candidate Recommendation Defines the allowed values in more detail. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'id' in that specification. Recommendation Init...
method - SVG: Scalable Vector Graphics
tribute indicates the method by which text should be rendered along the path of a <textPath> element. Only one element is using this attribute: <textPath> textPath For <textPath>, method indicates the method by which text should be rendered along the path. ...
... of a <textPath> element. Only one element is using this attribute: <textPath> textPath For <textPath>, method indicates the method by which text should be rendered along the path. Value align | stretch Default value align Animatable Yes align This value indicates that the
characters should be rendered so that they are not stretched or warped. The
characters are rotated, scaled and stretched when they are rendered. ...
...method indicates the method by which text should be rendered along the path. Value align | stretch Default value align Animatable Yes align This value indicates that the
characters should be rendered so that they are not stretched or warped. The
characters are rotated, scaled and stretched when they are rendered. As a result, for fonts with connected
characters (e.g. cursive fonts), the connections may not align properly when text is rendered along the path. stretch This value indicates that the
character outlines will be converted into paths, and then stretched and possibly warped. With this approach, connected
characters, such as in cursive fonts, will maintain their connections. Specifications Specification Status Comment ...
text-anchor - SVG: Scalable Vector Graphics
bute is applied to each individual text chunk within a given <text> element. Each text chunk has an initial current text position, which represents the point in the user coordinate system resulting from (depending on context) application of the x and y attributes on the <text> element, any x or y attribute values on a <tspan>, <tref> or <altGlyph> element assigned explicitly to the first rendered
character in a text chunk, or determination of the initial current text position for a <textPath> element. Note: As a presentation attribute, text-anchor can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg vi...
...For an element with a direction property value of ltr (typical for most European languages), the left side of the text is rendered at the initial text position. For an element with a direction property value of rtl (typical for Arabic and Hebrew), the right side of the text is rendered at the initial...
... the left side of the text is rendered at the initial text position. For an element with a direction property value of rtl (typical for Arabic and Hebrew), the right side of the text is rendered at the initial text position. For an element with a vertical primary text direction (often typical for Asian text), the top side of the text is rendered at the initial text position. middle The rendered
characters are aligned such that the middle of the text string is at the current text position. (For text on a path, conceptually the text string is first laid out in a straight line. The midpoint between the start of the text string and the end of the text string is determined. Then, the text string is mapped onto the path with this midpoint placed at the current text position.) end The rendered ch...
unicode - SVG: Scalable Vector Graphics
The unicode attribute specifies one or more Unicode
characters indicating the sequence of Unicode
characters which corresponds to a glyph. If a
character is provided, then this glyph corresponds to the given Unicode
character. If multiple
characters are provided, then this glyph corresponds to the given sequence of Unicode
characters. One use of a sequence of
characters is ligatures. For example, if unicode="ffl", then the given glyph will be used to render the sequence of
characters "f", "f", and "l". It is often useful to refer to
characters using XML
character references expressed in hexadecimal notation or decimal notation. ...
...to the given sequence of Unicode
characters. One use of a sequence of
characters is ligatures. For example, if unicode="ffl", then the given glyph will be used to render the sequence of
characters "f", "f", and "l". It is often useful to refer to
characters using XML
character references expressed in hexadecimal notation or decimal notation. For example, unicode="ffl" could be expressed as XML
character references in hexadecimal notation as unicode="ffl" or in decimal notation as unicode="ffl". The unicode attribute contributes to the process for deciding which glyph(s) are used to represent which
character(s). If the attribute is not provided for a given <glyph>, then the only way to use this glyph is via an <altGlyph> reference. Only one element is using ...
...eciding which glyph(s) are used to represent which
character(s). If the attribute is not provided for a given <glyph>, then the only way to use this glyph is via an <altGlyph> reference. Only one element is using this attribute: <glyph> Context notes Value <string> Default value None Animatable No <string> This value specifies one or more Unicode
characters corresponding to a glyph. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'unicode' in that specification. Recommendation Initial definition ...
<altGlyph> - SVG: Scalable Vector Graphics
Value type: <list-of-coordinates> ; Default value: Absolute x-coordinate of ancestor <text> or <tspan>; Animatable: yes y This attribute defines the corresponding absolute y-coordinates for rendering the element. ...
... Value type: <list-of-coordinates> ; Default value: Absolute x-coordinate of ancestor <text> or <tspan>; Animatable: yes y This attribute defines the corresponding absolute y-coordinates for rendering the element. ...
...e given font. Value type: <string> ; Default value: none; Animatable: no format The format of the given font. Value type: <string> ; Default value: none; Animatable: no xlink:href An <iri> reference either to a <glyph> element in an SVG document or to an <altGlyphDef> element. If the reference is to a <glyph> element and that glyph is available, then that glyph is rendered instead of the
character(s) that are inside of the <altGlyph> element. If the reference is to an <altGlyphDef> element, then if an appropriate set of alternate glyphs is located from processing the <altGlyphDef> element, then those alternate glyphs are rendered instead of the
character(s) that are inside of the <altGlyph> element. Value type: <iri> ; Default value: none; Animatable: no Global attributes Cor...
<tref> - SVG: Scalable Vector Graphics
Usage context CategoriesText content element, Text content child elementPermitted contentAny number of the following elements, in any order:Descriptive elements<animate>, <animateColor>, <set> Attributes Global attributes Conditional processing attributes Core attributes Graphical event attributes Presentation attributes Xlink attributes class style externalResourcesRequired Specific attributes xlink:href DOM Interface This element implements the SVGTRefElement interface. ...
...resentation attributes Xlink attributes class style externalResourcesRequired Specific attributes xlink:href DOM Interface This element implements the SVGTRefElement interface. ...
...ic attributes xlink:href DOM Interface This element implements the SVGTRefElement interface. ...
Texts - SVG: Scalable Vector Graphics
<style><![CDATA[ text{ dominant-baseline: hanging; font: 28px Verdana, Helvetica, Arial, sans-serif; } ]]></style> </svg> The tspan element has the following custom attributes: x Set a new absolute x coordinate for the containing text. This overwrites the default current text position. ...
...Set a new absolute x coordinate for the containing text. This overwrites the default current text position. The attribute may also contain a list of numbers, that are one by one applied to the single
characters of the tspan element. dx Start drawing the text with a horizontal offset dx from the default current position. Here, too, you may provide a list of values that are applied to consecutive
characters, hence piling up the offset over time. Likewise, there are y and dy for vertical displacement. rotate Rotate all
characters by this degree. A list of numbers makes each
character rotate to its respective value, with remaining
characters rotating according to the last value. textLength This is a more obscure attribute giving the calculated length of the string. It is meant to allow th...
...th remaining
characters rotating according to the last value. textLength This is a more obscure attribute giving the calculated length of the string. It is meant to allow the rendering engine to fine-tune the positions of the glyphs when its own measured text length doesn't meet the one provided here. textPath This element fetches via its xlink:href attribute an arbitrary path and aligns the
characters, that it encircles, along this path: <path id="my_path" d="M 20,20 C 80,60 100,40 120,20" fill="transparent" /> <text> <textPath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#my_path"> A curve. </textPath> </text> Playable code 2 <svg width="200" height="100" xmlns="http://www.w3.org/2000/svg"> <path id="my_path" d="M 20,20 C 80,60 100,40 120,20" fill="transparent" /> ...
Index - XPath
QName of the first node in a given node-set. 38 namespace-uri XSLT, XSLT_Reference The namespace-uri function returns a string representing the namespace URI of the first node in a given node-set. 39 normalize-space XSLT, XSLT_Reference The normalize-space function strips leading and trailing white-space from a string, replaces sequences of whitespace
characters by a single space, and returns the resulting string. 40 not XSLT, XSLT_Reference The not function evaluates a boolean expression and returns the opposite value. 41 number XSLT, XSLT_Reference The number function converts an object to a number and returns the number. 42 position XSLT, XSLT_Reference The position function re...
...44 starts-with XSLT, XSLT_Reference The starts-with checks whether the first string starts with the second string and returns true or false. 45 string XSLT, XSLT_Reference The string function converts the given argument to a string. 46 string-length XSLT, XSLT_Reference The string-length function returns a number equal to the number of
characters in a given string. 47 substring XSLT, XSLT_Reference The substring function returns a part of a given string. 48 substring-after XSLT, XSLT_Reference The substring-after function returns a string that is the rest of a given string after a given substring. 49 substring-before XSLT, XSLT_Reference The substring-before function...
... XSLT, XSLT_Reference The sum function returns a number that is the sum of the numeric values of each node in a given node-set. 51 system-property XSLT, XSLT_Reference The system-property function returns an object representing the given system-property. 52 translate XSLT, XSLT_Reference The translate function evaluates a string and a set of
characters to translate and returns the translated string. 53 true XSLT, XSLT_Reference The true function returns a boolean value of true. 54 unparsed-entity-url XSLT, XSLT_Reference The unparsed-entity-url() function returns the URI of the unparsed entity with the given name. This is non-XML data referenced in the DTD of the source document. 55 ...
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The <xsl:decimal-format> element defines the
characters and symbols that are to be used in converting numbers into strings using theformat-number( ) function. Syntax <xsl:decimal-format name=NAME decimal-separator=
CHARACTER grouping-separator=
CHARACTER infinity=STRING minus-sign=
CHARACTER NaN=STRING percent=
CHARACTER per-mille=
CHARATER zero-digit=
CHARACTER digit=
CHARACTER pattern-separator=
CHARACTER /> Required Attributes None. Optional Attributes name Specifies a name for this format. decimal-separator Specifies the decimal point
character. The default is (.). grouping-separator Specifies the thousands separator
character. The default is (,). infinity Specifies t...
...ired Attributes None. Optional Attributes name Specifies a name for this format. decimal-separator Specifies the decimal point
character. The default is (.). grouping-separator Specifies the thousands separator
character. The default is (,). infinity Specifies the string used to represent infinity. The default is the string "Infinity". minus-sign Specifies the minus sign
character. The default is the hyphen (-). NaN Specifies the string used when the value is not a number. The default is the string "NaN". percent Specifies the percentage sign
character. The default is (%). ...
... infinity Specifies the string used to represent infinity. The default is the string "Infinity". minus-sign Specifies the minus sign
character. The default is the hyphen (-). NaN Specifies the string used when the value is not a number. The default is the string "NaN". percent Specifies the percentage sign
character. The default is (%). per-mille Specifies the per thousand
character. The default is (?). zero-digit Specifies the digit zero
character. The default is (0). digit Specifies the
character used in the format pattern to stand for a digit. The default is (#). pattern-separator Specifies the
character separating positive and negative subpatterns in a format pattern. The default is the semi-colon (;). Type Top-level, must be the child of <xsl:styl...
Index - XSLT: Extensible Stylesheet Language Transformations
28 <xsl:copy> Element, Reference, XSLT, copy The <xsl:copy> element transfers a shallow copy (the node and any associated namespace node) of the current node to the output document. It does not copy any children or attributes of the current node. 29 <xsl:decimal-format> Element, Reference, XSLT, decimal-format The <xsl:decimal-format> element defines the
characters and symbols that are to be used in converting numbers into strings using theformat-number( ) function. 30 <xsl:element> Element, Reference, XSLT The <xsl:element> element creates an element in the output document. 31 <xsl:fallback> Element, Reference, XSLT, fallback The <xsl:fallback> element specifies what template to use if a given extension (or, ...
...y format a number. 40 <xsl:otherwise> Element, Reference, XSLT, otherwise The <xsl:otherwise> element is used to define the action that should be taken when none of the <xsl:when> conditions apply. It is similar to the else or default case in other programing languages. 41 <xsl:output> Element, Reference, XSLT, output The <xsl:output> element controls the
characteristics of the output document. To function correctly in Netscape, this element, with the method attribute, must be used. As of 7.0, method="text" works as expected. 42 <xsl:param> Element, Reference, XSLT, param The <xsl:param> element establishes a parameter by name and, optionally, a default value for that parameter. When used as a top-level element, the parameter is gl...
...mplate> element, the parameter is local to that template. In this case it must be the first child element of the template. 43 <xsl:preserve-space> Element, Reference, XSLT, preserve-space The <xsl:preserve-space> element defines the elements in the source document for which whitespace should be preserved. If there is more than one element, separate the names with a whitespace
character. Preserving whitespace is the default setting, so this element only needs to be used to counteract an <xsl:strip-space> element. 44 <xsl:processing-instruction> Element, Reference, XSLT, processing-instruction The <xsl:processing-instruction> element writes a processing instruction to the output document. 45 <xsl:sort> Element, Reference, XSLT, sort ...
Compiling a New C/C++ Module to WebAssembly - WebAssembly
both below. Creating HTML and JavaScript This is the simplest case we'll look at, whereby you get emscripten to generate everything you need to run your code, as WebAssembly, in the browser. First we need an example to compile. Take a copy of the following simple C example, and save it in a file called hello.c in a new directory on your local drive: #include <stdio.h> int main(int argc,
char ** argv) { printf("Hello World\n"); } Now, using the terminal window you used to enter the Emscripten compiler environment, navigate to the same directory as your hello.c file, and run the following command: emcc hello.c -s WASM=1 -o hello.html The options we've passed in with the command are as follows: -s WASM=1 -- Specifies that we want wasm output. If we don't specify this, Em...
...aring on the web page, and your browser's JavaScript console. Congratulations, you've just compiled C to WebAssembly and run it in your browser! Using a custom HTML template Sometimes you will want to use a custom HTML template. Let's look at how we can do this. First of all, save the following C code in a file called hello2.c, in a new directory: #include <stdio.h> int main(int argc,
char ** argv) { printf("Hello World\n"); } Search for the file shell_minimal.html in your emsdk repo. Copy it into a sub-directory called html_template inside your previous new directory. Now navigate into your new directory (again, in your Emscripten compiler environment terminal window), and run the following command: emcc -o hello2.html hello2.c -O3 -s WASM=1 --shell-file html_te...
... EMSCRIPTEN_KEEPALIVE declaration (which adds your functions to the exported functions list (see Why do functions in my C/C++ source code vanish when I compile to JavaScript, and/or I get No functions to process?)). Let's look at how this works. To start with, save the following code as hello3.c in a new directory: #include <stdio.h> #include <emscripten/emscripten.h> int main(int argc,
char ** argv) { printf("Hello World\n"); } #ifdef __cplusplus extern "C" { #endif void EMSCRIPTEN_KEEPALIVE myFunction(int argc,
char ** argv) { printf("MyFunction Called\n"); } #ifdef __cplusplus } #endif By default, Emscripten-generated code always just calls the main() function, and other functions are eliminated as dead code. Putting EMSCRIPTEN_KEEPALIVE before a function name stops ...
querystring - Archive of obsolete content
Utility functions for working with query strings. Globals Functions stringify(fields, separator, assignment) Serializes an object containing name:value pairs into a query string: querystring.stringify({ foo: 'bar', baz: 4 }); // => 'foo=bar&baz=4' By default '&' and'=' are used as separator and assignment
characters, but you can override this using additional optional parameters: querystring.stringify({ foo: 'bar', baz: 4 }, ';', ':'); // => 'foo:bar;baz:4' Parameters fields : object The data to convert to a query string. separator : string The string to use as a separator between each name:value pair. By default this is "&". assignment : string The string to use between each name and its corresponding value. By default this is "=". Returns string : The query string. parse...
...The string to use between each name and its corresponding value. By default this is "=". Returns string : The query string. parse(querystring, separator, assignment) Parse a query string into an object containing name:value pairs: querystring.parse('foo=bar&baz=bla') // => { foo: 'bar', baz: 'bla' } Optionally separator and assignment arguments may be passed to override default '&' and '='
characters: querystring.parse('foo:bar|baz:bla', '|', ':') // => { foo: 'bar', baz: 'bla' } Parameters querystring : string The query string. separator : string The string to use as a separator between each name:value pair. By default this is "&". assignment : string The string to use between each name and its corresponding value. By default this is "=". Returns object : An object containi...
request - Archive of obsolete content
ontent to send to the server. This explicitly sets the Content-Type header. The default value is application/x-www-form-urlencoded. overrideMimeType string Use this string to override the MIME type returned by the server in the response's Content-Type header. You can use this to treat the content as a different MIME type, or to force text to be interpreted using a specific
character. For example, if you're retrieving text content which was encoded as ISO-8859-1 (Latin 1), it will be given a content type of "utf-8" and certain
characters will not display correctly. To force the response to be interpreted as Latin-1, use overrideMimeType: var Request = require("sdk/request").Request; var quijote = Request({ url: "http://www.latin1files.org/quijote.txt", over...
... you're retrieving text content which was encoded as ISO-8859-1 (Latin 1), it will be given a content type of "utf-8" and certain
characters will not display correctly. To force the response to be interpreted as Latin-1, use overrideMimeType: var Request = require("sdk/request").Request; var quijote = Request({ url: "http://www.latin1files.org/quijote.txt", overrideMimeType: "text/plain;
charset=latin1", onComplete: function (response) { console.log(response.text); } }); quijote.get(); anonymous boolean If true, the request will be sent without cookies or authentication headers. This option sets the mozAnon property in the underlying XMLHttpRequest object. Defaults to false. Request The Request object is used to make GET, HEAD, POST, PUT, or DELETE ...
dev/panel - Archive of obsolete content
However, it can receive messages from the add-on that created it, and the add-on can p...
...o we've also provided a library called volcan.js which gives you a JavaScript API to the remote debugging protocol. Note that at the moment volcan.js does not support the complete remote debugging protocol. We're still working on documenting exactly which messages are supported by volcan.js. ...
ui/button/action - Archive of obsolete content
disabled boolean Determines whether the button is disabled. Disabled buttons appear disabled in the UI, and do not respond to clicks. Defaults to false. onClick function Click handler for the button. badge Number or String New in Firefox 36. Badge to attach to the button. The badge can contain as many
characters (or digits) as you like, but only the first four will be displayed. badgeColor CSS <color> value New in Firefox 36. Color for the badge. If badgeColor is omitted and badge is specified, then the badge is red. ActionButton Methods click() Click the button. This will cause the button to generate the click event: var { ActionButton } = requ...
...erties id The button's unique ID. This is read-only. label The button's label. icon The button's icon or icons, as a URL, relative path, or object containing a set of key-value pairs. disabled Boolean property indicating whether or not the button is disabled. badge New in Firefox 36. Value to attach to the button as a badge. May be a number or a string. The badge can contain as many
characters (or digits) as you like, but only the first four will be displayed. badgeColor New in Firefox 36. Color for the badge, specified as a CSS <color> value. Events click This event is emitted when a user clicks the button or your add-on calls the button's click() method. Arguments state : The button's state. This contains all the button's properties. ...
ui/button/toggle - Archive of obsolete content
on is disabled. Disabled buttons appear disabled in the UI, and do not respond to clicks. Defaults to false. onChange function Change handler for the button. onClick function Click handler for the button. badge Number or String New in Firefox 36. Badge to attach to the button. The badge can contain as many
characters (or digits) as you like, but only the first four will be displayed. badgeColor CSS <color> value New in Firefox 36. Color for the badge. If badgeColor is omitted and badge is specified, then the badge is red. ToggleButton Methods click() Click the button. This will cause the button to generate the click event: var { ToggleButton } = requ...
...y indicating whether or not the button is checked. It's initialized to false, or the value of the checked option to the button's constructor. It is then flipped, on a per-window basis, whenever the user clicks the button or when the button's click() method is called. badge New in Firefox 36. Value to attach to the button as a badge. May be a number or a string. The badge can contain as many
characters (or digits) as you like, but only the first four will be displayed. badgeColor New in Firefox 36. Color for the badge, specified as a CSS <color> value. Events click This event is emitted when a user clicks the button or your add-on calls the button's click() method. Arguments state : The button's state. This includes all the button's properties. change This event is emitted whe...
Bookmarks - Archive of obsolete content
The documentation for the new API is available at Places. The Places bookmar...
...The documentation for the new API is available at Places. The Places bookmarks service, provi...
Miscellaneous - Archive of obsolete content
.getSelection().toString(); or: content.getSelection(); // |window| object is implied; i.e., window.content.getSelection() or: getBrowserSelection(); // |window| object is implied; i.e., window.getBrowserSelection() This final option massages the selection to remove leading and trailing whitespace. It also collapses consecutive whitespaces into a single whitespace, and returns at most 150
characters, making it ideal to display text in context menus. It is defined at //github.com/RealityRipple/Pale-Moon/blob/master/palemoon/base/content/browser.js#L5113. Note that it returns the empty string (""), not false, when nothing is selected. getBrowserSelection() is not implemented on some platforms, such as Thunderbird and Songbird. See also http://mxr.mozilla.org/seamonkey/source/browser/bas...
...tion always returns 0. And if you read it directly, you always got nothing. And here's how it's done postdata.QueryInterface(Ci.nsISeekableStream).seek(Ci.nsISeekableStream.NS_SEEK_SET, 0); var stream = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIBinaryInputStream); stream.setInputStream(postdata); var postBytes = stream.readByteArray(stream.available()); var poststr = String.from
CharCode.apply(null, postBytes); //Do anything to your poststr alert(poststr); Getting a string from the input stream is made somewhat simpler in Firefox 4, by the addition of NetUtil.readInputStreamToString() Getting postData of a request before the request is sent The above code will get the postdata for a page that has already loaded. To see what the postdata looks like before the request is e...
Appendix D: Loading Scripts - Archive of obsolete content
velopers. Simplicity: The simple, declarative nature of these tags make them easy to find and understand at a glance. Speed: Script tags may or may not be loaded from pre-compiled bytecode in the fastload cache (Gecko 1.x) or startup cache (Gecko 2), which means they don't necessarily need to read as source and compiled with each restart. Flexibility: Script tags provide a means to specify the
character set and JavaScript version of the scripts to be loaded, which many other methods do not. Debuggable: development tools support debugging JavaScript loaded by script tags Disadvantages Scoping: Scripts loaded via script tags share the global scope with all other scripts loaded into the same window. These tags provide no means to load scripts into a private or otherwise specific scope. ...
...ndows with the same effect as injecting script tags into their documents. Advantages Namespacing: Global namespace contamination and the resultant extension compatibility issues can often be avoided by loading sub-scripts into private namespaces. Flexibility: The sub-script loader can load scripts into a variety of different namespaces for a wide variety of uses, and as of Gecko 2 allows the
character set of the script to be specified. Performance: As of Gecko 8.0, scripts loaded via mozIJSSubScriptLoader.loadSubScript() are loaded from a cache. Unlike modules, however, scripts are still executed each time they are loaded and therefore still suffer performance and memory disadvantages over that method. When loading into a Sandbox object, the same advantages apply as above. Disadvantag...
XPCOM Objects - Archive of obsolete content
with some exceptions. In general, you can rely on JavaScript's ability to transform values to the correct type, but it's usually best to pass the right type in the first place. This section is a quick guide on how to read XPCOM documentation, which basically amounts to understanding the syntax of XPIDL, the language used to specify XPCOM interfaces. At MDC, you'll see stuff like this: void set
CharPref(in string aPrefName, in string aValue); One of the most important details to notice is that both paratemers have the in keyword. This specifies that these are input parameters, values that the method will use to perform its actions. When is a parameter not an in parameter? In some methods the out keyword is used for parameters that are return values in reality. This is done for certain val...
...bserver. this._prefService.addObserver( "extensions.xulschoolhello.somePref", this, false); }, observe : function(aSubject, aTopic, aData) { // do stuff here. } }; Finally, here's a table summarizing the types you will most likely encounter in XPCOM interfaces, and how to handle them: JS type IDL types Notes Strings AUTF8String, string, wstring,
char*, others Historically there have been several string types in XPCOM. The currently favored type for most cases is AUTF8String. You can read more about it in the XPCOM String Guide. Integers short, unsigned short, long, unsigned long, PRInt32, PRUInt32 PRInt32 is the equivalent to long. Most PR* types have an easier to read equivalent, so it is better to use those. Float...
Underscores in class and ID Names - Archive of obsolete content
Note: Browser support for underscores in CSS has greatly improved since this article was originally published in 2001 and the following recommendation is no longer accurate for most circumstances. Summary: The use of the underscore
character in CSS can lead to major display problems in multiple browsers. Learn why this is so, and how to keep your sites from being bitten by this problem. This technical note examines the use of underscores in CSS, and why they should be generally avoided in most circumstances. It is a fairly common practice in many programming languages to use the underscore
character (_) in the place of a "space" in variable and function names. For example, a function whose job is to "get the length of a string" might be called get_string_length, and a variable repr...
...ata, permits underscores and escaped underscores. Opera 3.x through 5.x does not recognize underscores or escaped underscores, and so acts the same as Navigator 4.x in this regard. Recommendation Because support is so inconsistent between current browsers as well as older releases, authors are strongly advised to avoid using underscores in class and ID names. A common substitute is the hyphen
character (-), as in: p.urgent-note {color: maroon;} Many authors choose instead to use Camel Case names such as this: p.urgentNote {color: maroon;} If the initial-cap approach is used, however, remember that class and ID names are also supposed to be case-sensitive. See the tech note "Case Sensitivity in class and id Names" for more details. Original Document Information Author(s): Eric A. M...
levelchange - Archive of obsolete content
cification Battery Interface Event Bubbles No Cancelable No Target BatteryManager Default Action None Properties The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method. Property Type Description BatteryManager.level double (float) The system's battery
charging level scaled from 0 to 1.0. Returns 0 if the battery is empty and the system is about to suspend. Returns 1.0 if the battery is full, if the implementation is unable to report the battery's level, or if there is no battery attached to the system. Read only. Example navigator.getBattery().then(function(battery) { console.log("Battery level: " + battery.level * 100 + " %"); batter...
...he implementation is unable to report the battery's level, or if there is no battery attached to the system. Read only. Example navigator.getBattery().then(function(battery) { console.log("Battery level: " + battery.level * 100 + " %"); battery.addEventListener('levelchange', function() { console.log("Battery level: " + battery.level * 100 + " %"); }); }); Related events
chargingchange
chargingtimechange dis
chargingtimechange ...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
location: "JS frame :: file:////usr/lib/thunderbird-3.0b2/defaults/autoconfig/prefcalls.js :: getLDAPAttributes :: line 174" data: no] bug 295329 had been re-opened . AutoConfig Option and LDAP Support in Thunderbird 1.5.x Fortunately, AutoConfig is now part of Thunderbird default packages. MOZ_LDAP_XPCOM=1 and MOZ_EXTENSIONS_DEFAULT="wallet spellcheck xmlextras pref webservices universal
charset auth" are now present in the default configure script. See bug 295329 for details. Add the AutoConfig Option for Old Thunderbird 1.0.x By default, AutoConfig did not make part of the binaries distribution of Thunderbird (1.0.x). It was apparently supposed to increase the load of the binary for a feature not used by lots of individuals. However for enterprise deployment, it is vital! So we ne...
...sion Compiler flags gcc gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.fc3) -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -pthread -pipe c++ gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.fc3) -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -fshort-w
char -pthread -pipe -I/usr/X11R6/include Configure arguments --disable-mailnews --enable-extensions=cookie,xml-rpc,xmlextras,pref,transformiix,universal
chardet,webservices,inspector,gnomevfs,negotiateauth --enable-crypto --disable-composer --enable-single-profile --disable-profilesharing --with-system-jpeg --with-system-zlib --with-system-png --with-pthreads --disable-tests --disable-jsd --disable-in...
Installing Dehydra - Archive of obsolete content
. To enable static checking of a Mozilla build, see Building with static checking. ...
...f the plugin and the location of the analysis script: g++ -quiet -fplugin=$HOME/dehydra/gcc_dehydra.so -fplugin-arg-gcc_dehydra-script=$DEHYDRA_SCRIPT \ -fshort-w
char $CPPFILE -S -o /dev/null For example, in the tests directory created by the installation procedure, I can run a Dehydra script 'a.js' on a Mozilla file like this: g++ -quiet -fplugin=../gcc_dehydra.so \ -fplugin-arg=a.js -fshort-w
char -fpreprocessed \ /home/dmandelin/builds/dehydra-gcc/browser/app/nsBrowserApp.ii -o /dev/null The -fshort-w
char is required for running against Firefox, but not necessarily for other codebases. To generate preprocessed Mozilla source files (*.ii), see the Pork Install Instructions. See Also Dehydra_Manual Treehydra Build Instructions ...
Layout System Overview - Archive of obsolete content
both a full-blown WYSIWYG HTML editor, and a single and multi-line text entry control. In both cases, the content is manipulated by the user (via the DOM) and the resulting visual impacts must be shown as quickly as possible, without disconcerting flicker or other artifacts that might bother the user. Consider a text entry field: the user types text into a form on the web. As the user types a new
character it is inserted into the content model. This causes layout to be notified that a new piece of content has been entered, which causes Layout to create a new frame and format it. This must happen very fast, so the user's typing is not delayed. In the case of the WYSIWYG HTML editor, the user expects that the modifications they make to the document will appear immediately, not seconds later. Thi...
...has been entered, which causes Layout to create a new frame and format it. This must happen very fast, so the user's typing is not delayed. In the case of the WYSIWYG HTML editor, the user expects that the modifications they make to the document will appear immediately, not seconds later. This is especially critical when the user is typing into the document: it would be quite unusable if typing a
character at the end of a document in the HTML editor caused the entire document to be reformatted - it would be too slow, at least on low-end machines. Thus the HTML editor and text controls put considerable performance requirements on the layout system's handling of dynamic content manipulation. The Fundamentals of Frames: Block and Line There are many types of frames that are designed to model vari...
JavaScript OS.Shared - Archive of obsolete content
Module OS.Shared contains tools to interact with the operating system (and, more generally, in C) in JavaScript. All these tools are designed to be used with js-ctypes. For the moment, module OS.Shared is accessible only from chrome workers. ...
... Module OS.Shared contains tools to interact with the operating system (and, more generally, in C) in JavaScript. All these tools are designed to be used with js-ctypes. For the moment, module OS.Shared is accessible only from chrome workers. ...
NSC_SetPIN - Archive of obsolete content
ulOldLen [Input] .; pNewPin [Input] .; ulNewLen [Input] . Description NSC_SetPIN modifies the PIN of user that is currently logged in. ...
...ulOldLen [Input] .; pNewPin [Input] .; ulNewLen [Input] . Description NSC_SetPIN modifies the PIN of user that is currently logged in. ...
LIR - Archive of obsolete content
it extend live range of a quad 11 lived void extend live range of a double 12 file void source filename for debug symbols 13 line void source line number for debug symbols 14 comment void a comment shown, on its own line, in LIR dumps 15 not in use Load 16 not in use 17 ldc2i integer load
char and sign-extend to an int 18 lds2i integer load short and sign-extend to an int 19 lduc2ui integer load unsigned
char and zero-extend to an unsigned int 20 ldus2ui integer load unsigned short and zero-extend to an unsigned int 21 ldi integer load int 22 ldq quad 64 bit load quad 23 ldd double load double 24 ld...
... integer load unsigned
char and zero-extend to an unsigned int 20 ldus2ui integer load unsigned short and zero-extend to an unsigned int 21 ldi integer load int 22 ldq quad 64 bit load quad 23 ldd double load double 24 ldf2d double load float and extend to a double Store 25 sti2c void store int truncated to
char 26 sti2s void store int truncated to short 27 sti void store int 28 stq void 64 bit store quad 29 std void store double 30 std2f void store double as a float (losing precision) 31 not in use Call 32 not in use 33 callv void call subroutine that returns void 34 calli inte...
Venkman - Archive of obsolete content
Written by Svend Tofte to the JavaScript programmers who are not familiar with other debugging tools. Venkman FAQ Answers to common questions on Venkman. Venkman Internals Notes on Venkman source code. Venkman Development Page Older news and releases. View All... Brief History In 1998, John Bandhauer was in
charge of creating the Netscape 4.x JavaScript debugger. In order to keep things modular, he began by creating a mid-level JavaScript debugging API known as js/jsd. This API augments the existing JavaScript API, providing clients with a useful set of debugger functionality implemented in C. Bandhauer then went on to reflect that API into Java, and create his cross platform front end, eventually produ...
...ventually producing Netscape JavaScript Debugger 1.0 and 1.1. In April of 2001, Robert Ginda began work on a JavaScript debugger for Mozilla, called Venkman. Venkman builds on the js/jsd portion of John's 1998 work, exposing it as an XPCOM component. This allows the user interface be written in JavaScript and XUL, which allows Venkman to be fully cross-platform. Venkman is named after the
character Dr. Peter Venkman, played by Bill Murray in the movies Ghostbusters and Ghostbusters II. Getting Venkman Firefox and Thunderbird The latest version of JavaScript Debugger is available from Firefox Add-ons. Mozilla Suite and SeaMonkey These releases come with Venkman pre-installed. On Windows, it is an install option; choose Adv...
Example Sticky Notes - Archive of obsolete content
notes.html All parts are made and commented by VK [schools_ring@yahoo.com]. All rights are given to the world. View this example <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd"> <html> <head> <title>XBL Demo : Sticky Notes</title> <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1"> <style type="text/css"> body { background-color: #FFFFFF; color: #000000; font: 1em Verdana, sans-serif; } h1 { font-size: 1.5em; } /* Binding: */ .sticker { -moz-binding: url(notes.xml#default); } </style> </head> <body> <h1><a href="http://developer.mozilla.org/en/docs/XBL:XBL_1.0_Reference">XBL</a> Demo : Sticky Notes</h1> <div class="sticker"><p>ACME, Inc. fax - respond today.</p></div> <div class="sticker"><p>Don't forget ...
...ize: 1.5em; } /* Binding: */ .sticker { -moz-binding: url(notes.xml#default); } </style> </head> <body> <h1><a href="http://developer.mozilla.org/en/docs/XBL:XBL_1.0_Reference">XBL</a> Demo : Sticky Notes</h1> <div class="sticker"><p>ACME, Inc. ...
XPJS Components Proposal - Archive of obsolete content
. XJS Components will 'live' in.js files. Just as with native component modules each of these .js files will be expected to have the functions: NSRegisterSelf NSGetFactory NSUnregisterSelf (optional) NSCanUnload (optional) Each .js file might implement one or more components. We will have one native module - called the XPJSManager - which holds this system together. The XPJSManager is in
charge of loading these .js files, helping them register themselves, and acting as an intermediary between the xpcom component manager and the JS code. XJS Components are not run in browser windows. Each .js file (let's call it a module) is started up and run in the context of a relatively 'raw' JS global object. The standard (non-DOM) JS classes will be available. The xpconnectComponents object will...
...object. The component manager (and anyone else with a reference to that factory) can then call the factory's CreateInstance method at will. The JS module is free to implement factories and components and services that the factories construct on command. Any code anywhere and implemented in any language can get to these things via the component and service managers. The XPJSManager is loosely in
charge of the lifetime of each XPJS module. JavaScript is garbage collected and one can not force an object to be deleted or the compiled code to be unloaded [except by deleting the JSRuntime; i.e. erasing the entire JS universe]. In C if a module gets unloaded when there are still references to objects created by the module then a crash is likely to happen soon after. JS does not have this problem. I...
List of commands - Archive of obsolete content
selection): cmd_copy - copy a selection to the clipboard cmd_cut - cut a selection into the clipboard cmd_paste - paste a selection from the clipboard cmd_selectAll cmd_selectNone cmd_copyLink cmd_copyImageLocation cmd_copyImageContents cmd_scrollTop cmd_scrollBottom cmd_scrollPageUp cmd_scrollPageDown cmd_scrollLineUp cmd_scrollLineDown cmd_scrollLeft cmd_scrollRight cmd_select
CharPrevious cmd_select
CharNext cmd_wordPrevious cmd_wordNext cmd_selectWordPrevious cmd_selectWordNext cmd_beginLine cmd_endLine cmd_selectBeginLine cmd_selectEndLine cmd_selectLinePrevious cmd_selectLineNext cmd_selectPagePrevious cmd_selectPageNext cmd_selectMoveTop cmd_selectMoveBottom Editor commands (legal when the focus is anywhere where you can type text): cmd_paste - paste...
...tWordPrevious cmd_selectWordNext cmd_beginLine cmd_endLine cmd_selectBeginLine cmd_selectEndLine cmd_selectLinePrevious cmd_selectLineNext cmd_selectPagePrevious cmd_selectPageNext cmd_selectMoveTop cmd_selectMoveBottom Editor commands (legal when the focus is anywhere where you can type text): cmd_paste - paste a selection from the clipboard cmd_pasteQuote cmd_delete cmd_delete
CharBackward cmd_delete
CharForward cmd_deleteWordBackward cmd_deleteWordForward cmd_deleteToBeginningOfLine cmd_deleteToEndOfLine cmd_scrollTop cmd_scrollBottom cmd_moveTop cmd_moveBottom cmd_selectTop cmd_selectBottom cmd_lineNext cmd_linePrevious cmd_selectLineNext cmd_selectLinePrevious cmd_
charPrevious cmd_
charNext cmd_select
CharPrevious cmd_select
CharNext cmd_beginLine cmd_en...
setSelectionRange - Archive of obsolete content
Set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
...Set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
Multiple Rules - Archive of obsolete content
People with only a single name, as 'Cleopatra' in this example, won't match any rule so won't have any content at all generated for it. This is an effective way to filter out results that you don't want. In this simple example with one rule though, it would likely be simpler and faster to just filter these out using th...
...ments if we want to check additional conditions. When multiple conditions are present, they must all match for the rule to apply. Adding to the previous example, here we check for people with a space in their name, and a total number of letters less than 15. Note the assign element in the example above, used to calculate the '?letters' variable from the length of the name, minus one for the space
character. Naturally, this won't work for people with more than two names (Joan of Arc for instance), but rule conditions allow a number of useful ways to filter results. <rule> <where subject="?name" rel="contains" value=" "/> <where subject="?letters" rel="less" value="15"/> <action> <label uri="?" value="?name has two names for a total length of ?letters"/> </action> </rule> Negating...
SQLite Templates - Archive of obsolete content
r equal to 30. Query Parameters Sometimes, you will want to adjust the query depending on certain criteria. One possibility is to simply use methods to adjust the text within the query element and rebuild the template. However, this can become unweidly for more complex queries, and would be more error prone if values were not escaped properly to ensure that extraneous quotes, semicolons and other
characters didn't appear in the values. This is especially important when you are taking values that were entered by the user. The solution is to use query parameters, using the param element. <query> select name, email from myfriends where gender = :wantedgender <param name="wantedgender">male</param> </query> In this example, a parameter 'wantedgender' is used. This is a param element which s...
...e parameter name, and the contents of the param element specify the value to use. When the name appears in the query, preceded by a colon, as ':wantedgender' does in the example above, the value of that parameter will be filled in to the query. The resulting query that gets used will be: select name, email from myfriends where gender = 'male' This technique is used as quotes or other special
characters are handled automatically. If a quote appears in the value, it will escaped as needed. Now, to adjust the query to something else, say to look up females, all you need to do is get a reference to the param element and adjust the contents. You would likely want to add an id to the param element so that the getElementById method may be used to refer to it. You can add as many parameters as ne...
Element Positioning - Archive of obsolete content
style="max-width: 10em;"/> <description style="max-width: 50px">This is some boring but simple wrapping text.</description> Example 1 The first button will be displayed with a width of 100 pixels (px means pixels). You need to add the unit or the width will be ignored. Example 2 The second button will be displayed with a height of ten pixels and a width of 100 ems (an em is the size of a
character in the current font). Example 3 The third button is flexible so it will grow based on the size of the box the button is in. However, the button will never shrink to be less than 50 pixels. Other flexible components such as spacers will absorb the remaining space, breaking the flex ratio. Example 4 The fourth button is flexible and will never have a height that is smaller than 2 ex (an ...
...e it so that the textbox will resize to fit the entire window. <textbox id="find-text" flex="1" style="min-width: 15em;"/> Here, the text input has been made flexible. This way, it will grow if the user changes the size of the dialog. This is useful if the user wants to enter a long string of text. Also, a minimum width of 15 ems has been set so that the text box will always show at least 15
characters. If the user resizes the dialog to be very small, the text input will not shrink past 15 ems. It will be drawn as if it extends past the edge of the window. Notice in the image that the text input has grown to extend to the full size of the window. Box Packing Let's say you have a box with two child elements, both of which are not flexible, but the box is flexible. For example: Example ...
Input Controls - Archive of obsolete content
the textbox. class The style class of the textbox. value If you want the textbox to have default text, supply it with the value attribute. disabled Set to true to have text entry disabled. textbox.type You can set this attribute to the special value password to create a textbox that hides what it types. This is usually used for password entry fields. maxlength The maximum number of
characters that the textbox allows. Note that while in HTML, several different kinds of fields can be created with the input element, in XUL there are separate elements for each type. The following example shows some textboxes: Example 1 : Source View <label control="some-text" value="Enter some text"/> <textbox id="some-text"/> <label control="some-password" value="Enter a password"/> <textbox i...
...two separate elements are not necessary. If you set the multiline attribute to true, the text entry field will display multiple rows. Example 2 : Source View <textbox multiline="true" value="This is some text that could wrap onto multiple lines."/> Like the HTML textarea, you can use the rows and cols attributes to set the size. This should be set to the number of rows and columns of
characters to display. Our find files example Let's add a search entry field to the find file dialog. We'll use the textbox element. <label value="Search for:" control="find-text"/> <textbox id="find-text"/> <button id="find-button" label="Find"/> Add these lines before the buttons we created in the last section. If you open this window, you will see something much like that shown in the imag...
Simple Menu Bars - Archive of obsolete content
termines whether the menu is disabled. Although you can, there's rarely a need to disable an entire menu. This attribute can be set to either true or false. Of course, the latter is the default. accesskey This is the key that the user can press to activate the menu item. This letter is typically shown underlined on the menu title. Mozilla will look at the label attribute and add an underline
character to the
character specified here. For that reason, you should specify a
character that exists in the text (although the key will still work if it doesn't). The menu element is normally placed on a menubar, although it does not have to be. However, it will be given a different look. The image here shows what the earlier example would look like without the menu bar. menupopup element The ...
... item, such as Open or Save. disabled This boolean attribute determines whether the menu item is disabled. This attribute can be set to either true or false where the latter is the default. accesskey This is the key that the user can press to activate the menu item. This letter is typically shown underlined on the menu title. Mozilla will look at the label attribute and add an underline
character to the
character specified here. For that reason, you should specify a
character that exists in the text. acceltext This specifies the shortcut key text to appear next to the menu command text. It does not associate a key action with the menuitem however. We'll look at how to do this later. menuseparator element The menuseparator has no special attributes. It just creates a horizonta...
XPCOM Interfaces - Archive of obsolete content
es. And multiple components might implement the same interface. Let's take an example of a file component. An interface would need to be created which describes properties and functions that can be performed on files. A file would need properties for its name, modification date and its size. Functions of a file would include moving, copying and deleting it. The File interface only describes the
characteristics of a file, it does not implement it. The implementation of the File interface is left to a component. The component will have code which can retrieve the file's name, date and size. In addition, it will have code which copies and renames it. We don't care how the component implements it, as long as it implements the interface correctly. Of course, we'll have different implementations ...
...is retrieved and its service is placed in the variable bmarks. We use QueryInterface() to get the nsIBookmarksService interface. The function addBookmarkImmediately() provided by this interface can be used to add bookmarks. The first two parameters to this function are the bookmark's URL and its title. The third parameter is the bookmark type which will normally be 0 and the last parameter is the
character encoding of the document being bookmarked, which may be null. Next, we will see some of the interfaces provided with Mozilla that we can use. << PreviousNext >> ...
Using the Editor from XUL - Archive of obsolete content
Script. The nsEditorShellMouseListener essentially calls nsEditorShell::HandleMouseClickOnElement to show property dialogs for items that you double-click on. The path of a key press So what happens to a key press once it's got to the nsTextEditorKeyListener? How does that end up in the document? Let's trace through. nsTextEditorKeyListener::KeyPress() gets the key press event. For normal
character keys, that falls into nsHTMLEditor::EditorKeyPress(). nsHTMLEditor::EditorKeyPress() gets the
character code from the key event, puts that into a string, and calls nsHTMLEditor::TypedText(), which simply calls nsHTMLEditor::InsertText(). nsHTMLEditor::InsertText() hides quite a bit of complexity in some stack-based classes. nsAutoPlaceHolderBatch is a utility class that wraps ...
... typing over selected text), then calls a generic pre-insertion call WillInsert(), which sets up inline styles for the inserted text, and moves the selection to an appropriate place where the text is to be inserted. Now we are ready to actually insert the text. Recall that we're going through a generic InsertText() call, so this code deals with pasting long strings, as well as inserting single
characters. The code thus has to do the correct thing with linebreaks, so has a special case for inserting into <pre> sections. We call into the normal insertion code, which loops through the input string looking for linebreaks, and inserts each text run, followed by a <br> when necessary. When handling key presses, this will just insert a single
character. We fall out of the WillDoAction() call, a...
caption - Archive of obsolete content
caption. More information is available in the XUL tutorial. Attributes accesskey, crop, image, label, tabindex Properties accessKey, crop, image, label, tabIndex Examples <groupbox> <caption label="My groupbox"/> </groupbox> <groupbox flex="1"> <caption> <checkbox label="A checked groupbox"/> </caption> </groupbox> 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. crop Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place...
...an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. Properties accessKey Type:
character Gets and sets the value of the accesskey attribute. crop Type: string Gets and sets the value of the crop attribute. image Type: image URL Gets and sets the value of the image attribute. label Type: string Gets and sets the value of the label attribute. tabIndex Type: integer Gets and sets...
checkbox - Archive of obsolete content
. More information is available in the XUL tutorial. Attributes accesskey, checked, command, crop, disabled, src, label, preference, tabindex Properties accessKey, accessibleType, checked, command, crop, disabled, src, label, tabIndex Examples <checkbox label="Enable JavaScript" checked="true"/> <checkbox label="Enable Java" checked="false"/> 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. checked Type: boolean Indicates whether the element is checked or not. Use hasAttribute() to determine whether this attribute is set instead of getAttribute(). For buttons, the type attribute must be set to checkbox or ...
...e. This attribute only has any effect when used inside a prefwindow. More information is available in the Preferences System article. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. Properties accessKey Type:
character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. checked Type: boolean Gets and sets the value of the checked attribute. command Type: element id Gets and sets the value of the command attribute. crop Type: string...
key - Archive of obsolete content
nly for form controls. Using it with an anchor tag (an <a> link) will have no effect. The 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. key Type:
character The
character that must be pressed. This should be set to a displayable
character. keycode Type: string key code For keys that do not have displayable
characters, such as the Enter key or function keys, use this attribute instead of the key attribute. Valid keys are listed at Keyboard Shortcuts. keytext Type: string A label for the keyboard shortcut. This text would appear...
...eys that should be pressed to invoke the keyboard shortcut. Multiple keys may be separated by spaces or commas. Keys will map to other keys on platforms that do not have them. shift: The Shift key. alt: The Alt key. On the Macintosh, this is the Option key. On Macintosh this can only be used in conjunction with another modifier, since Alt+Letter combinations are reserved for entering special
characters in text. meta: The Meta key. On the Macintosh, this is the Command key. control: The Control key. os: Windows logo key on Windows, Super or Hyper key on Linux. This shouldn't be specified directly because it may conflict with system wide shortcut key. accel: The key used for keyboard shortcuts on the user's platform, which is Control on Windows and Linux, and Command on Mac. Usually, t...
label - Archive of obsolete content
e. More information is available in the XUL tutorial. Attributes accesskey, control, crop, disabled, href, value Properties accessKey, accessibleType, control, crop, disabled, value Style classes header, indent, monospace, plain, small-margin, text-link Examples <label value="Email address" control="email"/> <textbox id="email"/> 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. control Type: id This attribute specifies the id of the element with which the label is associated. When the user clicks on the label, the associated element is given focus. crop Type: one of the values...
... 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. href Type: string Defines a URL to open when this element is clicked. Requires the class attribute to include text-link. value Type: string The text to be used for the label. Properties accessKey Type:
character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. control Type: element id Gets and sets the value of the control attribute. crop Type: string Gets and sets the value of the crop attribute. disabled ...
menuitem - Archive of obsolete content
label="option 4" value="4"/> </menupopup> </menulist> Attributes acceltext Type: string Text that appears beside the menu label to indicate the shortcut key (accelerator key) to use to invoke the command. If this value is set, it overrides an assigned key set in the key attribute. This attribute does not apply to menus directly on the menubar. 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. allowevents Type: boolean If true, events are passed to children of the element. Otherwise, events are passed to the element only. autocheck Type: boolean If this attribute is true or left out, the checked st...
..., the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. accessKey Type:
character Gets and sets the value of the accesskey attribute. command Type: element id Gets and sets the value of the command attribute. control Type: menu element Returns the enclosing menu that the item is inside, if any, or null if there is no enclosing menu. crop Type: string Gets and sets the value of the crop attribute. disabled Type: boo...
menuseparator - Archive of obsolete content
<menuitem label="Item3"/> </menupopup> </menu> Attributes acceltext Type: string Text that appears beside the menu label to indicate the shortcut key (accelerator key) to use to invoke the command. If this value is set, it overrides an assigned key set in the key attribute. This attribute does not apply to menus directly on the menubar. 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. allowevents Type: boolean If true, events are passed to children of the element. Otherwise, events are passed to the element only. command Type: id Set to the id of a command element that is being observed ...
...the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. accessKey Type:
character Gets and sets the value of the accesskey attribute. command Type: element id Gets and sets the value of the command attribute. control Type: menu element Returns the enclosing menu that the item is inside, if any, or null if there is no enclosing menu. crop Type: string Gets and sets the value of the crop attribute. disabled Type:...
Using LDAP XPCOM with XULRunner - Archive of obsolete content
xpcomglue_s.$(LIB_SUFFIX) \ $(XPCOM_FROZEN_LDOPTS) \ $(NSPR_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk DEFINES += -DMOZ_DLL_PREFIX=\"$(DLL_PREFIX)\" LDAPStubLoader.cpp: // Copyright (c) 2005 Benjamin Smedberg <benjamin@smedbergs.us> #include "nscore.h" #include "nsModule.h" #include "prlink.h" #include "nsILocalFile.h" #include "nsStringAPI.h" #include "nsCOMPtr.h" static
char const *const kDependentLibraries[] = { #ifdef NS_WIN32 MOZ_DLL_PREFIX "nsldap32v50" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "nsldappr32v50" MOZ_DLL_SUFFIX, #endif //NS_WIN32 #ifdef NS_UNIX MOZ_DLL_PREFIX "ldap50" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "prldap50" MOZ_DLL_SUFFIX, #endif //NS_UNIX nsnull }; // component.dll on windows, libcomponent.dll on linux static
char kRealComponent[] = MOZ_DLL_PREFI...
...We don't care about that either. } library->SetNativeLeafName(NS_LITERAL_CSTRING(kRealComponent)); PRLibrary ...
MacFAQ - Archive of obsolete content
Settings.js" /> <script><![CDATA[ function debug(aLogString) { var mConsoleService = Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService) mConsoleService.logStringMessage("myXUL: " + aLogString + "\n"); } function checkOtherWindows() { var singletonWindowType = nsPreferences.copyUni
charPref("toolkit.singletonWindowType"); var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var win = windowMediator.getMostRecentWindow(singletonWindowType); if (win) { window.close(); win.focus(); } } if (window.arguments && window.argu...
...ents && window.arguments[0]){ try { var cmdLine = window.arguments[0] .QueryInterface(Components.interfaces.nsICommandLine); for (var i = 0; i < cmdLine.length; ++i) { debug(cmdLine.getArgument(i)) } } catch(ex) { debug(window.arguments[0]) // Do something with window.arguments[0] //nsPreferences.setUni
charPref("myXUL.cmdLineValue", window.arguments[0]) } window.addEventListener("load", checkOtherWindows , false); } ]]></script> </window> ...
Using SOAP in XULRunner 1.9 - Archive of obsolete content
ff between jqSOAPClient.js and saSOAPClient.js 42c42 < var jsOut = $.xmlToJSON(xData.responseXML); --- > var jsOut = XMLObjectifier.xmlToJSON(xData.responseXML); 46,60c46,62 < $.ajax({ < type: "POST", < url: SOAPClient.Proxy, < dataType: "xml", < processData: false, < data: content, < complete: getResponse, < contentType: SOAPClient.ContentType + ";
charset=\"" + SOAPClient.
CharSet + "\"", < beforeSend: function(req) { < req.setRequestHeader("Method", "POST"); < req.setRequestHeader("Content-Length", SOAPClient.ContentLength); < req.setRequestHeader("SOAPServer", SOAPClient.SOAPServer); < req.setRequestHeader("SOAPAction", soapReq.Action); < } < }); --- > var xhr = new XMLHttpRequest(); > xhr.mozBackgr...
...questHeader("SOAPAction", soapReq.Action); < } < }); --- > var xhr = new XMLHttpRequest(); > xhr.mozBackgroundRequest = true; > xhr.open('POST', SOAPClient.Proxy, true); > xhr.onreadystatechange = function() { > if (4 != xhr.readyState) { return; } > getResponse(xhr); > }; > var headers = { > 'Method': 'POST', > 'Content-Type': SOAPClient.ContentType + ';
charset="' + > SOAPClient.
CharSet + '"', > 'Content-Length': SOAPClient.ContentLength, > 'SOAPServer': SOAPClient.SOAPServer, > 'SOAPAction': soapReq.Action > }; > for (var h in headers) { xhr.setRequestHeader(h, headers[h]); } > xhr.send(content); ...
NPN_GetURL - Archive of obsolete content
url Pointer to the URL of the request. Can be of any type, such as HTTP, FTP, news, or mailto. target Name of the target window or frame, or one of the following special target names. ...
... url Pointer to the URL of the request. Can be of any type, such as HTTP, FTP, news, or mailto. target Name of the target window or frame, or one of the following special target names. ...
NPN_PostURL - Archive of obsolete content
url URL of the request, specified by the plug-in. target Display target, specified by the plug-in. If null, pass the new stream back to the current plug-in instance regardless of MIME type. ...
... url URL of the request, specified by the plug-in. target Display target, specified by the plug-in. If null, pass the new stream back to the current plug-in instance regardless of MIME type. ...
NPN_SetValueForURL - Archive of obsolete content
variable Selects the type of information to be changed. The only supported type is NPNURLVCookie. url The URL for which to change information. value The new associated information for the URL...
... variable Selects the type of information to be changed. The only supported type is NPNURLVCookie. url The URL for which to change information. value The new associated information for the URL. Note: the value may have internal NULL byt...
NPP_New - Archive of obsolete content
instance Contains instance-specific private data for the plug-in and the browser. ...
... instance Contains instance-specific private data for the plug-in and the browser. ...
NPStream - Archive of obsolete content
<< Gecko Plugin API Reference << Plug-in Side Plug-in API Summary Represents a stream of data either produced by the browser and consumed by the plug-in, or produced by the plug-in and consumed by the browser. Syntax typedef struct _NPStream { void* pdata; /* plug-in private data */ void* ndata; /* Netscape private data */ const
char* url; uint32 end; uint32 lastmodified; void* notifyData; const
char *headers; } NPStream; Fields The data structure has the following fields: Plug-in-private value that the plug-in can use to store a pointer to private data associated with the instance; not modified by the browser. ndata Browser-private value that can store data associated with the instance; should not be modified by the plug-in. url ...
...The response headers from the host. This field is only available if the NP version is greater than or equal to NPVERS_HAS_RESPONSE_HEADERS. This field is used only for HTTP and is null for other types of streams. The plug-in should copy this data before making use of it. The headers include the HTTP status line and all headers, verbatim as received from the server. Lines are terminated by newline
characters ("\n"), and the headers are terminated by a newline followed by null ("\n\0"). Description The browser allocates and initializes the NPStream object and passes it to the plug-in in as a parameter to NPP_NewStream or NPN_NewStream. The browser cannot delete the object until after it calls NPP_DestroyStream or the plug-in calls NPN_DestroyStream. Streams produced by the browser: the browser ...
TCP/IP Security - Archive of obsolete content
Although using TLS may require modifying some applications, TLS is a well-tested protocol that has several implementations that have been added to many applications, so it is a relatively low-risk option compared to adding protection at the application layer. Traditionally TLS has been used to protect HTTP-based communications and can be used with SSL portal VPNs. Network Layer. C...
...traffic and data is being sent from the expected host. SSL authentication is typically performed one-way, authenticating the server to the client, but it can be performed mutually. Replay Protection. The same data is not delivered multiple times, and data is not delivered grossly out of order. Original Document Information Author(s): Sheila Frankel, Paul Hoffman, Angela Orebaugh, and Ri
chard Park Title: National Institute of Standards and Technology (NIST) Special Publication 800-113, Guide to SSL VPNs Last Updated Date: July 2008 Copyright Information: This document is not subject to copyright. ...
Sunbird Theme Tutorial - Archive of obsolete content
e in the wrong place--start again and follow the instructions more carefully. Creating a unique identifier Create an identifier that is likely to be unique, in the form: <tt>something@domain-name</tt> It must contain an at-sign (<tt>@</tt>), making it look something like an e-mail address, but it does not need to be a real e-mail address. Before and after the at-sign, it can only contain the
characters A-Z, a-z, 0-9, full stop, hyphen and underscore. If you do not own a domain name, you can make up something else. If you want to make it clear that your made-up name is not a real domain, add <tt>.invalid</tt> to the end. Create a new directory in the <tt>extensions</tt> directory. Use the identifer as your new directory's name. This new directory is your theme directory. Go into your theme...
...Change the next six lines to describe your theme. Ensure that the internal name is a single word. Note: If your theme is for a version of Sunbird later than 0.4, then also change the maxVersion. Save the file. Registering your theme To register your theme, create a plain text file named <tt>chrome.manifest</tt>. Copy and paste the content fro...
-ms-text-autospace - Archive of obsolete content
lueas specifiedAnimation typediscrete Syntax Values none No effect takes place; that is, no extra space is added. This is the default value. ideograph-alpha Creates extra spacing between runs of ideographic and non-ideographic text, such as Latin-based, Cyrillic, Greek, Arabic, or Hebrew text. ideograph-numeric Creates extra spacing between runs of ideographic text and numeric
characters. ideograph-parenthesis Creates extra spacing between a normal (non-wide) parenthesis and an ideograph. ideograph-space Extends the width of the space
character when it is adjacent to ideographs. Formal syntax none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space Specifications Not part of any specification. Remarks This property require...
...idth of the space
character when it is adjacent to ideographs. Formal syntax none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space Specifications Not part of any specification. Remarks This property requires Windows 8 or later. This property is an extension to CSS, and can be used as a synonym for text-autospace in IE8 standards Mode. An ideograph is a
character in an Asian writing system that represents a concept or an idea, but not a particular word or pronunciation. ...
New in JavaScript 1.2 - Archive of obsolete content
vigator 4.0. --> New features in JavaScript 1.2 New objects You can create objects using literal notation (inspired by dictionary literal syntax from Python 1.x). Arrays can now be created using literal notation (inspired by list literal syntax from Python 1.x). ...
...w objects You can create objects using literal notation (inspired by dictionary literal syntax from Python 1.x). Arrays can now be created using literal notation (inspired by list literal syntax from Python 1.x). ...
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
ll browsers as if it were nothing more than HTML. However when an XHTML page is served with MIME type text/xml or application/xhtml+xml, then it should be treated as an XML document which must conform to the strict rules for authoring and displaying XML. Proper XHTML is an application of XML and as such requires that authors follow strict rules when authoring XHTML. In particular: Raw < and &
characters are not allowed except inside of CDATA Sections (<![CDATA[ ... ]]>). Comments (<!---- ... ---->) must not contain double dashes (----). Content contained within Comments (<!---- ... ---->) can be ignored. Problems with Inline style and script Inline style and script tags can cause several different problems in XHTML when it is treated as XML rather than HTML. JavaScript Contains
Chara...
...... ]]>). Comments (<!---- ... ---->) must not contain double dashes (----). Content contained within Comments (<!---- ... ---->) can be ignored. Problems with Inline style and script Inline style and script tags can cause several different problems in XHTML when it is treated as XML rather than HTML. JavaScript Contains
Characters Which Can Not Exist in XHTML JavaScript typically contains
characters which can not exist in XHTML outside of CDATA Sections. <script type="text/javascript"> var i = 0; while (++i < 10) { // ... } </script> Note that this example is not well formed XHTML since the use of raw < is only allowed as a part of markup in XHTML or XML. Use of Comments Inside Inline style and script Authors who are familiar with HTML commonly enclose the contents of...
Writing JavaScript for XHTML - Archive of obsolete content
cript in them is like throwing your lunch in a Piranha pool. Moreover, there's really no point to commenting out your scripts -- no browser written in the last ten years will display your code on the page. The easy solution is to do away with the commenting entirely: <script type="text/javascript"> window.alert("Hello World!"); </script> This will work so long as your code doesn't contain
characters which are "special" in XML, which usually means < and &. If your code contains either of these, you can work around this with CDATA sections: <script type="text/javascript"> <![CDATA[ // is the variable a non-negative integer less than 10? if (variable < 10 && variable >= 0) action(); ]]> </script> Note that the CDATA section is only necessary because of the < in the code; ...
...nd this with CDATA sections: <script type="text/javascript"> <![CDATA[ // is the variable a non-negative integer less than 10? if (variable < 10 && variable >= 0) action(); ]]> </script> Note that the CDATA section is only necessary because of the < in the code; otherwise you could have ignored it. A third solution is to use only external scripts, neatly sidestepping the special-
character problem. Alternatively, the CDATA section can be couched within comments so as to be able to work in either application/xhtml+xml or text/html: <script type="text/javascript"> //<![CDATA[ ... //]]> </script> <!-- (For styles, it is different) --> <style type="text/css"> /*<![CDATA[*/ ... /*]]>*/ </style> And if you really need compatibility with very old browsers that do...
XForms Secret Element - Archive of obsolete content
Attributes UI Common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special inputmode - isn't supported. incremental - supported. The default value is false. Type restrictions The secret element can be bound to a node containing simple content of any data type except xsd:base64Binary, xsd:hexBinray or any data type derived from these. Representations The XForms secret element is represented by a password field. ...
...l - supported. The default value is false. Type restrictions The secret element can be bound to a node containing simple content of any data type except xsd:base64Binary, xsd:hexBinray or any data type derived from these. Representations The XForms secret element is represented by a password field. The password field is a text field, the value of which is hidden by asterisks (xhtml/xul).
Characteristics analogous widgets are <xhtml:input type="password"/> and <xul:textbox type="password"/> if the incremental attribute is present and has the value true, then the bound instance node is updated on every user input. Please keep in mind that the instance data will hold exactly what the user gave as input. Any other XForm control bound to that data will show that data 'as is'. ...
XForms Select Element - Archive of obsolete content
used to add a subtree of nodes underneath the element that the select control is bound to. Representations The XForms select element can be represented by the following widgets for the specified appearance attribute values: list - default representation (xhtml/xul) check group- used when appearance = 'full' (xhtml/xul) list Displaying a listbox is the default representation (xhtml/xul).
Characteristics analogous widgets are <html:select size="5" multiple="true"/> and <xul:listbox seltype="multiple"/> visual grouping by choices element isn't implemented if incremental attribute value is false, the bound node is updated when the select control is blurred (i.e. loses focus), otherwise it is updated upon item selection check group The select is represented as group of checkboxes (...
... analogous widgets are <html:select size="5" multiple="true"/> and <xul:listbox seltype="multiple"/> visual grouping by choices element isn't implemented if incremental attribute value is false, the bound node is updated when the select control is blurred (i.e. loses focus), otherwise it is updated upon item selection check group The select is represented as group of checkboxes (xhtml/xul). ...
Audio for Web games - Game development
* Note: Safari 7 has issues playing if you try and start all pieces of audio simultaneously. If you stagger playback you may have some degree of success. Note: Concurrent audio playback is tested using our concurrent audio test example, where we attempt to play three pieces of audio at the same time using the standard audio API. Note:...
... way you can make your music soundtrack more dynamic is by splitting it up into component loops or tracks. This is often the way that musicians compose music anyway, and the Web Audio API is extremely good at keeping these parts in sync. Once you have the various tracks that make up your piece you can bring tracks in and out as appropriate. You can also apply filters or effects to music. Is your
character in a cave? Increase the echo. Maybe you have underwater scenes, during which you could apply a filter that muffles the sound. Let's look at some Web Audio API techniques for dynamically adjusting music from its base tracks. Loading your tracks With the Web Audio API you can load separate tracks and loops individually using XMLHttpRequest or the Fetch API, which means you can load them syn...
Square tilemaps implementation: Scrolling maps - Game development
duction article. This article also builds upon implementing static square tilemaps -- you should read that too if you've not done so already. The camera The camera is an object that holds information about which section of the game world or level is currently being shown. Cameras can either be free-form, controlled by the player (such as in strategy games) or follow an object (such as the main
character in platform games.) Regardless of the type of camera, we would always need information regarding its current position, viewport size, etc. In the demo provided along with this article, these are the parameters the camera has: x and y: The current position of the camera. In this implementation, we are assuming that (x,y) points to the top left corner of visible portion of the map. width ...
... ...
Initialize the framework - Game development
Phaser framework will generate the required <canvas> element. The game's HTML The HTML document structure is quite simple, as the game will be rendered entirely on the <canvas> element generated by the framework. ...
... Choose an option that suits you best -- I would recommend the min.js option as it keeps the source code smaller, and you are unlikely need to go through the source code anyway. Save the Phaser code inside a /js directory in the same location as your index.html file. Update the src value of the first <script> element as shown above. Walking through what we have so far At this point we have a
charset defined, <title> and some basic CSS in the header to reset the default margin and padding. We also have a <script> element to apply the Phaser source code to the page. The body contains a second <script> element, where we will write the JavaScript code to render the game and control it. The <canvas> element is generated automatically by the framework. We are initializing it by creating a new ...
2D maze game with device orientation - Game development
e of the game defined inside. audio: The sound files used in the game. Setting up the Canvas We will be rendering our game on Canvas, but we won't do it manually -- this will be taken care of by the framework. Let's set it up: our starting point is the index.html file with the following content. ...
...The <body> contains initialization of the Phaser framework and the definitions of the game states. var game = new Phaser.Game(320, 480, Phaser.CANVAS, 'game'); The line above will initialize the Phaser instance -- the arguments are the width of the Canvas, height of the Canvas, rendering method (we're using CANVAS, but there are ...
Plug-in Development Overview - Gecko Plugin API Reference
Unix On Unix, plug-ins are found according to the section How Gecko Finds ...
... FileOpenName: for file open template ProductName: for plug-in name FileDescription: for description Language: for language in use In the MIME types and file extensions strings, multiple values are separated by the "|"
character, for example: video/quicktime|audio/aiff|image/jpeg The version stamp will be loaded only if it has been created with the language set to "US English" and the
character set to "Windows Multilingual" in your development environment. The resource code for this language and
character set combination is 040904E4. Unix On Unix, plug-ins are found according to the section How Gecko Finds Plug-ins. To determine the MIME types and file extensions that the plug-in handles, the browser loads each library and calls into the NP_GetMIMEDescription entry point. This ...
Syntax - MDN Web Docs Glossary: Definitions of Web-related terms
Syntax generally includes grammar and the rules that apply to writing it, such as indentation requirements in Python. Syntax varies from language to language (e.g., syntax is different in HTML and JavaScript). Although languages can share few similarities in terms of their syntaxes for example "operand operator operand" rule in javaScript and python. This does not mean the two langauges share similarities with syntax. Syntax applies both to programming languages (commands to the computer) and markup languages (document structure information) alike. ...
...also be meaningful, which is the province of semantics. Code must have correct syntax in order to compile correctly, otherwise a syntax error occurs. Even small errors, like a missing parenthesis, can stop source code from compiling successfully. Frameworks are said to have a "clean" syntax if they produce simple, readable, concise results. If a codebase uses "a lot of syntax", it requires more
characters to achieve the same functionality. Learn more General knowledge Syntax (programming languages) on Wikipedia ...
Glyph - MDN Web Docs Glossary: Definitions of Web-related terms
A glyph is a term used in typography for the visual representation of one or more
characters. The fonts used by a website contain different sets of glyphs, which represent the
characters of the font. ...
... A glyph is a term used in typography for the visual representation of one or more
characters. The fonts used by a website contain different sets of glyphs, which represent the
characters of the font. ...
Percent-encoding - MDN Web Docs Glossary: Definitions of Web-related terms
Percent-encoding is a mechanism to encode 8-bit
characters that have specific meaning in the context of URLs. It is sometimes called URL encoding. The encoding consists of substitution: A '%' followed by the hexadecimal representation of the ASCII value of the replace
character. Special
characters needing encoding are: ':', '/', '?', '#', '[', ']', '@', '!', '$', '&', "'", '(', ')', '*', '+', ',', ';', '=', as well as '%' itself. Other
characters don't need to be encoded, though they could. ':' '/' '?' '#' '[' ']' '@' '!' '$' '&' "'" '(' ')' '*' '+' ',' ';' '=' '%' ' ' %3A %2F %3F %23 %5B %5D %40 %21 %24 %26 %27 %28 %29 %2A %2B %2C %3B %3D %25 %20 or + ...
... Learn more General knowledge Definition of percent-encoding in Wikipedia. Technical knowledge RFC 3986, section 2.1, where this encoding is defined. ...
MDN Web Docs Glossary: Definitions of Web-related terms
Brotli Browser Browsing context buffer C Cache Cacheable CalDAV Call stack Callback function Canonical order Canvas Card sorting CardDAV caret CDN Certificate authority Certified Challenge-response authentication
Character
Character encoding
Character set Chrome CIA Cipher Cipher suite Ciphertext Class Client hints Closure CMS Code splitting Codec Compile Compile time Computer Programming Conditional Constant Constructor Continuous M...
... WebVTT WHATWG Whitespace World Wide Web Wrapper X XForms XHR (XMLHttpRequest) XHTML XInclude XLink XML XPath XQuery XSLT Other 404 502 ALPN at-rule Attack Byte-Order Mark
Character set client cryptosystem debug digital signature execution flex-direction GLSL Interface Library Memory management routers Self-Executing Anonymous Function Stylesheet Vector image ...
HTML: A good basis for accessibility - Learn web development
use can also affect accessibility. In general, you should use clear language that is not overly complex and doesn't use unnecessary jargon or slang terms. This not only benefits people with cognitive or other disabilities; it benefits readers for whom the text is not written in their first language, younger people ... everyone, in fact! Apart from this, you should try to avoid using language and
characters that don't get read out clearly by the screen reader. For example: Don't use dashes if you can avoid it. Instead of writing 5-7, write 5 to 7. Expand abbreviations -- instead of writing Jan, write January. Expand acronyms, at least once or twice. Instead of writing HTML in the first instance, write Hypertext Markup Language. Page layouts In the bad old days, people used to create pa...
... article. Other text alternative mechanisms Images also have another mechanisms available for providing descriptive text. For example, there is a longdesc attribute that is meant to point to a separate web document containing an extended description of the image, for example: <img src="dinosaur.png" longdesc="dino-info.html"> This sounds like a good idea, especially for infographics like big
charts with lots of information on them that could perhaps be represented as an accessible data table instead (see Accessible data tables). However, longdesc is not supported consistently by screen readers, and the content is completely inaccessible to non-screen reader users. It is arguably much better to include the long description on the same page as the image, or link to it with a regular link. ...
HTML: A good basis for accessibility - Learn web development
use can also affect accessibility. In general, you should use clear language that is not overly complex and doesn't use unnecessary jargon or slang terms. This not only benefits people with cognitive or other disabilities; it benefits readers for whom the text is not written in their first language, younger people ... everyone, in fact! Apart from this, you should try to avoid using language and
characters that don't get read out clearly by the screen reader. For example: Don't use dashes if you can avoid it. Instead of writing 5-7, write 5 to 7. Expand abbreviations -- instead of writing Jan, write January. Expand acronyms, at least once or twice. Instead of writing HTML in the first instance, write Hypertext Markup Language. Page layouts In the bad old days, people used to create pa...
... article. Other text alternative mechanisms Images also have another mechanisms available for providing descriptive text. For example, there is a longdesc attribute that is meant to point to a separate web document containing an extended description of the image, for example: <img src="dinosaur.png" longdesc="dino-info.html"> This sounds like a good idea, especially for infographics like big
charts with lots of information on them that could perhaps be represented as an accessible data table instead (see Accessible data tables). However, longdesc is not supported consistently by screen readers, and the content is completely inaccessible to non-screen reader users. It is arguably much better to include the long description on the same page as the image, or link to it with a regular link. ...
Mobile accessibility - Learn web development
or navigate line by line, etc. For example, with TalkBack turned on: Open your web browser. Activate the URL bar. Enter a web page that has a bunch of headings on it, such as the front page of bbc.co.uk. To enter the text of the URL: Select the URL bar by swiping left/right till you get to it, and then double-tapping. Hold your finger down on the virtual keyboard until you get the
character you want, and then release your finger to type it. Repeat for each
character. Once you've finished, find the Enter key and press it. Swipe left and right to move between different items on the page. Swipe up and right with a smooth motion to enter the local content menu. Swipe right until you find the "Headings and Landmarks" option. Double-tap to select it. Now you'll be able to...
...what app or view you are in (see below for an example). Browsing web pages Let's have a go at web browsing with VoiceOver: Open your web browser. Activate the URL bar. Enter a web page that has a bunch of headings on it, such as the front page of bbc.co.uk. To enter the text of the URL: Select the URL bar by swiping left/right until you get to it, and then double-tapping. For each
character, hold your finger down on the virtual keyboard until you get the
character you want, and then release your finger to select it. Double-tap to type it. Once you've finished, find the Enter key and press it. Swipe left and right to move between items on the page. You can double-tap an item to select it (e.g., follow a link). By default, the selected Rotor option will be Speaking Rate...
Type, class, and ID selectors - Learn web development
. To avoid this confusion we can add the universal selector to the :first-child selector, so it is obvious what the selector is doing. It is selecting any element which is the first-child of any descendant element of <article>: article *:first-child { } Although both do the same thing, the readability is significantly improved. Class selectors The class selector starts with a full stop (.)
character and will select everything in the document with that class applied to it. In the live example below we have created a class called .highlight, and have applied it to several places in my document. All of the elements that have the class applied are highlighted. Targeting classes on particular elements You can create a selector that will target specific elements with the class applied. In...
...e change the border-color. We can tell the browser that we only want to match the element if it has two classes applied by chaining them together with no white space between them. You'll see that the last <div> doesn't get any styling applied, as it only has the danger class; it needs notebox as well to get anything applied. ID Selectors An ID selector begins with a # rather than a full stop
character, but is basically used in the same way as a class selector. An ID however can be used only once per document, and elements can only have a single id value 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: ...
Getting started with CSS - Learn web development
Objective: To understand the basics of linking a CSS document to an HTML file, and be able to do simple text formatting with CSS. Starting with some HTML Our starting point is an HTML document. You can copy the code from below if you want to work on your own computer. Save the code below as index.html in a folder on your machine. <!doctype html> <html lang="en"> <head> <meta
charset="utf-8"> <title>Getting started with CSS</title> </head> <body> <h1>I am a level one heading</h1> <p>This is a paragraph of text. In the text is a <span>span element</span> and also a <a href="http://example.com">link</a>.</p> <p>This is the second paragraph. It contains an <em>emphasized</em> element.</p> <ul> <li>Item one</li> <li>Item two</li> ...
... The most common way to do this is to add a class to your HTML element 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: orange; 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 orange and bold. Try adding a class of special to it, then reload your pag...
Using CSS generated content - Learn web development
ples 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 property with the text content as its value. HTML A text where I need to <span class="ref">something</span> CSS .ref::before { font-weight: bold; color: navy; content: "Reference "; } Output The
character set of a stylesheet is UTF-8 by default, but it can also be specified in the link, in the stylesheet itself, or in other ways. For details, see 4.4 CSS style sheet representation in the CSS Specification. Individual
characters can also be specified by an escape mechanism that uses backslash as the escape
character. For example, "\265B" is the chess symbol for a black queen ?. For details, s...
...tylesheet is UTF-8 by default, but it can also be specified in the link, in the stylesheet itself, or in other ways. For details, see 4.4 CSS style sheet representation in the CSS Specification. Individual
characters can also be specified by an escape mechanism that uses backslash as the escape
character. For example, "\265B" is the chess symbol for a black queen ?. For details, see Referring to
characters not represented in a
character encoding and
Characters and case in the CSS Specification. Image content To add an image before or after an element, you can specify the URL of an image file in the value of the content property. This rule adds a space and an icon after every link that has the class glossary: HTML <a href="developer.mozilla.org" class="glossary">developer.mozilla.org</a> ...
Fundamental text and font styling - Learn web development
g them very carefully, testing as you go. The five names are defined as follows: Term Definition Example serif Fonts that have serifs (the flourishes and other small details you see at the ends of the strokes in some typefaces) My big red elephant sans-serif Fonts that don't have serifs. My big red elephant monospace Fonts where every
character has the same width, typically used in code listings. My big red elephant cursive Fonts that are intended to emulate handwriting, with flowing, connected strokes. My big red elephant fantasy Fonts that are intended to be decorative. My big red elephant Font stacks Since you can't guarantee the availability of the fonts you want to use on your webpages ...
...et your font to be transformed. Values include: none: Prevents any transformation. uppercase: Transforms all text to capitals. lowercase: Transforms all text to lower case. capitalize: Transforms all words to have the first letter capitalized. full-width: Transforms all glyphs to be written inside a fixed-width square, similar to a monospace font, allowing aligning of e.g. Latin
characters along with Asian language glyphs (like Chinese, Japanese, Korean). text-decoration: Sets/unsets text decorations on fonts (you'll mainly use this to unset the default underline on links when styling them.) Available values are: none: Unsets any text decorations already present. underline: Underlines the text. overline: Gives the text an overline. line-through: Puts a st...
Web fonts - Learn web development
different file formats. There are generally three types of sites where you can obtain fonts: A free font distributor: This is a site that makes free fonts available for download (there may still be some license conditions, such as crediting the font creator). Examples include Font Squirrel, dafont, and Everything Fonts. A paid font distributor: This is a site that makes fonts available for a
charge, such as fonts.com or myfonts.com. You can also buy fonts directly from font foundries, for example Linotype, Monotype, or Exljbris. An online font service: This is a site that stores and serves the fonts for you, making the whole process easier. See the Using an online font service section for more details. Let's find some fonts! Go to Font Squirrel and choose two fonts -- a nice interestin...
...r 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 fonts -- these are fonts that allow many...
What is a URL? - Learn web development
a URL is used within a document, such as in an HTML page, things are a bit different. Because the browser already has the document's own URL, it can use this information to fill in the missing parts of any URL available inside that document. We can differentiate between an absolute URL and a relative URL by looking only at the path part of the URL. If the path part of the URL starts with the "/"
character, the browser will fetch that resource from the top root of the server, without reference to the context given by the current document. Let's look at some examples to make this clearer. Examples of absolute URLs Full URL (the same as the one we used before) https://developer.mozilla.org/docs/Learn Implicit protocol //developer.mozilla.org/docs/Learn In this case, the browser w...
... enter them into a browser's address bar. People are at the core of the Web, and so it is considered best practice to build what is called semantic URLs. Semantic URLs use words with inherent meaning that can be understood by anyone, regardless of their technical know-how. Linguistic semantics are of course irrelevant to computers. You've probably often seen URLs that look like mashups of random
characters. But there are many advantages to creating human-readable URLs: It is easier for you to manipulate them. It clarifies things for users in terms of where they are, what they're doing, what they're reading or interacting with on the Web. Some search engines can use those semantics to improve the classification of the associated pages. ...
How to build custom form controls - Learn web development
ellipsis */ display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow: ellipsis; vertical-align: top; } We don't need an extra element to design the down arrow; instead, we're using the :after pseudo-element. It could also be implemented using a simple background image on the select class. ...
...k; width : 100%; overflow : hidden; white-space : nowrap; text-overflow: ellipsis; vertical-align: top; } We don't need an extra element to design the down arrow; instead, we're using the :after pseudo-element. It could also be implemented using a simple background image on the select class. ...
Sending form data - Learn web development
g example just takes the data and displays it to the user. Of course, what you do with the data is up to you. You might display it, store it into a database, send it by email, or process it in some other way. <?php // The global $_POST variable allows you to access the data sent with the POST method by name // To access the data sent with the GET method, you can use $_GET $say = htmlspecial
chars($_POST['say']); $to = htmlspecial
chars($_POST['to']); echo $say, ' ', $to; ?> This example displays a page with the data we sent. You can see this in action in our example php-example.html file -- which contains the same example form as we saw before, with a method of POST and an action of php-example.php. When it is submitted, it sends the form data to php-example.php, which contains th...
... Be paranoid: Never trust your users So, how do you fight these threats? This is a topic far beyond this guide, but there are a few rules to keep in mind. The most important rule is: never ever trust your users, including yourself; even a trusted user could have been hijacked. All data that comes to your server must be checked and sanitized. Always. No exception. Escape potentially dangerous
characters. The specific
characters you should be cautious with vary depending on the context in which the data is used and the server platform you employ, but all server-side languages have functions for this. Things to watch out for are
character sequences that look like executable code (such as JavaScript or SQL commands). Limit the incoming amount of data to allow only what's necessary. Sandbox ...
Test your skills: Form validation - Learn web development
a simple support query form, and we want you to add some validation features to it: Make all of the input fields mandatory to complete before the form can be submitted. Change the type of the "Email address" and "Phone number" fields to make the browser apply some more specific validation suitable for the data being asked for. Give the "User name" field a required length of between 5 and 20
characters, the "Phone number" field a maximum length of 15
characters, and the "Comment" field a maximum length of 200
characters. Try submitting your form -- it should refuse to submit until the above constaints are followed, and give suitable error messages. To help, you might want to consider adding some simple CSS to show when a form field is valid or invalid. Download the starting point for ...
...ine editor. Form validation 3 In our final task for this set, we are providing you with a similar example to what you saw in the accompanying article -- a simple email address entry input. We would like you to use the constraint validation API, plus some form validation attributes, to program some custom error messages. Make the input mandatory to fill in, and give it a minimum length of 10
characters. Add an event listener that checks whether the inputted value is an email address, and whether it is long enough. If it doesn't look like an email address or is too short, provide the user with appropriate custom error messages. 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 th...
Test your skills: Other controls - Learn web development
the Assessment or further help section at the bottom of this page. Other controls 1 In our first "other controls" assessment, we'll get you to create a multi-line text input. Create a basic multi-line text input. Associate it semantically with the provided "Comment" label. Give the input 35 columns, and 10 rows of space in which to add comments. Give the comments a maximum length of 100
characters. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Other controls 2 Now it's time to have a go at implementing a drop-down select menu, to allow a user to pick their favourite food from the choices provided. Create your basic select box structure. Associate it semantica...
...n an online editor. Other controls 3 In our final task of this set, we start with much the same list of food choices. However, this time we want to do things differently: Create a basic text input that is semantically associated with the provided label. Put the food choices into a list that can be associated with a form input. Associate the list with your text input, so that when you type
characters, any of the list options that match the
character sequence are given in a dropdown list as autocomplete suggestions. Try updating the live code below to recreate the finished example: 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 above. If you would ...
Dealing with files - Learn web development
on your website at, test-site/MyImage.jpg and then in a different file you try to invoke the image as test-site/myimage.jpg, it may not work. Browsers, web servers, and programming languages do not handle spaces consistently. For example, if you use spaces in your filename, some systems may treat the filename as two filenames. Some servers will replace the areas in your filenames with "%20" (the
character code for spaces in URIs), resulting in all your links being broken. It's better to separate words with dashes, rather than underscores: my-file.html vs. my_file.html. The short answer is that you should use a hyphen for your file names. The Google search engine treats a hyphen as a word separator but does not regard an underscore that way. For these reasons, it is best to get into the habi...
...nd make it display the image you chose in the article "What will your website look like?" Copy the image you chose earlier into your images folder. Open up your index.html file, and insert the following code into the file exactly as shown. Don't worry about what it all means for now -- we'll look at the structures in more detail later in the series. <!DOCTYPE html> <html> <head> <meta
charset="utf-8"> <title>My test page</title> </head> <body> <img src="" alt="My test image"> </body> </html> The line <img src="" alt="My test image"> is the HTML code that inserts an image into the page. We need to tell the HTML where the image is. The image is inside the images directory, which is in the same directory as index.html. To walk down the file structure from index.html ...
Images in HTML - Learn web development
what the effect is. Set a title on the image. If you make a mistake, you can always reset it using the Reset button. ...
...side a <figcaption> element below the image. If you make a mistake, you can always reset it using the Reset button. ...
Making decisions in your code — conditionals - Learn web development
y</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <h1></h1> <ul></ul> </div> <h2>Editable code</h2> <p class="a11y-label">Press Esc to move focus away from the code area (Tab inserts a tab
character).</p> <textarea id="code" class="playable-code" style="height: 400px;width: 95%"> const select = document.querySelector('select'); const list = document.querySelector('ul'); const h1 = document.querySelector('h1'); select.onchange = function() { const choice = select.value; // ADD CONDITIONAL HERE createCalendar(days, choice); } function createCalendar(days, choice) { list.inner...
...ect id="theme"> <option value="white">White</option> <option value="black">Black</option> <option value="purple">Purple</option> <option value="yellow">Yellow</option> <option value="psychedelic">Psychedelic</option> </select> <h1>This is my website</h1> </div> <h2>Editable code</h2> <p class="a11y-label">Press Esc to move focus away from the code area (Tab inserts a tab
character).</p> <textarea id="code" class="playable-code" style="height: 450px;width: 95%"> const select = document.querySelector('select'); const html = document.querySelector('.output'); select.onchange = function() { const choice = select.value; // ADD SWITCH STATEMENT } function update(bgColor, textColor) { html.style.backgroundColor = bgColor; html.style.color = textColor; }</textarea...
Video and Audio APIs - Learn web development
ydings_controls-webfont.ttf') format('truetype'); font-weight: normal; font-style: normal; } button:before { font-family: HeydingsControlsRegular; font-size: 20px; position: relative; content: attr(data-icon); color: #aaa; text-shadow: 1px 1px 0px black; } First of all, at the top of the CSS we use a @font-face block to import a custom web font. This is an icon font -- all the
characters of the alphabet equate to common icons you might want to use in an application. Next we use generated content to display an icon on each button: We use the ::before selector to display the content before each <button> element. We use the content property to set the content to be displayed in each case to be equal to the contents of the data-icon attribute. In the case of our play butto...
...ber of minutes and seconds in the HTMLMediaElement.currentTime value. Then we initialize two more variables -- minuteValue and secondValue. The two if statements work out whether the number of minutes and seconds are less than 10. If so, they add a leading zero to the values, in the same way that a digital clock display works. The actual time value to display is set as minuteValue plus a colon
character plus secondValue. The Node.textContent value of the timer is set to the time value, so it displays in the UI. The length we should set the inner <div> to is worked out by first working out the width of the outer <div> (any element's clientWidth property will contain its length), and then multiplying it by the HTMLMediaElement.currentTime divided by the total HTMLMediaElement.duration of th...
What went wrong? Troubleshooting JavaScript - Learn web development
ypeError: guessSubmit.addeventListener is not a function" A "Learn More" link that links through to an MDN page that explains what this error means in greater detail. The name of the JavaScript file, which links through to the Debugger tab of the developer tools. If you follow this link, you'll see the exact line where the error is highlighted. The line number where the error is, and the
character number in that line where the error is first seen. In this case, we've got line 86,
character number 3. If we look at line 86 in our code editor, we'll find this line: guessSubmit.addeventListener('click', checkGuess); The error message says "guessSubmit.addeventListener is not a function", which means that the function we're calling is not recognized by the JavaScript interpreter...
...tion or conditional structure. We got this error by deleting one of the closing curly braces near the bottom of the checkGuess() function. SyntaxError: expected expression, got 'string' or SyntaxError: unterminated string literal These errors generally mean that you've left off a string value's opening or closing quote mark. In the first error above, string would be replaced with the unexpected
character(s) that the browser found instead of a quote mark at the start of a string. The second error means that the string has not been ended with a quote mark. For all of these errors, think about how we tackled the examples we looked at in the walkthrough. When an error arises, look at the line number you are given, go to that line and see if you can spot what's wrong. Bear in mind that the error...
Solve common problems in your JavaScript code - Learn web development
o basic math in JavaScript? What is operator precedence, and how is it handled in JavaScript? How do you increment and decrement values in JavaScript? How do you compare values in JavaScript? (e.g. to see which one is bigger, or to see if one value is equal to another). ...
...compare values in JavaScript? (e.g. to see which one is bigger, or to see if one value is equal to another). ...
Multimedia: Images - Learn web development
wser vendors are working on a native lazyload attribute that is currently in the experimental phase. ...
...Both formats support transparency. PNGs can be saved with three different output combinations: 24 bit color + 8 bit transparency -- offer full color acurracy and smooth transparencies at the expense of size. You probably want to avoid this combination in favor for WebP (see below). ...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
opensas/mdn-svelte-tutorial/05-advanced-concepts Remember to run npm install && npm run dev to start your app in development mode. REPL To code along with us using the REPL, start at https://svelte.dev/repl/76cc90c43a37452e8c7f70521f88b698?version=3.23.2 Working on the MoreActions component Now we'll tackle the Check All and Remove Completed buttons. Let's create a component that will be in
charge of displaying the buttons and emitting the corresponding events. Create a new file -- components/MoreActions.svelte. When the first button is clicked, we'll emit a checkAll event to signal that all the todos should be checked/unchecked. When the second button is clicked, we'll emit a removeCompleted event to signal that all of the completed todos should be removed. Put the following...
...ocus', onFocus) // this will be executed when the node is removed from the DOM } } } Now we need to tell the <input> to use that function with the use:action directive: <input use:selectOnFocus /> With this directive we are telling Svelte to run this function, passing the DOM node of the <input> as a parameter, as soon as the component is mounted on the DOM. It will also be in
charge of executing the destroy function when the component is removed from DOM. So, with the use directive, Svelte takes care of the component's lifecycle for us. In our case, our <input> would end up like so -- update the component's first label/input pair (inside the edit template) like so: <label for="todo-{todo.id}" class="todo-label">New name for '{todo.name}'</label> <input bind:value={na...
Working with Svelte stores - Learn web development
ctivity syntactic sugar for free. Creating the Alert component To show how to work with stores, we will create an Alert component. These kind of widgets might also be known as popup notifications, toast, or notification bubbles. Our Alert component will displayed by the App component, but any component can send notifications to it; whenever a notification arrives the Alert component will be in
charge of displaying it on screen. Creating a store Let's start by creating a writable store. Any component will be able to write to this store, and the Alert component will subscribe to it and display a message whenever the store is modified. Create a new file -- stores.js -- inside your src directory. Give it the following content: import { writable } from 'svelte/store' export con...
...to the alert store, update $alert whenever the store's content is modified, and unsubscribe when the component is unmounted. It will also generate the alert.set(...) statements whenever we assign a value to $alert. The end result of this nifty trick is that you can access global stores just as easily as using reactive local variables. This is a perfect example of how Svelte puts the compiler in
charge of better developer ergonomics, not only saving us from typing boiler plate, but also generating less error-prone code. Writing to our store Writing to our store is just a matter of importing it and executing $store = 'new value'. Let's use it in our Todos component. Add the following import statement below the existing ones: import { alert } from '../stores.js' Update your add...
Package management basics - Learn web development
x.js file to work with, but otherwise it is very unopinionated about how you structure your project. Other tools can be very different, but at least Parcel makes it easy for our initial experiment. So now we need to add an index.html file to our working directory. Create index.html in your test directory, and give it the following contents: <!DOCTYPE html> <html lang="en-US"> <head> <meta
charset="utf-8"> <title>My test page</title> </head> <body> <script src="./index.js"></script> </body> </html> Next, we need to add an index.js file in the same directory as index.html. For now index.js can be empty; it just needs to exist. Create this now. Having fun with Parcel Now we'll run our newly installed Parcel tool. In your terminal, run the following command: parcel index...
...t 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 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 wa...
Mozilla accessibility architecture
nology. Accessibility APIs on each operating system have built-in assumptions about what is the most important information, and how an accessibility server like Mozilla should use the API's programmatic interfaces to expose this information to an accessibility client (the assistive technology). Each platform's accessibility API has made different assumptions, although there are a number of common
characteristics. For example, they all expose an accessible name, or text representation, of each object, and they all use an enumerated integer value from a finite list, to expose the role of an object. Examples of accessible role constants are ROLE_BUTTON, ROLE_CHECKBOX and ROLE_LIST, although they can have slightly different names and values in each API. In general, the accessibility APIs use simil...
... numbers listed in nsIAccessibleEventReceiver.idl. The accessibility client can find out what kind of event occurred as well as what accessible node the event occured on. Table of Gecko Event to Accessible Event Translation Accessible documents listen for DOM events on nodes within them, and consequently fire the appropriate accessible event. This happens in the HandleEvent() method. Note: this
chart is not complete, consult the HandleEvent() method to see the rest. Gecko Events (or callback) Event Type Accessibility Event focus, select Standard HTML DOM event EVENT_FOCUS DOMMenuItemActive, DOMMenuBarActive Mozilla DOM EVENT_FOCUS DOMNodeInserted W3C DOM Mutation event EVENT_C...
Accessibility information for UI designers and developers
this ratio is easiest done with a tool, for example Lea Verou's Contrast Ratio. There are also plug-ins available for design software, like Stark for Sketch. Don't rely on color alone When your interface uses color to distinguish between things, make sure the distinction is also made in other ways. For example, add text labels or texture in addition to color differences. For example, in this
chart, it helps to add labels besides the colored
chart lines:People who cannot see the difference between the colors, can use the labels instead. Or in this one, you could consider using patterns besides colored areas: Again, if people are unable to distinguish the colors, they can rely on the patterns instead. See also: Understanding SC 1.4.3: Contrast The focus indicator Users who navigate b...
...sers can change submissions, automatically check for errors. Or provide an opportunity to review the input before submitting it. Use default controls Controls that are built into browsers come with a lot of accessibility for free. For example, the select element displays an ideal mobile interface on mobile operating systems like Android and iOS. On desktop with a keyboard, it lets people type a
character, say 'K', to jump directly to options starting with 'K'. It is recommended to use native controls, visibly or under the hood. Links vs buttons To keep your interface in line with user expectations, use links for interactions that go somewhere (on the current page or another page) and buttons for interactions that do something (like submit a form or open an overlay). Links can be styled as...
Eclipse CDT Manual Setup
lthough there is a project that promises to add Objective-C support), so for now, this is the best we can do to give Eclipse a chance of expanding its understanding of the source into the Objective-C files. Select "General > Editors > Text Editors". If you want line numbers, tick "Show line numbers". If you want a column marker to mark the 80th column to help with formatting code to Mozilla's 80
character line limit, tick "Show print margin" and set the value to 80. Select "General > Workspace" and select "Refresh using native hooks or polling" and "Refresh on access" to prevent Eclipse giving you annoying "Resource is out of sync" messages when files change from under it due to Mercurial or other external activity. Select "C/C++ > Build > Console" and set "Limit console output (number of l...
...o tweak those settings if you'll be editing other file types in Eclipse.) Select "C/C++ > Editor" and set "Workspace default" to "Doxygen". Select "C/C++ > Editor > Content Assist" and set the Auto-Activation delay to 0 so that autocomplete suggestions don't seem to be laggy. (Sadly, there is no auto-activation option to activate autocomplete suggestion., so as soon as you type any alphabetical
character that may begin with a symbol name like there is in other IDEs.) Select "C/C++ > Editor > Save Actions" and deselect "Ensure newline at the end of file". Select "C/C++ > Editor > Scalability" and set "Enable scalability mode when the number of lines in the file is more than:" to something larger, like 100000. Select "Run/Debug > Console" and deselect "Limit console output". If you want to...
Obsolete Build Caveats and Tips
se who need to work with the code for Firefox 3/Mozilla 1.9 and earlier can check out the latest source using CVS. In reality, you should probably not need to do this, since that code is very obsolete. This note below seems redundant as this is true by default https://msdn.microsoft.com/en-us/library/dh8che7s%28v=vs.110%29.aspx Note: Starting with Gecko 7.0, you should no longer include "-Zc:w
char_t-" in the command line when building on Windows. If you're using Visual Studio, go to Project Properties > C/C++ > Language > Treat w
char_t as Built-in Type and set it to "yes". From Source_Code/Mercurial mozilla-2.0 (Firefox 4.0) Code for the Firefox 4.0 (Gecko 2.0) release lives in releases/mozilla-2.0. To get this code, do the following: # Pull the Mozilla source to the folder 20src/ -...
...by editing c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat manually"). SDKs older than the Server 2003 R2 Platform SDK aren't supported either. From Windows build prerequisites [en-US] Microsoft Visual C++ (MSVC) Depending on what you're building, you will need to use one of several available versions of Microsoft Visual C++ (MSVC) and/or Microsoft Visual Studio. See the
chart at the top of this page to ensure that the version you've selected is compatible with the branch you want to build. If you want to enable jemalloc, you must be using Visual Studio 2012, Visual Studio 2010 SP1, Visual Studio 2010, Visual Studio 2008 SP1, or Visual Studio 2005 SP1. Other versions of Visual Studio will not work. Visual Studio 2017a> is available free from Microsoft. V...
Experimental features in Firefox
Read Preloading content with rel="preload" for more details. For more details on the status of this feature, see bug 1639607. Release channel Version added Enabled by default? Nightly 78 Yes Developer Edition 78 Yes Beta 78 Yes Release 78 No Preference name network.preload CSS Display stray control
characters in CSS as hex boxes This feature renders control
characters (Unicode category Cc) other than tab (U+0009), line feed (U+000A), form feed (U+000C), and carriage return (U+000D) as a hexbox when they are not expected. See bug 1099557 for more details. Release channel Version added Enabled by default? Nightly 43 Yes Developer Edition 43 No ...
...ab (U+0009), line feed (U+000A), form feed (U+000C), and carriage return (U+000D) as a hexbox when they are not expected. See bug 1099557 for more details. Release channel Version added Enabled by default? Nightly 43 Yes Developer Edition 43 No Beta 43 No Release 43 No Preference name layout.css.control-
characters.enabled or layout.css.control-
characters.visible Property: initial-letter The initial-letter CSS property is part of the CSS Inline Layout specification and allows you to specify how dropped, raised, and sunken initial letters are displayed. See bug 1223880 for more details. Release channel Version added Enabled by default? Nightly 50 No ...
CustomizableUI.jsm
r object that will get fired for various events regarding customization. Parameters aListener the listener object to add removeListener() Remove a listener added with addListener. Parameters aListener the listener object to remove registerArea() Register a customizable area with CustomizableUI. Parameters aAreaId The name of the area to register. Can only contain alphanumeric
characters, dashes (-) and underscores (_). aProperties The properties of the area. The following properties are recognized: Property Description type The type of area. Either TYPE_TOOLBAR (default) or TYPE_MENU_PANEL. anchor For a menu panel or overflowable toolbar, the anchoring node for the panel. legacy Set to true if you want Cust...
...AND_dom[cui-areatype="menu-panel"],'; css += ' toolbarpaletteitem[place="palette"] > #id_of_my_widget_within_customizableui_AND_dom {'; css += ' list-style-image: url("chrome://branding/content/icon32.png");'; //a 32px x 32px icon for when in toolbar css += ' }'; css += '}'; var cssEnc = encodeURIComponent(css); var newURIParam = { aURL: 'data:text/css,' + cssEnc, aOrigin
Charset: null, aBaseURI: null } var cssUri = Services.io.newURI(newURIParam.aURL, newURIParam.aOrigin
Charset, newURIParam.aBaseURI); //store this in a global var so you can call it when removing the widget sss.loadAndRegisterSheet(cssUri, sss.AUTHOR_SHEET); /**************/ // When you want to remove this widget run this code: // sss.unregisterSheet(cssUri, sss.AUTHOR_SHEET); //remove the style s...
Interfacing with the Add-on Repository
t included by default; see bug 628785. ...
...this when your extension starts up: var prefsService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); var prefBranch = prefsService.getBranch("extensions."); var recUrl = ""; try { recUrl = prefBranch.get
CharPref("getAddons.recommended.url"); } catch(e) { recurl = ""; } if (recUrl == "") { prefBranch.set
CharPref("getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/list/recommended/all/%MAX_RESULTS%/%OS%/%VERSION%?src=firefox"); prefsService.savePrefFile(null); } This fetches the value of the extensions.getAddons.recommended.url preference, and, if the preference doesn't exist or has no value, sets the value of the preference to the...
What every Mozilla translator should know
community are at least notified here. Translate the Mozilla web or mozilla.dev.l10n.web, we moved announcements and discussions about the translation of the Mozilla web pages to this group. All these groups are pretty low traffic. To keep the track of what's going on, it's also a good idea to read the Planet Mozilla L10N When you have a problem Use the above mailing lists The person in
charge of the Mozilla l10n is Axel Hecht (l10n at mozilla.com), Pike on IRC Another interesting way of getting help is the IRC channel #l10n at irc.mozilla.org Useful Tools The L10n Dashboard Pontoon Narro Translate Toolkit Koala 0.1 MozillaTranslator Mercurial The hg is organized into several repositories, sometimes called branches. We have the main repository called mozilla-central (or...
... look into other languages translations. Bugzilla, the bug-tracking system You do need an account in Bugzilla You should configure the account to Watch the following addresses: firefoxl10n@hotmail.com calendar-l10n@mozilla.bugs (specific for calendar related bugs) This way you will receive mail for bugs affecting many or even all locales. When you create a bug, if you want the person in
charge of the l10n to follow up your bug you should CC: l10n@mozilla.com If you choose to make changes to your localization, you should make the changes local to your disk, push them to your Hg repository on Merucial, test the changes on a nightly/tinderbox build, fix any errors if some are found and test again, and send the new changeset ID as your "opt-in" revisions to the l10-drivers. There is on...
MathML3Testsuite
olds for obsolete features (such as macro, mode etc) or for other undefined behaviors (attribute href for example). Note that in general, comparing with the "Sample Rendering" is not enough to conclude on the success/failure of the test. So please do not edit these pages if you are not able to explain Gecko's rendering. However, any report is welcome on the Tracking bug for the MathML testsuite. ...
...'s rendering. However, any report is welcome on the Tracking bug for the MathML testsuite.
Characters Blocks Symbols Variants EntityNames NumericRefs UTF8 General Clipboard GenAttribs Math Presentation CSS DynamicExpressions GeneralLayout ScriptsAndLimits TablesAndMatrices TokenElements Topics Accents BiDI ElementaryMathExamples EmbellishedOp LargeOp LineBreak Nesting Stretchy
Chars WhiteSpace TortureTests ErrorHandling Original Document Information Author(s): Frederic Wang Other Contributors: Last Updated Date: May 26, 2010 Copyright Information: Portions of this content are (C) 2010 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Introduction to NSPR
Each thread is an execution entity that is scheduled independently from other threads in the same process. A thread has a limited number of resources that it truly owns. These resources include the thread s...
...Each thread is an execution entity that is scheduled independently from other threads in the same process. A thread has a limited number of resources that it truly owns. These resources include the thread stack and the CPU register set (including ...
PR_FreeLibraryName
Returns Nothing. Description This function deletes the storage allocated by the runtime in the functions described previously. ...
... Returns Nothing. Description This function deletes the storage allocated by the runtime in the functions described previously. ...
PR GetAddrInfoByName
af The address family. May be PR_AF_UNSPEC or PR_AF_INET. flags May be either PR_AI_ADDRCONFIG or PR_AI_ADDRCONFIG | PR_AI_NOCANONNAME. ...
... af The address family. May be PR_AF_UNSPEC or PR_AF_INET. flags May be either PR_AI_ADDRCONFIG or PR_AI_ADDRCONFIG | PR_AI_NOCANONNAME. ...
PR_GetLibraryName
In case of error, returns NULL. Description This function constructs a full path name from the specified directory name and library name. The constructed path name refers to the actual dynamically loaded library. It is suitable for use in the PR_LoadLibrary call. ...
...In case of error, returns NULL. Description This function constructs a full path name from the specified directory name and library name. The constructed path name refers to the actual dynamically loaded library. It is suitable for use in the PR_LoadLibrary call. ...
PR_GetProtoByName
buffer A pointer to a scratch buffer for the runtime to return result. This buffer is allocated by the caller. bufsize Number of bytes in the buffer parameter. The buffer must be at least PR_NETDB_BUF_SIZE bytes. result On input, a pointer to a PRProtoEnt structure. ...
... buffer A pointer to a scratch buffer for the runtime to return result. This buffer is allocated by the caller. bufsize Number of bytes in the buffer parameter. The buffer must be at least PR_NETDB_BUF_SIZE bytes. result On input, a pointer to a PRProtoEnt structure. ...
PR_SetErrorText
text The text to associate with the error. Description The text is copied into the thread structure and remains there until the next call to PR_SetError. ...
... text The text to associate with the error. Description The text is copied into the thread structure and remains there until the next call to PR_SetError. If there is error text already present in the thread, the previous value is first deleted. ...
PR_strtod
Converts the prefix of a decimal string to the nearest double-precision floating point number. Syntax #include <prdtoa.h> PRFloat64 PR_strtod(const
char *s00,
char **se); Parameters The function has these parameters: s00 The input string to be scanned. se A pointer that, if not NULL, will be assigned the address of the last
character scanned in the input string. Returns The result of the conversion is a PRFloat64 value equivalent to the input string. If the parameter se is not NULL the location it references is also set. Description PR_strtod converts the prefix of the input decimal string pointed to by s00 to a nearest double-precision floating point number. Ties are broken by the IEEE round-even rule. The string is scanned up to the first unrecognized
character. If the valu...
... a PRFloat64 value equivalent to the input string. If the parameter se is not NULL the location it references is also set. Description PR_strtod converts the prefix of the input decimal string pointed to by s00 to a nearest double-precision floating point number. Ties are broken by the 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 Certificate Download Specification
must be exactly ONE item of any of the supported binary formats described above, and that one item must be base64 encoded. Regardless of which of the supported binary formats is used, the BEGIN and END lines must say CERTIFICATE, and not any other word (such as KEY). The BEGIN and END lines must begin and end with 5 dashes, with no extra leading or trailing white space (excluding the End Of Line
characters). Importing Certificate Chains Several of the formats described above can contain several certificates. When NSS's certificate decoder encounters one of these collections of multiple certificates they are handled in the following way: The first certificate is processed in a context specific manner, depending upon how it is being imported. For Mozilla browsers, this handling will depend...
...certificates will be added as untrusted CA certificates to the local database. This is intended to allow people or CAs to post their e-mail certificates on web pages for download by other users who want to send them encrypted mail. Note: the browser checks that the size of the object being downloaded matches the size of the encoded certificates. Therefore it is important to ensure that no extra
characters, such as NULLs or LineFeeds are added at the end of the object. Importing Certificates into NSS-based servers Consult your server's administration guide for the most accurate information. For some NSS-base servers, the following information is correct. Server certificates are imported via the server admin interface. Certificates are pasted into a text input field in an HTML form, and the...
NSS Sample Code sample5
LzpZiekW1biysW3Pag1TPItTMMdl1v6T//x1xPcgA7NRSLdHZ4wIDAQABAkEAjh8+4qncwcmGivnM6ytbpQT+k/jEOeXG2bQhjojvnXN3FazGCEFXvpuIBcJVfaIJS9YBCMOzzrAtO0+k2hWnOQIhAOC4NVbo8FQhZS4yXM1M86kMl47FA9ui//OUfbhlAdw1AiEA2DBmIXnsboKB+OHver69p0gNeWlvcJc9bjDVfdLVsLcCIQCPtV3vGYJv2vdwxqZQaHC+YB4gIGAqOqBCbmjD3lyFLQIgA+VTYdUNoqwtZWvE4gRf7IzK2V5CCNhg3gR5RGwxN58CIGCcafoRrUKsM66ISg0ITI04G9V/w+wMx91wjEEB+QBz" int main(int argc,
char **argv) { SECStatus rv; CERTCertificate *cert = NULL; SECKEYPublicKey *pubkey = NULL; CERTSubjectPublicKeyInfo *spki = NULL; SECKEYPrivateKey *pvtkey = NULL; int modulus_len, i, outlen;
char *buf1 = NULL;
char *buf2 = NULL;
char *pubkstr = BASE64_ENCODED_SUBJECTPUBLICKEYINFO;
char *pvtkstr = BASE6...
...to cleanup; } spki = SECKEY_DecodeDERSubjectPublicKeyInfo(&der); SECITEM_FreeItem(&der, PR_FALSE); pubkey = SECKEY_ExtractPublicKey(spki); if (pubkey == NULL) { fprintf(stderr, "Couldn't extract public key (err %d)\n", PR_GetError()); goto cleanup; } modulus_len = SECKEY_PublicKeyStrength(pubkey); fprintf(stderr, "Public Key Modulus %d bytes\n", modulus_len); buf1 = (
char *)malloc(modulus_len); buf2 = (
char *)malloc(modulus_len); /* initialize buf1 */ for (i=0;i<modulus_len;i++) { buf1[i]= (i %26) + 'A'; } buf1[modulus_len-1] = '\0'; fprintf(stderr, "Buffer being encrypted = \n%s\n", buf1); /* encrypt buf1, result will be in buf2 */ rv = PK11_PubEncryptRaw(pubkey, buf2, buf1, modulus_len, NULL); if (rv != SECSuccess) { fprintf(stder...
NSS Sample Code sample6
nce of bytes. this example happens to use an * integer */ void genkey(int id); /* this callback is responsible for returning the password to the NSS * key database. for example purposes, this function hardcodes the password. * In a real app, this function should obtain the password using secure means * such as prompting an operator, or retrieving it over a secure communication * channel */
char *passwdcb(PK11SlotInfo *info, PRBool retry, void *arg); int main(int argc,
char **argv) { SECStatus rv; /* Initialize NSS */ PK11_SetPasswordFunc(passwdcb); /* The NSS db must be initialized read-write since we'll be creating * keys in it. Once keys are generated, it can be opened without read-write * subsequently (NSS_Init). */ rv = NSS_InitReadWrite("."); if (rv != SECS...
...rr, "PK11_FindFixedKey failed (err %d)\n", PR_GetError()); PK11_FreeSlot(slot); return; } fprintf(stderr, "Found key!\n"); fprintf(stderr, "key length of generated key is %d\n", PK11_GetKeyLength(key)); fprintf(stderr, "mechanism of key is %d (asked for %d)\n", PK11_GetMechanism(key), cipherMech); PK11_FreeSymKey(key); PK11_FreeSlot(slot); }
char *passwdcb(PK11SlotInfo *info, PRBool retry, void *arg) { if (!retry) return PL_strdup("test"); else return NULL; } ...
FC_InitPIN
pPin[Input] Pointer to the PIN being set. ulPinLen [Input] Length of the PIN. Description FC_InitPIN() initializes the normal user's PIN. FC_InitPIN() must be called when the PKCS #11 Security Officer (SO) is logged into the token and the session is read/write, that is, the session must be in the "R/W SO Functions" state (CKS_RW_SO_FUNCTIONS). ...
...llows the PKCS #11 SO to 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 ...
NSS_Initialize
To-do: document the "sql:" prefix. certPrefix [in] prefix added to the beginning of the certificate database, for example, "https-server1-". keyPrefix [in] prefix added to the beginning of the key database, for example, "https-server1-". ...
...by both NSS and the Java SunPKCS11 provider. This should occur after a new flag is defined for C_Initialize by the PKCS#11 working group. ...
JSAPI Cookbook
de currently at the top of the stack. This is usually the line of code that called your native function, so it's usually what you want. ...
...op of the stack. This is usually the line of code that called your native function, so it's usually what you want. ...
JS::Call
This article covers features introduced in SpiderMonkey 17 Call a specified JS function. ...
...a request on this JSContext. thisObj JS::HandleObject / JS::HandleValue The "current" object on which the function operates; the object specified here is "this" when the function executes. fun / funObj JS::HandleFunction / JS::HandleValue / JS::HandleObject Pointer to the function to call. Should be a native function or JSAPI-compiled function. name const
char * Pointer to the function name to call. args JS::HandleValueArray & Arguments to pass to the function. rval JS::MutableHandleValue Out parameter. On success, *rval receives the return value from the function call. Description JS::Call calls a specified function, fun, on an object, thisObj. In terms of function execution, the object is treated as this. ...
JS::PropertySpecNameToPermanentId
idp jsid * Out parameter. Receives the created id. ...
... idp jsid * Out parameter. Receives the created id. Description JS::PropertySpecNameToPermanentId creates a jsid that does not need to be marked for GC from JSPropertySpec::name or JSFunctionSpec::name. ...
JSClass
A JSClass describes a class of JavaScript objects. A C/C++ program can use a JSClass with the JS_InitClass and JS_NewObject APIs to create objects that have custom methods and properties implemented in C/C++. ...
...This field is the bitwise OR of one or more of the JSCLASS_* constants described in JSClass.flags. addProperty JSPropertyOp A hook called just after adding a new property. May modify the new property value. Use NULL or JS_PropertyStub (SpiderMonkey 31 or older) for default behavior. delProperty JSD...
JSErrorFormatString
argCount uint16_t The number of arguments to expand in the formatted error message. exnType int16_t One of the JSExnType constants. ...
... argCount uint16_t The number of arguments to expand in the formatted error message. exnType int16_t One of the JSExnType constants. ...
JSString
You should not rely on the structure of JSString, because it is subject to change; instead, treat JSString objects as opaque. ...
...You should not rely on the structure of JSString, because it is subject to change; instead, treat JSString objects as opaque. ...
JS_AddArgumentFormatter
Obsolete since JSAPI 18This 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. Add or remove a format string handler for JS_ConvertArguments, JS_PushArguments, JS_ConvertArgumentsVA, and JS_PushArgumentsVA. Syntax JSBool JS_AddArgumentFormatter(JSContext *cx, const
char *format, JSArgumentFormatter formatter); void JS_RemoveArgumentFormatter(JSContext *cx, const
char *format); Name Type Description cx JSContext * The context in which to install the formatter. format const
char * The format string prefix that should be handled by formatter, or whose handler should be removed. formatter JSArgumentFormatter T...
...rgumentFormatter does not copy format, it points at the string storage allocated by the caller, which is typically a string constant. If format is in dynamic storage, the caller must keep the string alive until JS_RemoveArgumentFormatter is called. JS_RemoveArgumentFormatter removes any conversion functions associated with format. Callback Syntax JSBool (*JSArgumentFormatter)(JSContext *cx, const
char *format, JSBool fromJS, jsval **vpp, va_list *app); Name Type Description cx JSContext * The context in which the conversion is being performed. format const
char * The tail of the format string whose prefix is associated with this formatting function. fromJS JSBool JS_TRUE if the conversion function should conver...
JS_AddExternalStringFinalizer
zer may use for certain very limited operations (not documented). Since the JSStringFinalizeOp callback is called during garbage collection, it must avoid most JSAPI functions. (Is cx guaranteed to be non-NULL?) str JSString * The string being finalized. This is always a string that the application previously created by calling JS_NewExternalString. The callback may use JS_GetString
Chars(str) to get a pointer to the
character buffer, which is the pointer which the application passed to JS_NewExternalString() when creating the string. It is the callback's responsibility to free the memory. After this callback, the JS engine will not use that memory anymore and will not keep a pointer to it. The callback may not keep a reference to this JSString, as its memory is about to be f...
... the JS engine will not use that memory anymore and will not keep a pointer to it. The callback may not keep a reference to this JSString, as its memory is about to be freed. Description Add a finalizer for external strings created by JS_NewExternalString using a type-code returned from this function, and that understands how to free or release the memory pointed at by JS_GetString
Chars(str). Returns a nonnegative type index if there is room for finalizer in the global GC finalizers table, else returns -1. In a JS_THREADSAFE build, this function must be invoked on the primordial thread only, at startup--or else the entire program must single-thread itself while loading a module that calls this function. To remove an external string finalizer, use JS_RemoveExternalStringFinali...
JS_Add*Root
hing the root points at from garbage collection. These functions are obsoleted, use JS::PersistentRooted instead. Syntax JSBool JS_AddValueRoot(JSContext *cx, jsval *vp); JSBool JS_AddStringRoot(JSContext *cx, JSString **spp); JSBool JS_AddObjectRoot(JSContext *cx, JSObject **opp); JSBool JS_AddGCThingRoot(JSContext *cx, void **rp); JSBool JS_AddNamedValueRoot(JSContext *cx, jsval *vp, const
char *name); JSBool JS_AddNamedStringRoot(JSContext *cx, JSString **spp, const
char *name); JSBool JS_AddNamedObjectRoot(JSContext *cx, JSObject **opp, const
char *name); JSBool JS_AddNamedGCThingRoot(JSContext *cx, void **rp, const
char *name); Name Type Description cx JSContext * The context in which to add the new root. Requires request. In a JS_THREADSAFE build, the...
... Description The JS_Add*Root and functions add a C/C++ variable to the garbage collector's root set, the set of variables used as starting points each time the collector checks to see what memory is reachable. The garbage collector aggressively collects and recycles memory that it deems unreachable, so roots...
JS_AlreadyHasOwnProperty
This article covers features introduced in SpiderMonkey 1.8 Determine whether a property is already physically present on a JSObject. Syntax boo JS_AlreadyHasOwnProperty(JSContext *cx, JS::HandleObject obj, const
char *name, bool *foundp); boo JS_AlreadyHasOwnUCProperty(JSContext *cx, JS::HandleObject obj, const
char16_t *name, size_t namelen, bool *foundp); boo JS_AlreadyHasOwnPropertyById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *foundp); // Added in SpiderMonkey 1.8.1 boo JS_AlreadyHasOwnElement(JSContext *cx, JS::HandleObject obj, uint32_t index, bool *foundp); Name Type Description cx JSContext * Pointer to a JS context. Requ...
....8.1 boo JS_AlreadyHasOwnElement(JSContext *cx, JS::HandleObject obj, uint32_t index, bool *foundp); Name Type Description cx JSContext * Pointer to a JS context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The object to be searched. name or id const
char * or const
char16_t *or JS::HandleId (in JS_AlreadyHasOwnProperty, AlreadyHasOwnUCProperty, and JS_AlreadyHasOwnPropertyById) The name of the property to search for. namelen size_t (in JS_AlreadyHasOwnUCProperty only) The length of name, in
characters; or the special value (size_t) -1 to indicate that name is null-terminated. index uint32_t (in JS_AlreadyHasOwnEle...
JS_CStringsAreUTF8
Obsolete since JSAPI 19This 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. These functions have been removed in SpiderMonkey 19. API users should switch to functions which take UTF-8 explicitly or handle their own string encoding and decoding. Option to have the JSAPI treat
char strings as UTF-8. Syntax JSBool JS_CStringsAreUTF8(void); void JS_SetCStringsAreUTF8(void); // Added in SpiderMonkey 1.8 Description By default, all C/C++ strings passed into the JSAPI are treated as ISO/IEC 8859-1, also known as ISO-Latin-1. That is, each byte is treated as a Unicode
character, and there is no way to pass in a string containing
characters beyond U+00FF. However, SpiderMonkey can...
...o way to pass in a string containing
characters beyond U+00FF. However, SpiderMonkey can optionally interpret these strings as UTF-8. There are two ways to enable this: at compile time, by building SpiderMonkey with JS_C_STRINGS_ARE_UTF8 defined; or at run time, by calling JS_SetCStringsAreUTF8 before the first call to JS_NewRuntime. Enabling this option also causes JS_GetStringBytes and JS_Encode
Characters to produce UTF-8 strings instead of Latin-1. JS_CStringsAreUTF8 returns JS_TRUE if the JavaScript engine is configured (either at compile time or at run time) to interpret
char strings as UTF-8. See Also bug 805080 ...
JS_CompileUTF8FileHandle
Obsolete since JSAPI 19This 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. Compile a script, reading the source code from a stdio FILE. Syntax JSObject * JS_CompileUTF8FileHandle(JSContext *cx, JSObject *obj, const
char *filename, FILE *file); JSObject * JS_CompileUTF8FileHandleForPrincipals( JSContext *cx, JSObject *obj, const
char *filename, FILE *file, JSPrincipals *principals); Name Type Description cx JSContext * The context in which to compile the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object with which the script is associated. f...
...This filename is used for error messages. It should be the name of the file that contains the script, if available. file FILE * The file handle containing the script to compile. ...
JS_ConvertArgumentsVA
Obsolete since JSAPI 38This 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. Converts a series of JS values, passed in a va_list, to their corresponding JSAPI types. Syntax bool JS_ConvertArgumentsVA(JSContext *cx, const JS::CallArgs &args, const
char *format, va_list ap); bool JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const
char *format, va_list ap); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. args const JS::CallArg...
...THREADSAFE build, the caller must be in a request on this JSContext. args const JS::CallArgs & Reference to the arguments to convert. Added in SpiderMonkey 31 argc unsigned The number of arguments to convert. Obsolete since JSAPI 30 argv jsval * Pointer to the vector of arguments to convert. Obsolete since JSAPI 30 format const
char *
Character array containing the recognized format to which to convert. ap va_list The list of pointers into which to store the converted types. There should be one pointer for each converted value. The type va_list is a standard feature of the C programming language. It is defined in <stdarg.h>. Description JS_ConvertArgumentsVA is to JS_ConvertArguments as vprintf is t...
JS_DefinePropertyWithTinyId
Obsolete since JSAPI 30This 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 a new object property with a tiny id. Syntax JSBool JS_DefinePropertyWithTinyId( JSContext *cx, JSObject *obj, const
char *name, int8 tinyid, jsval value, JSPropertyOp getter, JSPropertyOp setter, unsigned int attrs); JSBool JS_DefineUCPropertyWithTinyId( JSContext *cx, JSObject *obj, const js
char *name, size_t namelen, int8 tinyid, jsval value, JSPropertyOp getter, JSPropertyOp setter, unsigned int attrs); Name Type Description cx JSContext * The context in which to define the property. Requires request. In a JS_THREADSAFE build, the caller must ...
...int8 tinyid, jsval value, JSPropertyOp getter, JSPropertyOp setter, unsigned int attrs); Name Type Description cx JSContext * The context in which to define the property. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object for which to create the new property. name const
char * or const js
char * Name for the property to create. namelen size_t (only in JS_DefineUCPropertyWithTinyId) The length of name in
characters; or (size_t) -1 to indicate that name is null-terminated. tinyid int8 8-bit ID to aid in sharing getter and setter callbacks among properties. value jsval Initial stored value for the new property. get...
JS_FS
in SpiderMonkey 31 #define JS_SELF_HOSTED_SYM_FN(symbol, selfHostedName, nargs, flags) ... // Added in SpiderMonkey 38 #define JS_SYM_FNSPEC(symbol, call, info, nargs, flags, selfHostedName) ... // Added in SpiderMonkey 38 #define JS_FNSPEC(name,call,info,nargs,flags,selfHostedName) ... // Added in SpiderMonkey 31 #define JS_FS_END ... Name Type Description name const
char * The JavaScript name for the function. (or index, if JSPROP_INDEX is present in flags) symbol a member name of JS::SymbolCode The JavaScript symbol for the function. call JSNative Pointer to the C/C++ implementation of the function. info const JSJitInfo * Pointer to the Jit Info. nargs uint16_t The number of arguments the function ex...
...ber name of JS::SymbolCode The JavaScript symbol for the function. call JSNative Pointer to the C/C++ implementation of the function. info const JSJitInfo * Pointer to the Jit Info. nargs uint16_t The number of arguments the function expects. flags uint16 The bitwise OR of any number of function flags. selfHostedName const
char * The function's name in Self-Hosted JavaScript code. Description Use these macros to define an array of JSFunctionSpecs to pass to JS_DefineFunctions or JS_InitClass. JS_FN (whose name pays homage to the old JSNative/JSFastNative split) simply adds the flag JSFUN_STUB_GSOPS. JS_FNINFO allows the simple adding of JSJitInfos. JS_SELF_HOSTED_FN declares a self-hosted function. Finally JS_F...
JS_GetProperty
Find a specified property and retrieve its value. Syntax bool JS_GetProperty(JSContext *cx, JS::HandleObject obj, const
char *name, JS::MutableHandleValue vp); bool JS_GetUCProperty(JSContext *cx, JS::HandleObject obj, const
char16_t *name, size_t namelen, JS::MutableHandleValue vp); bool JS_GetPropertyById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
...*cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object to search on for the property. name or id const
char * or const
char16_t * or JS::HandleId Name of the property to look up. namelen size_t (in JS_GetUCProperty only) The length of name, in
characters; or -1 to indicate that name is null-terminated. vp JS::MutableHandleValue Out parameter. On success, *vp receives the current value of the property, or undefined if no such property is found. Description JS_Get...
JS_GetPropertyDefault
Obsolete since JSAPI 26This 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. This article covers features introduced in SpiderMonkey 1.8.5 Finds a specified property and retrieves its value or provided default value. Syntax bool JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const
char *name, jsval def, JS::MutableHandle<JS::Value> vp); bool JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, JS::MutableHandle<JS::Value> vp); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
...yByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, JS::MutableHandle<JS::Value> vp); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object to search on for the property. name or id const
char * or JS::HandleId Name of the property to look up. def JS::HandleValue Default value if the property is not found. vp JS::MutableHandleValue Out parameter. On success, *vp receives the current value of the property, or undefined if no such property is found. Description JS_GetPropertyDefault examines a specified JS object obj and its prototype chain for a pr...
JS_HasProperty
Determine whether a JavaScript object has a specified property. Syntax bool JS_HasProperty(JSContext *cx, JS::HandleObject obj, const
char *name, bool *foundp); bool JS_HasUCProperty(JSContext *cx, JS::HandleObject obj, const
char16_t *name, size_t namelen, bool *vp); bool JS_HasPropertyById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *foundp); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
...yId(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *foundp); // Added in SpiderMonkey 1.8.1 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object to search on for the property. name or id const
char * or const
char16_t or JS::HandleId Name of the property to look up. namelen size_t (only in JS_HasUCProperty) The length of name in
characters, or -1 to indicate that name is null-terminated. foundp bool * Non-null pointer to a variable of type bool. On success, JS_HasProperty stores true in this variable if obj has a property with the given name, and false if no...
JS_InternString
Get an interned string - a JSString that is protected from GC and automatically shared with other code that needs a JSString with the same value. Syntax JSString * JS_InternString(JSContext *cx, const
char *s); JSString * JS_InternStringN(JSContext *cx, const
char *s, size_t length); JSString * JS_InternUCString(JSContext *cx, const
char16_t *s); JSString * JS_InternUCStringN(JSContext *cx, const
char16_t *s, size_t length); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. s const
char * or const
char16_t * Pointer to a
character array containing the data for the string. In JS_InternString and JS_InternUCString, the string must be null-terminated. ...
... Description JS_InternString and JS_InternStringN return an interned JavaScript string with a specified value, s. JS_InternUCString and JS_InternUCStringN are the Unicode versions of the function. Each JSRuntime keeps a table of all existing interned strings. ...
JS_IsIdentifier
This article covers features introduced in SpiderMonkey 17 Test whether the given string is a valid ECMAScript identifier. Syntax bool JS_IsIdentifier(JSContext *cx, JS::HandleString str, bool *isIdentifier); bool JS_IsIdentifier(const
char16_t *
chars, size_t length); // Added in SpiderMonkey 38 Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JS::HandleString The string to test.
chars const
char16_t * The pointer of the string to test. length size_t The length of
chars. isIdentifier bool * Out parameter. On success, *isIdentifier receives ...
... isIdentifier bool * Out parameter. On success, *isIdentifier receives whether str is an identifier or not. Description JS_IsIdentifier tests if the given string is a valid ECMAScript identifier. On successful, JS_IsIdentifier stores the test result to *isIdentifier and returns true, otherwise returns false and the value of *isIdentifier is undefined. JS_IsIdentifier which takes
chars and length is infallible, so just returns whether the
chars are an identifier. See Also MXR ID Search for JS_IsIdentifier JS_ValueToId bug 692627 bug 990484 ...
JS_NewDependentString
Create a new JavaScript string containing a range of
characters from an existing string. 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. Description JS_NewDependentString creates a new string as a substring of an existing JavaScript string, str. The new string contains the same c...
...haracters for the new string. start size_t The start index of the substring. length size_t Length of the substring, in
characters. Description JS_NewDependentString creates a new string as a substring of an existing JavaScript string, str. The new string contains the same
characters as if it were created with the JavaScript method str.substr(start, length). The
characters are not copied. Instead, the new string shares str's existing
character storage. (Implementation note: Because of this sharing, the garbage collector will not collect str as long as the new substring is reachable.) On success, JS_NewDependentString returns a pointer to the new string. Otherwise it returns NULL. See Also MXR ID Search for JS_NewDependentString ...
JS_NewStringCopyN
Create a new JS string. Syntax JSString * JS_NewStringCopyN(JSContext *cx, const
char *s, size_t n); JSString * JS_NewUCStringCopyN(JSContext *cx, const
char16_t *s, size_t n); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. s const
char* or const
char16_t * Pointer to the array of
characters containing the text for the JS string to create. n size_t Number of
characters to copy from s into the new string. Description JS_NewStringCopyN allocates space for a JavaScript string and its underlying storage, and copies n
characters from a C
character array, s, into the new JSString. ...
... for the JS string to create. n size_t Number of
characters to copy from s into the new string. Description JS_NewStringCopyN allocates space for a JavaScript string and its underlying storage, and copies n
characters from a C
character array, s, into the new JSString. JS_NewUCStringCopyN is the Unicode version of the function. The two functions differ only in the type of the
character array s; both functions create ordinary JavaScript strings, and all JavaScript strings are made up of 16-bit
characters. If the array s contains more than n
characters, the new string contains a truncated version of the original string. The string may contain null
characters ('\0'). They are copied into the new string like any other
character. You can use JS_NewStringCopyN to copy binary dat...
JS_ParseJSON
This article covers features introduced in SpiderMonkey 1.8.6 Parse a string using the JSON syntax described in ECMAScript 5 and return the corresponding value. Syntax JSBool JS_ParseJSON(JSContext *cx, const js
char *
chars, uint32 len, jsval *vp); JSBool JS_ParseJSONWithReviver(JSContext *cx, const js
char *
chars, uint32 len, jsval reviver, jsval *vp); Name Type Description cx JSContext * Pointer to a JS context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ch JSObject * The object to be searched.
chars const js
char * The
characters of the string. len uint32 The length of the string. index jsint (in JS_ParseJSONWithReviver only) A reviver function to apply to the created value after parsing; see JSON.parse. vp jsval...
... string. len uint32 The length of the string. index jsint (in JS_ParseJSONWithReviver only) A reviver function to apply to the created value after parsing; see JSON.parse. vp jsval * Out parameter. *vp receives the value after parsing (and optionally, processing by the reviver). If an error occurs, the value left in *vp is undefined. Description Use these functions to parse a sequence of
characters as JSON. The parsing rules applied by these methods are exactly those specified by ECMAScript 5. Various JSON extensions like trailing commas, unquoted property names, more generous number parsing, and so on are not supported. MXR ID Search for JS_ParseJSON MXR ID Search for JS_ParseJSONWithReviver ...
JS_ReportErrorNumber
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. flags unsigned Error report flags. errorCallback JSErrorCallback Callback to fetch the error message. userRef ...
... the error message. userRef void * A pointer to application data. The JavaScript engine passes this pointer to errorCallback. The meaning of the data is up to the application. errorNumber const unsigned An error code. The JavaScript engine passes this number to errorCallback. The meaning of the error number is up to the application. ... / args ... / const
char16_t ** Additional arguments for the error message. These arguments must be of type
char * for JS_ReportErrorNumber or JS_ReportErrorFlagsAndNumber, or
char16_t * for JS_ReportErrorNumberUC or JS_ReportErrorFlagsAndNumberUC. The number of additional arguments required depends on the error message, which is determined by the errorCallback. Callback syntax typedef const JSError...
JS_SetDefaultLocale
Description JS_SetDefaultLocale sets the default locale for the ECMAScript Internationalization API (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat). ...
... Description JS_SetDefaultLocale sets the default locale for the ECMAScript Internationalization API (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat). ...
JS_SetErrorReporter
JS_SetErrorReporter(JSRuntime *rt, JSErrorReporter er); Name Type Description cx JSRuntime * Pointer to a JS runtime whose errors should be reported via your function. er JSErrorReporter The user-defined error reporting function to use in your application, described below. Callback Syntax typedef void (* JSErrorReporter)(JSContext *cx, const
char *message, JSErrorReport *report); Name Type Description cx JSContext * The context in which the error happened. message const
char * An error message. report JSErrorReport * An error report record containing additional details about the error. Description JS_SetErrorReporter enables you to define and use your own error reportin...
...ng omitted: class MyRequest { public: void execute() { auto rt = JS_NewRuntime(memlimit); JS_SetRuntimePrivate(rt, this); JS_SetErrorReporter(rt, &MyRequest::dispatchError); // execute JS } void onError(const std::string& error) { // handle error } static void dispatchError( JSContext* ctx, const
char* message, JSErrorReport* report) { auto rt = JS_GetRuntime(ctx); auto rt_userdata = JS_GetRuntimePrivate(rt); if (rt_userdata) { auto req = static_cast<MyRequest*>(rt_userdata); req->onError(message); } } }; See Also MXR ID Search for JS_GetErrorReporter MXR ID Search for JS_SetErrorReporter bug 1277278 - JS_SetErro...
JS_StringToVersion
Description JS_StringToVersion attempts to convert the version string to a JSVersion value. ...
... Description JS_StringToVersion attempts to convert the version string to a JSVersion value. ...
Parser API
ch subtype of Node is documented below with the specific string of its type field. You can use this field to determine which interface a node implements. The loc field represents the source location information of the node. ...
... can use this field to determine which interface a node implements. The loc field represents the source location information of the node. ...
Shell global objects
the array of backtraces recorded by enableSingleStepProfiling. enableSPSProfiling() Enables SPS instrumentation and corresponding assertions, with slow assertions disabled. enableSPSProfilingWithSlowAssertions() Enables SPS instrumentation and corresponding assertions, with slow assertions enabled. disableSPSProfiling() Disables SPS instrumentation isLatin1(s) Return true iff the string's
characters are stored as Latin1. stackPointerInfo() Return an int32 value which corresponds to the offset of the latest stack pointer, such that one can take the differences of 2 to estimate a frame-size. entryPoints(params) Carry out some JSAPI operation as directed by params, and return an array of objects describing which JavaScript entry points were invoked as a result. params is an object who...
...ns a structured clone buffer object. policy must be an object. The following keys' string values will be used to determine whether the corresponding types may be serialized (value allow, the default) or not (value deny). If denied types are encountered a TypeError will be thrown during cloning. Valid keys: SharedArrayBuffer. deserialize(clonebuffer) Deserialize data generated by serialize. deta
chArrayBuffer(buffer) Detach the given ArrayBuffer object from its memory, i.e. as if it had been transferred to a WebWorker. helperThreadCount() Returns the number of helper threads available for off-main-thread tasks. reportOutOfMemory() Report OOM, then clear the exception and return undefined. For crash testing. throwOutOfMemory() Throw out of memory exception, for OOM handling testing. re...
XPCOM array guide
y data. nsTPtrArray<T> and nsAutoTPtrArray<T> - similar to using T* with the above arrays, but also provides a SafeElementAt() accessor. As of Gecko 8, SafeElementAt() is now directly available on nsTArray for arrays instantiated with pointer types. Some other arrays: FallibleTArray, AutoFallibleTArray, InfallibleTArray, AutoInfallibleTArray, nsTObserverArray, nsAutoTObserverArray. ...
...an IDL file would be nsIArray. Will your array store non-refcounted objects and need automatic resizing? If so, use nsTArray<T>. Example: an array of integers or an array of strings. Will your array store non-refcounted objects and be a fixed size? If so, just use a native C++ array unless you need the enumeration options on nsTArray<T>. Example: an array of error message static const
char* pointers. Are all the things you are storing interface pointers to instances of the same interface? If so, use nsCOMArray. Example: a content node's list of nsIContent children. Otherwise use nsIArray and make liberal use of QueryElementAt(). The point of nsCOMArray is that it's a template, and all the pointers in it must be pointers to the same type; it's nice to be able to use it becau...
NS_NewNativeLocalFile
instance of nsILocalFile that provides a platform independent representation of a file path. #include "nsXPCOM.h" #include "nsILocalFile.h" nsresult NS_NewNativeLocalFile( const nsACString& aPath, PRBool aFollowLinks, nsILocalFile** aResult ); Parameters aPath [in] A string object that specifies an absolute filesystem path. This string should be encoded using ASCII or the multibyte
character coding corresponding to the native filesystem. This path does not need to reference an existing file. It is an error to pass a relative filesystem path. aFollowLinks [in] This attribute will determine if the nsILocalFile instance will automatically resolve symbolic links. This parameter has no effect on UNIX systems. On Windows, passing true causes shortcuts to be automatically resolved, ...
..., it returns an error code. NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that the specified path is invalid. This error is returned if a relative file path is passed to NS_NewNativeLocalFile. Remarks On UNIX systems, the prefix "~/" is supported as a shorthand for the user's home directory. If you use this function on Windows 2000 or later, you would not be able to handle file names containing
characters outside the default code page even though the OS has no problem dealing with them. Do not use this function (on Windows) unless it is guaranteed that the full path involved is always ASCII. Example Code // Create a local file that references c:\foo.txt nsresult rv; nsCOMPtr<nsILocalFile> file; rv = NS_NewNativeLocalFile(nsEmbedCString("c:\\foo.txt"), PR_FALSE, ...
EndReading
The NS_CStringGetData function can be used to determine if a nsACString instance has null-terminated storage. Example Code See BeginReading for an example. ...
...The NS_CStringGetData function can be used to determine if a nsACString instance has null-terminated storage. Example Code See BeginReading for an example. ...
Insert
<< XPCOM API Reference Summary The Insert family of functions inserts a value into a string's internal buffer. void Insert( const self_type& aString, index_type aPosition ); Parameters aString [in] A nsACString to append to this string. aPosition [in] An offset into the string's internal buffer specifying where to place the given
characters. void Insert( const
char_type* aData, index_type aPosition, size_type aDataLength = PR_UINT32_MAX ); Parameters aData [in] A raw
character array to append to this string. aPosition [in] An offset into the string's internal buffer specifying where to place the given
characters. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwis...
...PR_UINT32_MAX ); Parameters aData [in] A raw
character array to append to this string. aPosition [in] An offset into the string's internal buffer specifying where to place the given
characters. 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. void Insert(
char_type a
Char, index_type aPosition ); Parameters a
Char [in] A
character to append to this string. aPosition [in] An offset into the string's internal buffer specifying where to place the given
characters. Remarks If insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Replace
eplace( index_type aCutStart, index_type aCutLength, const self_type& aString ); Parameters aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. aString [in] A nsACString to append to this string. void Replace( index_type aCutStart, size_type aCutLength, const
char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. aData [in] A raw
character array to append to this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aD...
...its. aCutLength [in] The length of the section to remove, measured in storage units. aData [in] A raw
character array to append to 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. void Replace( index_type aCutStart, index_type aCutLength,
char_type a
Char ); Parameters aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. a
Char [in] A
character to append to this string. Remarks If insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buff...
EndReading
The NS_CStringGetData function can be used to determine if a nsAString instance has null-terminated storage. Example Code See BeginReading for an example. ...
...The NS_CStringGetData function can be used to determine if a nsAString instance has null-terminated storage. Example Code See BeginReading for an example. ...
Insert
<< XPCOM API Reference Summary The Insert family of functions inserts a value into a string's internal buffer. void Insert( const self_type& aString, index_type aPosition ); Parameters aString [in] A nsAString to append to this string. aPosition [in] An offset into the string's internal buffer specifying where to place the given
characters. void Insert( const
char_type* aData, index_type aPosition, size_type aDataLength = PR_UINT32_MAX ); Parameters aData [in] A raw
character array to append to this string. aPosition [in] An offset into the string's internal buffer specifying where to place the given
characters. 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...
...PR_UINT32_MAX ); Parameters aData [in] A raw
character array to append to this string. aPosition [in] An offset into the string's internal buffer specifying where to place the given
characters. 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. void Insert(
char_type a
Char, index_type aPosition ); Parameters a
Char [in] A
character to append to this string. aPosition [in] An offset into the string's internal buffer specifying where to place the given
characters. Remarks If insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Replace
Replace( index_type aCutStart, index_type aCutLength, const self_type& aString ); Parameters aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. aString [in] A nsAString to append to this string. void Replace( index_type aCutStart, size_type aCutLength, const
char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. aData [in] A raw
character array to append to this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aD...
...its. aCutLength [in] The length of the section to remove, measured in storage units. aData [in] A raw
character array to append to 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. void Replace( index_type aCutStart, index_type aCutLength,
char_type a
Char ); Parameter aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. a
Char [in] A
character to append to this string. Remarks If insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffe...
nsCStringEncoding
<< XPCOM API Reference Summary The nsCStringEncoding enumeration describes the set of
character encodings understood by the NS_CStringToUTF16 and NS_UTF16ToCString functions. NS_CSTRING_ENCODING_ASCII Conversion between ASCII and UTF-16 assumes that all bytes in the source string are 7-bit ASCII and can be inflated to UTF-16 by inserting null bytes. Reverse conversion is done by truncating every other byte. The conversion may result in loss and/or corruption of information if the strings do not strictly contain ASCII data. NS_CSTRING_ENCODING_UTF8 Conversion between UTF-8 and UTF-16 is non-lossy. NS_CSTRING_ENCODING_NATIVE_FILESYSTEM Conversion from UTF-16 to the native filesystem
charset may result in a loss of information. No attempt is made to protect against data loss in this...
...sion may result in loss and/or corruption of information if the strings do not strictly contain ASCII data. NS_CSTRING_ENCODING_UTF8 Conversion between UTF-8 and UTF-16 is non-lossy. NS_CSTRING_ENCODING_NATIVE_FILESYSTEM Conversion from UTF-16 to the native filesystem
charset may result in a loss of information. No attempt is made to protect against data loss in this case. The native filesystem
charset applies to strings passed to the "Native" method variants on nsIFile and nsILocalFile. History This enumeration was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_CStringToUTF16, NS_UTF16ToCString ...
IAccessibleHyperlink
Alternatively this method could return an IUnknown VARIANT of a COM interface representing a target object to be activated when the link is activated. See the section about. 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. ...
...alue E_INVALIDARG if bad [in] passed, [out] value is null. S_FALSE if there is nothing to return, [out] value is null. S_OK. endIndex() [propget] HRESULT endIndex( [out] long index ); Parameters index The 0 based
character offset at which the textual representation of the hyperlink ends. The returned value is related to the IAccessibleText interface of the object that owns this hyperlink. The
character at the index is not part of the hypertext. Return value S_OK. startIndex() [propget] HRESULT startIndex( [out] long index ); Parameters index The 0 based
character offset at which the textual representation of the hyperlink starts. The returned value is related to the IAccessibleText interface of the object that owns this hyperlink. Return value S_OK. valid() Returns whether the target...
imgIContainer
ey 2.11) Implemented by: ?????????????????????????????????????. ...
...ld be composited onto the output buffer. Obsolete since Gecko 2.0 Methods Native code only!addRestoreData 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. void addRestoreData( [array, size_is(aCount), const] in
char data, in unsigned long aCount ); Parameters data Missing Description aCount Missing Description Exceptions thrown Missing Exception Missing Description Native code only!appendFrame 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 rem...
inIDOMUtils
AString getSelectorText(in nsIDOMCSSStyleRule aRule, in unsigned long aSelectorIndex); unsigned long long getSpecificity(in nsIDOMCSSStyleRule aRule, in unsigned long aSelectorIndex); nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange); bool hasPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass); boolean isIgnorableWhitespace(in nsIDOM
CharacterData aDataNode); bool isInheritedProperty(in AString aPropertyName); void parseStyleSheet(in nsIDOMCSSStyleSheet aSheet, in DOMString aInput); void removePseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass); AString rgbToColorName(in octet aR, in octet aG, in octet aB); bool selectorMatchesElement(in nsIDOMElement aElement, in nsI...
...fied using @font-face in the specified portion of the document. nsIDOMFontFaceList getUsedFontFaces( in nsIDOMRange aRange ); Parameters aRange 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 nsIDOM
CharacterData aDataNode ); Parameters aDataNode A DOM
CharacterData node; that is, a text node. Return value true if the node only contains insignificant whitespace. In particular, this will be false if certain CSS white-space styles are in effect. isInheritedProperty() Determines if the specified string names a CSS property that is inh...
nsIAccessibleHyperText
to expose hyperlinks in a document, typically a text document, that are used to reference other documents. A typical implementation is to implement this interface on the small text object such as a paragraph of text. Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Method overview nsIAccessibleHyperLink getLink(in long linkIndex); long getLinkIndex(in long
charIndex); long getSelectedLinkIndex(); Obsolete since Gecko 1.9 Attributes Attribute Type Description linkCount long The number of links contained within this hypertext object. Read only. Note: Renamed from links in Gecko 1.9 Methods getLink() Retrieves the nsIAccessibleHyperLink object at the given link index. nsIAccessibleHyperLink getLink( ...
...inkIndex ); Parameters linkIndex 0-based index of the link that is to be retrieved. This can be retrieved via getLinkIndex(). Return value An nsIAccessibleHyperLink object. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. NS_ERROR_INVALID_ARG The link index is invalid. getLinkIndex() The link index at the given offset (
character index). long getLinkIndex( in long
charIndex ); Parameters
charIndex The 0-based
character index. Return value The index of the link if it's presented on the given
character index, otherwise -1. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. getSelectedLinkIndex() Obsolete since Gecko 1.9 (Firefox 3...
nsIBinaryInputStream
eam. void readBytes( in PRUint32 aLength, [size_is(aLength), retval] out string aString ); Parameters aLength The number of bytes to read. aString A string containing the bytes read from the stream. Exceptions thrown NS_ERROR_FAILURE If it can't read aLength bytes. readCString() Reads an 8-bit pascal style string from the stream. 32-bit length field, followed by length 8-bit
chars. ACString readCString(); Parameters None. Return value The string read from the stream. readDouble() Reads from the stream. double readDouble(); Parameters None. Return value A double read from the stream. readFloat() Reads from the stream. float readFloat(); Parameters None. Return value A float read from the stream. readString() Reads an 16-bit pascal style string from ...
...alue The string read from the stream. readDouble() Reads from the stream. double readDouble(); Parameters None. Return value A double read from the stream. readFloat() Reads from the stream. float readFloat(); Parameters None. Return value A float read from the stream. readString() Reads an 16-bit pascal style string from the stream. 32-bit length field, followed by length PRUni
chars. AString readString(); Parameters None. Return value The string read from the stream. setInputStream() void setInputStream( in nsIInputStream aInputStream ); Parameters aInputStream The stream from which to read. See also nsIBinaryOutputStream nsIInputStream nsIOutputStream ...
nsIBinaryOutputStream
Double( in double aDouble ); Parameters aDouble The double to write to the stream. writeFloat() Writes a floating point number to the stream. void writeFloat( in float aFloat ); Parameters aFloat The floating point value to write to the stream. writeStringZ() Writes an 8-bit pascal style string to the stream. The output data consists of a 32-bit length field, followed by that many 8-bit
characters. void writeStringZ( in string aString ); Parameters aString The string to write to the stream. writeUtf8Z() Writes an 8-bit pascal style string (UTF8-encoded) to the stream. The output data consists of a 32-bit length field, followed by that many 8-bit
characters. void writeUtf8Z( in wstring aString ); Parameters aString The string to write to the stream. writeWStringZ() Writes a ...
...Writes an 8-bit pascal style string (UTF8-encoded) to the stream. The output data consists of a 32-bit length field, followed by that many 8-bit
characters. void writeUtf8Z( in wstring aString ); Parameters aString The string to write to the stream. writeWStringZ() Writes a 16-bit pascal style string to the stream. The output data consists of a 32-bit length field, followed by that many PRUni
chars. void writeWStringZ( in wstring aString ); Parameters aString The string to write to the stream. See also nsIBinaryInputStream nsIOutputStream nsIInputStream ...
nsICacheEntryDescriptor
pending requests will not get a cache descriptor. This is meant as a tool for clients that wish to instruct pending requests to skip the cache. void doomAndFailPendingRequests( in nsresult status ); Parameters status The access status. getMetaDataElement() This method retrieves the meta data. Meta data is a table of key/value string pairs. The strings do not have to conform to any particular
charset, but they must be null terminated. string getMetaDataElement( in string key ); Parameters key The key for retrieving the meta data. Return value Returns the string value containing the meta data for the provided key. markValid() This method means that a writer must validate this cache object before any readers are given a descriptor to the object. void markValid(); Parameters None. openI...
... This method sets the time at which the cache entry should be considered invalid (in seconds since the Epoch). void setExpirationTime( in PRUint32 expirationTime ); Parameters expirationTime The time for cache entry expiration (in seconds). setMetaDataElement() This method sets the meta data. Meta data is a table of key/value string pairs. The strings do not have to conform to any particular
charset, but they must be null terminated. void setMetaDataElement( in string key, in string value ); Parameters key The key for setting the meta data. value The value for setting the meta data. visitMetaData() This method means that the visitor will be called with key/value pair for each meta data element. void visitMetaData( in nsICacheMetaDataVisitor visitor ); Parameters visitor The vis...
nsICategoryManager
They are often used to register lists of ContractIDs, corresponding to comp...
...They are often used to register lists of ContractIDs, corresponding to components that wish to be notified of various events by some subsystem. ...
nsIChannel
responding http transaction. This interface must be used only from the XPCOM main thread. Implemented by netwerk/base/src/nsBaseChannel.cpp and netwerk/protocol/http/src/nsHttpChannel.cpp. Method overview void asyncOpen(in nsIStreamListener aListener, in nsISupports aContext); nsIInputStream open(); Attributes Attribute Type Description content
Charset ACString The
character set of the channel's content if available and if applicable. This attribute only applies to textual data. Setting content
Charset before the channel has been opened provides a hint to the channel on what the
charset should be. The behavior is similar to contentType. The value of the content
Charset attribute is a mixed case string. contentLengt...
...ype determined by the channel. Setting contentType between the time that asyncOpen() is called and the time when onStartRequest is fired has undefined behavior at this time. The value of the contentType attribute is a lowercase string. A value assigned to this attribute will be parsed and normalized as follows: Any parameters (delimited with a ';') will be stripped. If a
charset parameter is given, then its value will replace the the content
Charset attribute of the channel. The stripped contentType will be lowercased. Any implementation of nsIChannel must follow these rules. notificationCallbacks nsIInterfaceRequestor The notification callbacks for the channel. This is set by clients, who wish to provide a means to receive progress, s...
nsICommandLineRunner
Runner is an extension of nsICommandLine used to initialize command lines and run them by processing the comand line handlers. toolkit/components/commandlines/public/nsICommandLineRunner.idlScriptable Please add a summary to this article. Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Inherits from: nsICommandLine Method overview void init(in long argc, in ns
CharPtrArray argv, in nsIFile workingDir, in unsigned long state); void run(); void setWindowContext(in nsIDOMWindow aWindow); Attributes Attribute Type Description helpText AUTF8String Process and combine the help text provided by each command-line handler. Read only. Methods init() Called with the argc/argv combination passed to main. It assumes a native
character set. On Windows the ...
...PtrArray argv, in nsIFile workingDir, in unsigned long state); void run(); void setWindowContext(in nsIDOMWindow aWindow); Attributes Attribute Type Description helpText AUTF8String Process and combine the help text provided by each command-line handler. Read only. Methods init() Called with the argc/argv combination passed to main. It assumes a native
character set. On Windows the
character set is UTF-8, not the native codepage. void init( in long argc, in ns
CharPtrArray argv, in nsIFile workingDir, in unsigned long state ); Parameters argc The number of arguments being passed. argv An array storing pointers to the arguments workingDir Directory where the command will run. This is used to resolve file and URI paths. state The type of command line being processed. This...
nsICrashReporter
porting is not initialized. submitReports boolean User preference for submitting crash reports. Methods annotateCrashReport() Add some extra data to be submitted with a crash report. void annotateCrashReport( in ACString key, in ACString data ); Parameters key Name of the data to be added. data Data to be added. Exceptions thrown NS_ERROR_INVALID_ARG If key or data contain invalid
characters. Invalid
characters for key are '=' and '\n'. Invalid
character for data is '\0'. NS_ERROR_NOT_INITIALIZED If crash reporting not initialized. appendAppNotesToCrashReport() Append some data to the "Notes" field, to be submitted with a crash report. Unlike annotateCrashReport(), this method will append to existing data. void appendAppNotesToCrashReport( in ACString data ); Parameters da...
.... NS_ERROR_NOT_INITIALIZED If crash reporting not initialized. appendAppNotesToCrashReport() Append some data to the "Notes" field, to be submitted with a crash report. Unlike annotateCrashReport(), this method will append to existing data. void appendAppNotesToCrashReport( in ACString data ); Parameters data Data to be added. Exceptions thrown NS_ERROR_INVALID_ARG If data contains invalid
characters. The only invalid
character is '\0'. NS_ERROR_NOT_INITIALIZED If crash reporting not initialized. Native code only!appendObjCExceptionInfoToAppNotes Append note containing an Obj-C exception's info. void appendObjCExceptionInfoToAppNotes( in voidPtr aException ); Parameters aException NSException object to append note for. Native code only!writeMinidumpForException Write a minidump i...
nsIEditor
// tag name are in lower case with <br>. ...
...ePrevious 2 eNextWord 3 ePreviousWord 4 eToBeginningOfLine 5 eToEndOfLine 6 Attributes Attribute Type Description contentsMIMEType string The MIME type of the document. document Document Read only. The DOM Document this editor is associated with. document
CharacterSet ACString Sets the current 'Save' document
character set. documentIsEmpty boolean Read only. Returns true if the document has no *meaningful* content. documentModified boolean Read only. Returns true if the document is modifed and needs saving. flags unsigned long Edit flags for this editor. May be set at any time. isDocumentE...
nsIFrameLoader
ce to manage frames across processes if Electrolysis is in use to support per-frame processes. ...
...fy the URI to load. void loadURI( in nsIURI aURI ); Parameters aURI The URI to load into the frame. sendCrossProcessKeyEvent() Creates and sends a KeyEvent to the content viewport's process. See nsIDOMWindowUtils.sendKeyEvent() for details; this method is its equivalent for cross-process event handling. void sendCrossProcessKeyEvent( in AString aType, in long aKeyCode, in long a
CharCode, in long aModifiers, [optional] in boolean aPreventDefault ); Parameters aType The event type. aKeyCode The key code. a
CharCode The
character code. aModifiers The modifier flags. aPreventDefault Whether or not to prevent default actions from being performed. sendCrossProcessMouseEvent() Creates and sends a MouseEvent to the content viewport's process. See nsIDOMWindowUtil...
nsIJSON
ko 7.0 jsval decodeToJSVal(in AString str, in JSContext cx); Native code only! JSObject decodeFromStream(in nsIInputStream stream, in long contentLength); AString encode(in JSObject value); Obsolete since Gecko 7.0 AString encodeFromJSVal(in Jsvaljsval value, in JSContext cx); Native code only! void encodeToStream(in nsIOutputStream stream, in string
charset, in boolean writeBOM, in JSObject value); jsval legacyDecode(in AString str); Deprecated since Gecko 2.0 jsval legacyDecodeFromStream(in AString str); Deprecated since Gecko 2.0 jsval legacyDecodeToJSVal(in AString str, in JSContext cx); Native code only! Deprecated since Gecko 2.0 Methods decode() Obsolete since Gecko 7.0 (Firefox 7.0 / T...
... AString encodeFromJSVal( in jsval value, in JSContext cx ); Parameters value A pointer to the jsval to encode. cx The JavaScript runtime context to use to encode the value. Return value A JSON string representing the value. encodeToStream() Encodes a JavaScript object into JSON format, writing it to a stream. void encodeToStream( in nsIOutputStream stream, in string
charset, in boolean writeBOM in JSObject value ); Parameters stream The nsIOutputStream to which to write the JSON string.
charset The string encoding to use. Only the five Unicode encodings "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE" and "UTF-32BE" are supported. writeBOM Specify true if you wish to write a byte-order mark (BOM) into the stream, otherwise specify false. value The J...
nsIMsgMessageService
nsIURI aURL); [noscript] void CopyMessages(in nsMsgKeyArrayPtr keys, in nsIMsgFolder srcFolder, in nsIStreamListener aCopyListener, in boolean aMoveMessage, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow, out nsIURI aURL); void DisplayMessage(in string aMessageURI, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, in string a
CharsetOverride, out nsIURI aURL); void openAttachment(in string aContentType, in string aFileName, in string aUrl, in string aMessageUri, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener); void SaveMessageToDisk(in string aMessageURI, in nsIFileSpec aFile, in boolean aGenerateDummyEnvelope, in nsIUrlListener aUrlListener, out nsIURI aURL, i...
...w nsIMsgWindow for progress and status feedback Return values aURL The new nsIURI of the message. (?) DisplayMessage() When you want a message displayed.... void DisplayMessage(in string aMessageURI, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, in string a
CharsetOverride, out nsIURI aURL); Parameters aMessageURI A uri representing the message to display. aDisplayConsumer Is (for now) an nsIDocShell which the message is loaded into. aMsgWindow nsIMsgWindow for progress and status feedback aUrlListener An nsIUrlListener a
CharsetOverride (optional)
character set over ride to force the message to use. Return values a...
nsIProcess
Firefox 3.5), this method returned the process ID of the newly executing process. It no longer returns a value. void run( in boolean blocking, [array, size_is(count)] in string args, in unsigned long count ); Parameters blocking If true, this method will block until the process terminates; if false, the method returns immediately. args An array of count arguments, using the native
character set, to be passed to the executable on its command line. count The number of arguments in the args array. runAsync() Asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running. void runAsync( [array, size_is(count)] in string args, in unsigned long count, in nsIObserver observer, Optional in boolean ho...
... array. runAsync() Asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running. void runAsync( [array, size_is(count)] in string args, in unsigned long count, in nsIObserver observer, Optional in boolean holdWeak Optional ); Parameters args An array of arguments to pass into the process, using the native
character set. This array must have count entries. count The number of arguments passed in the args array. observer Optional An observer that will be notified when the process exits. The observer will receive this nsIProcess instance as the subject and "process-finished" or "process-failed" as the topic. The observer will be notified on the main thread. holdWeak Optional If true, a weak referenc...
nsIPushSubscription
httprequest;1"] .createInstance(Ci.nsIXMLHttpRequest); request.open("POST", "https://example.com/register-for-push", true); request.addEventListener("error", () => { Cu.reportError("Error sending subscription to server"); }); request.send(JSON.stringify({ endpoint: subscription.endpoint, // Base64-encode the key and authentication secret. ...
....open("POST", "https://example.com/register-for-push", true); request.addEventListener("error", () => { Cu.reportError("Error sending subscription to server"); }); request.send(JSON.stringify({ endpoint: subscription.endpoint, // Base64-encode the key and authentication secret. ...
nsISupportsPrimitive
pportsCString. TYPE_STRING 3 Corresponding to nsISupportsString. TYPE_PRBOOL 4 Corresponding to nsISupportsPRBool. TYPE_PRUINT8 5 Corresponding to nsISupportsPRUint8. TYPE_PRUINT16 6 Corresponding to nsISupportsPRUint16. TYPE_PRUINT32 7 Corresponding to nsISupportsPRUint32. TYPE_PRUINT64 8 Corresponding to nsISupportsPRUint64. TYPE_PRTIME 9 Corresponding to nsISupportsPRTime. TYPE_
CHAR 10 Corresponding to nsISupports
Char. TYPE_PRINT16 11 Corresponding to nsISupportsPRInt16. TYPE_PRINT32 12 Corresponding to nsISupportsPRInt32. TYPE_PRINT64 13 Corresponding to nsISupportsPRInt64. TYPE_FLOAT 14 Corresponding to nsISupportsFloat. TYPE_DOUBLE 15 Corresponding to nsISupportsDouble. TYPE_VOID 16 Corresponding to nsISupportsVoid. TYPE_INTERFACE_POINTER 17 Corresponding to...
...t64. TYPE_FLOAT 14 Corresponding to nsISupportsFloat. TYPE_DOUBLE 15 Corresponding to nsISupportsDouble. TYPE_VOID 16 Corresponding to nsISupportsVoid. TYPE_INTERFACE_POINTER 17 Corresponding to nsISupportsInterfacePointer. Remarks This interface was frozen for Gecko 1.2. See bug 166426 for details. ...
nsIWebNavigation
to loadURI. LOAD_FLAGS_BYPASS_CACHE 256 This flag specifies that the local web cache should be bypassed, but an intermediate proxy cache could still be used to satisfy the load. LOAD_FLAGS_BYPASS_PROXY 512 This flag specifies that any intermediate proxy caches should be bypassed (That is, that the content should be loaded from the origin server). LOAD_FLAGS_
CHARSET_CHANGE 1024 This flag specifies that a reload was triggered as a result of detecting an incorrect
character encoding while parsing a previously loaded document. LOAD_FLAGS_STOP_CONTENT 2048 If this flag is set, Stop() will be called before the load starts and will stop both content and network activity (the default is to only stop network activity). Effectively, t...
...o loading the requested URI in the object implementing this interface. If it can't be loaded here however, the URI dispatcher will go through its normal process of content loading. void loadURI( wstring URI, unsigned long loadFlags, nsIURI referrer, nsIInputStream postData, nsIInputStream headers ); Parameters URI The URI string to load. For HTTP and FTP URLs and possibly others,
characters above U+007F will be converted to UTF-8 and then URL- escaped per the rules of RFC 2396. loadFlags Flags modifying load behaviour. This parameter is a bitwise combination of the load flags defined above. (Undefined bits are reserved for future use.) Generally you will pass LOAD_FLAGS_NONE for this parameter. referrer The referring URI. If this argument is null, then the referring URI wi...
nsIWindowsRegKey
Path, in unsigned long mode ); Parameters relPath mode Return value nsIWindowsRegKey for the newly opened subkey. readBinaryValue() This method reads the binary contents of the named value under this key. JavaScript callers should take care with the result of this method since it will be byte-expanded to form a JS string. (The binary data will be treated as an ISO-Latin-1
character string, which it is not). ACString readBinaryValue( in AString name ); Parameters name The name of the value to query. Return value The binary contents of the named value under this key. readInt64Value() This method reads the 64-bit integer contents of the named value. unsigned long long readInt64Value( in AString name ); Parameters name The name of the value to quer...
...y is not being watched. void stopWatching(); Parameters None. writeBinaryValue() This method writes 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 v...
nsIXmlRpcClient
Supported arguments are: nsISupportsPRUint8, nsISupportsPRUint16, nsISupportsPRInt16, nsISupportsPRInt32: i4, nsISupportsPRBool: boolean...
...tion ( in string username, in string password ) ; Parameters username username to be used if asked to authenticate password password to be used if asked to authenticate clearAuthentication() Clear authentication info void setAuthentication ( in string username, in string password ) ; Parameters username password setEncoding() Set
character encoding. The default
charset if this function is not called is "UTF-8" void setAuthentication ( in string encoding ) ; Parameters encoding encoding
charset to be used asyncCall() Call remote method methodName asynchronously with given arguments. Supported arguments are: nsISupportsPRUint8, nsISupportsPRUint16, nsISupportsPRInt16, nsISupportsPRInt32: i4, nsISupportsPRBool: boolean, nsISupports
Char, nsISupportsCS...
NS_CStringGetData
<< XPCOM API Reference Summary The NS_CStringGetData function gives the caller read access to the string's internal buffer. #include "nsStringAPI.h" PRUint32 NS_CStringGetData( const nsACString& aString, const
char** aData, PRBool* aTerminated = nsnull ); Parameters aString [in] A nsACString instance to inspect. aData [out] A const pointer to the string's internal buffer. aTerminated [out] This optional result parameter indicates whether or not aData is null-terminated. It may be null if the caller is not interested in this information. Return Values The NS_CStringGetData function returns the length of aData, measured in storage units (bytes). Example Code // Count the number of times a particular
character appears in a string. PRUint32 Count
Char(const nsA...
... [out] This optional result parameter indicates whether or not aData is null-terminated. It may be null if the caller is not interested in this information. Return Values The NS_CStringGetData function returns the length of aData, measured in storage units (bytes). Example Code // Count the number of times a particular
character appears in a string. PRUint32 Count
Char(const nsACString& str,
char c) { const
char* data; PRUint32 len = NS_CStringGetData(str, &data); PRUint32 count = 0; for (PRUint32 i = 0; i < len; ++i) { if (data[i] == c) ++count; } return count; } History This function was finalized for Mozilla 1.7. See bug 239123 for details. See Also NS_CStringGetMutableData ...
NS_CStringInsertData
<< XPCOM API Reference Summary The NS_CStringInsertData function appends data to the existing value of a nsACString instance. This is a low-level API. #include "nsStringAPI.h" nsresult NS_CStringInsertData( nsACString& aString, PRUint32 aOffset, const
char* aData, PRUint32 aDataLength = PR_UINT32_MAX ); Parameters aString [in] A nsACString instance to be modified. aOffset [in] An offset into the string's internal buffer specifying where to place the given
characters. 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_CStringInsertData function re...
...ise, 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_CStringSetDataRange. 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_CStringSetDataRange, nsACString, nsACString ...
NS_CStringSetData
aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. ...
... aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. ...
NS_CStringToUTF16
Summary The NS_CStringToUTF16 function converts the value of a nsACString instance to UTF-16 and stores the result in a nsAString instance. #include "nsStringAPI.h" nsresult NS_CStringToUTF16( const nsACString& aSrc, nsCStringEncoding aSrcEncoding, nsAString& aDest ); Parameters aSrc [in] A nsACString instance containing the source string to be converted. aSrcEncoding [in] The
character encoding of the source string. See nsCStringEncoding for the set of values that can be passed for this parameter. aDest [out] A nsAString instance that will contain the result of the conversion. The result will be encoded using the host byte order. Return Values The NS_CStringToUTF16 function returns NS_OK if successful. Otherwise, it returns an error code. The set of possible error codes...
...tain the result of the conversion. The result will be encoded using the host byte order. Return Values The NS_CStringToUTF16 function returns NS_OK if successful. Otherwise, it returns an error code. The set of possible error codes is currently unspecified. Example Code nsEmbedCString str("hello"); nsEmbedString ustr; NS_CStringToUTF16(str, NS_CSTRING_ENCODING_ASCII, ustr); const PRUni
char *uni
charBuf = ustr.get(); History This function was frozen for Mozilla 1.7. See bug bug 239123 for details. See Also nsACString, nsAString, nsCStringEncoding ...
NS_StringGetData
<< XPCOM API Reference Summary The NS_StringGetData function gives the caller access to the string's internal buffer. This is a low-level API. #include "nsStringAPI.h" PRUint32 NS_StringGetData( const nsAString& aString, const PRUni
char** aData, PRBool* aTerminated ); Parameters aString [in] A nsAString instance to inspect. aData [out] A const pointer to the string's internal buffer. aTerminated [out] This optional result parameter indicates whether or not aData is null-terminated. ...
...** aData, PRBool* aTerminated ); Parameters aString [in] A nsAString instance to inspect. aData [out] A const pointer to the string's internal buffer. aTerminated [out] This optional result parameter indicates whether or not aData is null-terminated. Return Values The NS_StringGetData function returns the length of aData, measured in storage units (bytes). Example Code PRUint32 Count
Char(const nsAString& str, PRUni
char c) { const PRUni
char* data; PRUint32 len = NS_StringGetData(str, &data); PRUint32 count = 0; for (PRUint32 i = 0; i < len; ++i) { if (data[i] == c) ++count; } return count; } History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also nsAString ...
NS_StringSetData
aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. ...
...aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. ...
Mail event system
s document is being written, these are the current events: nsIFolder nsIFolderListener NotifyItemAdded OnItemAdded NotifyItemRemoved OnItemRemoved NotifyItemPropertyChanged OnItemPropertyChanged NotifyItemIntPropertyChanged OnItemIntPropertyChanged NotifyItemBoolPropertyChanged OnItemBoolPropertyChanged NotifyItemUni
charPropertyChanged OnItemUni
charPropertyChanged NotifyItemPropertyFlagChanged OnItemPropertyFlagChanged NotifyItemEvent OnItemEvent NotifyFolderLoaded OnFolderLoaded NotifyDeleteOrMoveMessages OnDeleteOrMoveMessages Sample code In this example, a listener will be set up to be notified when the message count changes in a folder: // our varia...
... // set up the folder listener to point to the above function var folderListener = { OnItemAdded: function(parent, item, viewString) {}, OnItemRemoved: function(parent, item, viewString) {}, OnItemPropertyChanged: function(parent, item, viewString) {}, OnItemIntPropertyChanged: myOnIntPropertyChanged, OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {}, OnItemUni
charPropertyChanged: function(item, property, oldValue, newValue) {}, OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {}, OnItemEvent: function(item, event) = {}, OnFolderLoaded: function(aFolder) = {} OnDeleteOrMoveMessagesCompleted: function( aFolder) = {}, } // now register myself as a listener on every mail folder var mailSession = Components.classes["component://net...
libmime content type handlers
Pizzarro <rhp@netscape.com> Contents Overview API's Plugin Location/Installation Sample Content Type Handler Plugin Overview The libmime module implements a general-purpose MIME parser and one of the primary methods provided by the parser is the ability to emit an HTML representation of an input stream. The primary use of libmime is to parse and render RFC822 messages for use by the Messenger component of Seamonkey. ...
... "mimecth.h" // {20DABD99-F8B5-11d2-8EE0-00A024A7D144} #define NS_IMIME_CONTENT_TYPE_HANDLER_IID \ { 0x20dabd99, 0xf8b5, 0x11d2, \ { 0x8e, 0xe0, 0x0, 0xa0, 0x24, 0xa7, 0xd1, 0x44 } } class nsIMimeContentTypeHandler : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IMIME_CONTENT_TYPE_HANDLER_IID; return iid; } NS_IMETHOD GetContentType(
char **contentType) = 0; NS_IMETHOD CreateContentTypeHandlerClass(const
char *content_type, contentTypeHandlerInitStruct *initStruct, MimeObjectClass **objClass) = 0; }; #endif /* nsIMimeContentTypeHandler_h_ */ Plugin Installation/Location The installation of these modules will be similar to the th...
Declaring types
{ "tm_year": ctypes.int }, { "tm_wday": ctypes.int }, { "tm_yday": ctypes.int }, { "tm_isdst": ctypes.int } ]); To find other types see here: Predefined Types - Primitive Types. You can then declare and use a function that uses this structure, like this: // Declare the libc asctime() function, which returns a
char * and accepts a pointer to a tm structure. const asctime = lib.declare("asctime", ctypes.default_abi, ctypes.
char.ptr, struct_tm.ptr); var theTime = new struct_tm; theTime.tm_hour = 3; theTime.tm_min = 15; ... var timeStr = asctime(theTime.address()); // Pass a pointer to the tm struct var jsString = timeStr.readString(); // Convert the C string to JavaScript The last line conver...
...ect indicating the type to which the pointer should refer: const IntPtr = new ctypes.PointerType(ctypes.int); In this example, IntPtr is equivalent to this declaration in C: typedef int *intPtr; You can similarly declare a pointer type as a pointer to any user-defined type, including structures: const UserRecord = new ctypes.StructType("UserRecord", [{"name": ctypes.
char.ptr}, {"id": ctypes.int32}]); const UserRecordPtr = new ctypes.PointerType(UserRecord); In this example, a new UserRecord type is defined, along with a new pointer type that can be used to reference it. The equivalent C code looks like this: typedef struct UserRecord {
char *name; int id; // Assuming int is 32-bit here } UserRecord; typedef UserRecordPtr *UserRe...
Standard OS Libraries
xample: XQueryPointer Get mouse cursor position and some extra information. Documentation on this function is found at XFree86 :: XQueryPointer(3X11) Manual Page. ...
...ation] Components.utils.import("resource://gre/modules/ctypes.jsm"); let objc = ctypes.open(ctypes.libraryName("objc")); let id = ctypes.StructType("objc_object").ptr; let SEL = ctypes.StructType("objc_selector").ptr; let objc_getClass = objc.declare("objc_getClass", ctypes.default_abi, id, ctypes.
char.ptr); let sel_registerName = objc.declare("sel_registerName", ctypes.default_abi, SEL, ctypes.
char.ptr); let objc_msgSend = objc.declare("objc_msgSend", ctypes.default_abi, id, id, ...
Plug-in Development Overview - Plugins
Unix On Unix, plug-ins are found according to the section How Gecko Finds ...
... FileOpenName: for file open template ProductName: for plug-in name FileDescription: for description Language: for language in use In the MIME types and file extensions strings, multiple values are separated by the "|"
character, for example: video/quicktime|audio/aiff|image/jpeg The version stamp will be loaded only if it has been created with the language set to "US English" and the
character set to "Windows Multilingual" in your development environment. The resource code for this language and
character set combination is 040904E4. Unix On Unix, plug-ins are found according to the section How Gecko Finds Plug-ins. To determine the MIME types and file extensions that the plug-in handles, the browser loads each library and calls into the NP_GetMIMEDescription entry point. This ...
Version, UI, and Status Information - Plugins
e seeing the percentage completed of the current operation or the URL of a button or other link object when the cursor is over it, all of which the browser shows. In fact, your plug-in interface should be consistent with the rest of the browser in this way. To accomplish this, the plug-in calls the NPN_Status method to display your message on the status line. void NPN_Status(NPP instance, const
char *message); The instance parameter is the current plug-in instance, that is, the one that the status message belongs to. In the message parameter, pass the string you want to display on the status line. The browser always displays the last status line message it receives, regardless of the message source. For this reason, your message is always displayed, but you have no control over how long i...
... is running on the user's current system. Browsers communicate with HTTP servers, which store agent software name, version, and operating system in a user_agent field. If you want to gather usage statistics or just find out the version of your plug-in's host browser, this information can help you. The plug-in calls the NPN_UserAgent method to retrieve the contents of the user_agent field. const
char* NPN_UserAgent(NPP instance); The instance parameter represents the current plug-in instance. This function returns a string that contains the user_agent field of the browser. Getting the Current Version Your plug-in should make sure, possibly during initialization, that the version of the Plug-in API it is using is compatible with the version the browser is using. To do so, it must find the ...
Debugger.Script - Firefox Developer Tools
url. source If the instance refers to a JSScript, the Debugger.Source instance representing the source code from which this script was produced. This is null if the source code was not retained. If the instance refers to WebAssembly code, the Debugger.Source instance representing the serialized text format of the WebAssembly code. ...
... If the instance refers to WebAssembly code, throw a TypeError. global If the instance refers to a JSScript, a Debugger.Object instance referring to the global object in whose scope this script runs. ...
Index - Firefox Developer Tools
er the course of DevTools development, we have added several experimental panels to try out new ideas. Not all of these have had wide adoption, and due to the cost of maintenance, seldom used panels are eventually removed. 29 DevTools API DevTools The DevTools API provides a way to register and access developer tools in Firefox. 30 DevToolsColors CSS This
chart lists colors and CSS variables as implemented in the dark theme and light theme for developer tools. 31 Eyedropper Firefox, Tools, Web Development:Tools The Eyedropper tool enables you to select colors in the current page. It works like a magnifying glass over the page, enabling you to select with pixel precision. Underneath the magnifying glass it shows the color value for ...
...e executing a particular function corresponds to the amount of time the browser spent executing it. 85 Examples List of demo pages for performance scenarios and walkthroughs. 86 Sorting algorithms comparison This article describes a simple example program that we use in two of the Performance guides: the guide to the Call Tree and the guide to the Flame
Chart. 87 Flame
Chart The Call Tree and the Flame
Chart are both used to analyze your site's JavaScript, and they both use the same data: a sample of the JavaScript engine's stack, taken periodically during the recording. 88 Frame rate Frame rate is the rate at which a video device can produce images (or frames). It's most familiar from film and gaming, but ...
Monster example - Firefox Developer Tools
use to illustrate some features of the Memory tool. You can try the site at https://mdn.github.io/performance-scenarios/js-allocs/alloc.html. ...
...000; var MIN_NAME_LENGTH = 2; var MAX_NAME_LENGTH = 48; function Monster() { function randomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function randomName() { var
chars = "abcdefghijklmnopqrstuvwxyz"; var nameLength = randomInt(MIN_NAME_LENGTH, MAX_NAME_LENGTH); var name = ""; for (var j = 0; j < nameLength; j++) { name +=
chars[randomInt(0,
chars.length-1)]; } return name; } this.name = randomName(); this.eyeCount = randomInt(0, 25); this.tentacleCount = randomInt(0, 250); } function makeMonsters() { var monsters = { "friendly": [], "fierce": [], "undecided": [] }; for (var i = 0; i < MONSTER_COUNT; i++) { monsters.friendly.push(new Monster()); } for (var i = 0; i < M...
Network request list - Firefox Developer Tools
lbar. WebSocket connections Use the WS button in the toolbar. You can filter by plain text (in which case the text is used to find partial matches; entering "for" will match any message that contains the word "for") or--as of Firefox 75--using regular expressions (by writing the regexp bracketed within slashes; "/.+Corp.*/" will look for any occurrence of "Corp" which has at least one
character before it and may or may not have any
characters after it, for example). The third-party add-on WebSocket Sniffer may be helpful as well. URL Use the Filter URLs box in the toolbar. You can focus it by clicking in the filter box, or by pressing Ctrl + F (or Cmd + F on a Mac); then start typing. The list of network requests is filtered to include only requests that co...
...I If the method is HEAD -H One for each request header. If the "Accept-Encoding" header is present, the cURL command includes --compressed instead of -H "Accept-Encoding: gzip, deflate". This means that the response will be automatically decompressed. --globoff Suppresses cURL's globbing (wildcard matching) feature if the copied URL includes square bracket
characters ([ or ]). (Starting in Firefox 76) Managing HAR data The HAR format enables you to export detailed information about network requests. In addition to the Copy and Save menu items for HAR in the context menu, similar menu items are available in the HAR dropdown menu in the toolbar, as well as an Import menuitem. Network Monitor features The following articles cover different asp...
UI Tour - Firefox Developer Tools
Note that if you do this, you lose any recordings you have not saved. filter the markers that are displayed in the Waterfall view switch the active tool in the Details pane. ...
...e of the JavaScript engine, and records the stack for the code executing at the time the sample was taken. Statistically, the number of samples taken in which we were executing a particular function corresponds to the amount of time the browser is spending executing it, so you can identify bottlenecks in your code. To learn much more about the Call Tree, see the separate Call Tree page. Flame
Chart If the Call Tree tells you, statistically, which functions your site is spending most time executing across the whole recording, the Flame
Chart tells you the call stack at any given point during the recording: To learn much more about the Flame
Chart, see the separate Flame
Chart page. Allocations The Allocations view is new in Firefox 46. The Allocations view is like the Call Tree vie...
Performance - Firefox Developer Tools
r your site over the profile, and a graph of the frame rate over the profile. You get four sub-tools to examine aspects of the profile in more detail: the Waterfall shows the different operations the browser was performing, such as executing layout, JavaScript, repaints, and garbage collection the Call Tree shows the JavaScript functions in which the browser spent most of its time the Flame
Chart shows the JavaScript call stack over the course of the recording the Allocations view shows the heap allocations made by your code over the course of the recording. This view only appears if you checked "Record Allocations" in the Performance tool settings. Getting started UI Tour To find your way around the Performance tool, here's a quick tour of the UI. How to Basic tas...
... tool, create, save, load, and configure recordings Components of the Performance tool Frame rate Understand your site's overall responsiveness. Call Tree Find bottlenecks in your site's JavaScript. Allocations See the allocations made by your code over the course of the recording. Waterfall Understand the work the browser's doing as the user interacts with your site. Flame
Chart See which JavaScript functions are executing, and when, over the course of the recording. Scenarios Animating CSS properties Uses the Waterfall to understand how the browser updates a page, and how animating different CSS properties can affect performance. Intensive JavaScript Uses the frame rate and Waterfall tools to highlight performance problems caused by long-running ...
Settings - Firefox Developer Tools
toggling this value to true Inspector Show browser styles A setting to control whether styles applied by the browser (user-agent styles) should be displayed in the Inspector's Rules view. Note that this setting is independent of the "Browser styles" checkbox in the Inspector's Computed view. Truncate DOM attributes By default, the Inspector truncates DOM attributes that are more than 120
characters long. Uncheck this box to prevent this behavior. This setting works by toggling the about:config preference "devtools.markup.collapseAttributes". To change the threshold at which attributes are truncated, you can edit the about:config preference "devtools.markup.collapseAttributeLength". Default color unit A setting to control how colors are represented in the inspector: Hex HSL(A) ...
... you click the icon for the Screenshot tool, play a shutter sound. New in Firefox 53. Editor Preferences Preferences for the CodeMirror source editor, which is included in Firefox and used by several developer tools, including Scratchpad and the Style Editor. Detect indentation Auto-indent new lines based on the current indentation. Autoclose brackets Determines whether typing an opening
character like [ or { will cause the editor to insert the matching closing
character ] or } for you. Indent using spaces When checked, indentation will be performed using spaces, when off, the editor will use tabs instead. Tab size The frequency of tab stops in the editor. Select 2, 4, or 8. Keybindings Choose the default CodeMirror keybindings or keybindings from one of several popular editors:...
Console messages - Firefox Developer Tools
pe 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 entered a string on which to filter the output. Click the "x" icon to clear the filter and show the entire list again. ...
...For example, -/(cool|rad)/ shows only items that do not match the expression /(cool|rad)/. Clearing the log Finally, you can use the trashcan icon on the left to clear the contents of the console. When you clear the console, the console cache is also cleared. This prevents errors that have already been loged from reappearing when you reopen the console. ...
AudioTrackList.getTrackById() - Web APIs
The tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource. Example This example suggests a hypothetical game in which movies are used as cut-scenes or other key set pieces within the game. Each movie has one audio track for each
character, as well as one for the music, sound effects, and so forth. This function allows the game to disable a specific
character's audio in order to adjust the movie's performance based on occurrences within the game; if the
character's dialog isn't relevant, it gets left out. Obviously that would require some clever graphic design to make work, but... it's a hypothetical game. function disableCha...
...one for the music, sound effects, and so forth. This function allows the game to disable a specific
character's audio in order to adjust the movie's performance based on occurrences within the game; if the
character's dialog isn't relevant, it gets left out. Obviously that would require some clever graphic design to make work, but... it's a hypothetical game. function disable
Character(videoElem,
characterName) { videoElem.audioTracks.getTrackById(
characterName).enabled = false; } This short function gets the AudioTrackList containing the video's audio tracks using HTMLMediaElement.audioTracks, then calls getTrackById() on it, specifying the
character's name. The resulting track's audio is then disabled by setting its enabled flag to false. Specifications Specification Status...
BasicCardResponse - Web APIs
To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari ? WebView Android No support NoChrome A...
...To change preferences in Firefox, visit about:config.Opera Android No support NoSafari iOS ? Samsung Internet Android Full support 7.0billingAddressChrome No suppo...
BluetoothRemoteGATTDescriptor - Web APIs
The BluetoothRemoteGATTDescriptor interface of the Web Bluetooth API provides a GATT Descriptor, which provides further information about a
characteristic's value. Interface interface BluetoothRemoteGATTDescriptor { readonly attribute BluetoothGATT
Characteristic
characteristic; readonly attribute UUID uuid; readonly attribute ArrayBuffer? value; Promise<ArrayBuffer> readValue(); Promise<void> writeValue(BufferSource value); }; Properties BluetoothRemoteGATTDescriptor.
characteristicRead only Returns the BluetoothRemoteGATT
Characteristic this descriptor belongs to. BluetoothRemoteGATTDescriptor.uuidRead only Returns the UUID of the
characteristic descriptor, for example '00002902-0000-1000-8000-00805f9b34fb' for theClient
Characteristic Configuration descriptor. ...
... Full support 57Notes Disabled Notes Linux and versions of Windows earlier than 10.Disabled From version 57: this feature is behind the #enable-experimental-web-platform-featu...
CSS.escape() - Web APIs
tor. Syntax escapedStr = CSS.escape(str); Parameters str The CSSOMString to be escaped. ...
... Working Draft Initial definition ...
Basic animations - Web APIs
e(img, x, y,imgW, imgH); // amount to move x += dx; } Below is the <canvas> in which the image is scrolled. Note that the width and height specified here must match the values of the CanvasXZSize and CanvasYSize variables in the JavaScript code. ...
... position: fixed; z-index: -1; } body { margin: 0; padding: 0; background-color: rgba(0,0,0,0.05); } </style> </head> <body> <canvas id="cw"></canvas> </body> </html> OutPut Snake Game <!DOCTYPE html> <html lang="en"> <head> <meta
charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Nokia 1100:snake..Member berries</title> </head> <body> <div class="keypress hide"> <div class="up" onclick="emit(38)">↑</div> <div class="right" onclick="emit(39)">→</div> <div class="left" onclick="emit(...
Basic usage of canvas - Web APIs
if (canvas.getContext) { var ctx = canvas.getContext('2d'); // drawing code here } else { // canvas-unsupported code here } A skeleton template Here is a minimalistic template, which we'll be using as a starting point for later examples. Note: it is not good practice to embed a script inside HTML. We do it here to keep the example concise. ...
...ny other event handler, as long as the page has been loaded first. Here is how a template would look in action. As shown here, it is initially blank. A simple example To begin, let's take a look at a simple example that draws two intersecting rectangles, one of which has alpha transparency. We'll explore how this works in more detail in later examples. ...
Using images - Web APIs
his can be a good approach, but once you need to track more than one we need to resort to something more clever. It's beyond the scope of this tutorial to look at image pre-loading tactics, but you should keep that in mind. Embedding an image via data: URL Another possible way to include images is via the data: url. Data URLs allow you to completely define an image as a Base64 encoded string of
characters directly in your code. var img = new Image(); // Create new img element img.src = 'data:image/gif;base64,R0lGODlhCwALAIAAAAAA3pn/ZiH5BAEAAAEALAAAAAALAAsAAAIUhA+hkcuO4lmNVindo7qyrIXiGBYAOw=='; One advantage of data URLs is that the resulting image is available immediately without another round trip to the server. Another potential advantage is that it is also possible to encapsulate in ...
...t. The first four parameters define the location and size of the slice on the source image. The last four parameters define the rectangle into which to draw the image on the destination canvas. Slicing can be a useful tool when you want to make compositions. You could have all elements in a single image file and use this method to composite a complete drawing. For instance, if you want to make a
chart you could have a PNG image containing all the necessary text in a single file and depending on your data could change the scale of your
chart fairly easily. Another advantage is that you don't need to load every image individually, which can improve load performance. Example: Framing an image In this example, we'll use the same rhino as in the previous example, but we'll slice out its head and...
ChildNode - Web APIs
Properties There are neither inherited, nor specific properties. Methods There are no inherited methods. ChildNode.remove() Removes this ChildNode from the children list of its parent. ChildNode.before() Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode. DOMString objects are inserted as equivalent Text nodes. ...
...t with a set of Node or DOMString objects. DOMString objects are inserted as equivalent Text nodes. Specifications Specification Status Comment DOMThe definition of 'ChildNode' in that specification. Living Standard Split the ElementTraversal interface in ParentNode and ChildNode. previousElementSibling and nextElementSibling are now defined on the latter. The
CharacterData and DocumentType implemented the new interfaces. Added the remove(), before(), after() and replaceWith() methods. Element Traversal SpecificationThe definition of 'ElementTraversal' in that specification. Obsolete Added the initial definition of its properties to the ElementTraversal pure interface and use it on Element. Polyfill External on GitHub: childNode.js ...
console - Web APIs
The object is: ({str:"Some text", id:5}) Using string substitutions When passing a string to one of the console object's methods that accepts a string (such as log()), you may use these s...
...: [09:27:13.475] ({str:"Some text", id:5}) Outputting multiple objects You can also output multiple objects by simply listing them when calling the logging method, like this: var car = "Dodge
Charger"; var someObject = { str: "Some text", id: 5 }; console.info("My first car was a", car, ". The object is:", someObject); This output will look like this: [09:28:22.711] My first car was a Dodge
Charger . The object is: ({str:"Some text", id:5}) Using string substitutions When passing a string to one of the console object's methods that accepts a string (such as log()), you may use these substitution strings: %o or %O Outputs a JavaScript object. Clicking the object name opens more information about it in the inspector. %d or %i Outputs an integer. Number formatting is supported, for...
DOMConfiguration - Web APIs
Note: This interface has never been supported in Gecko, and has been removed from the DOM specification. ...
... Note: This interface has never been supported in Gecko, and has been removed from the DOM specification. ...
Document.createAttribute() - Web APIs
it. The object created a node implementing the Attr interface. The DOM does not enforce what sort of attributes can be added to a particular element in this manner. The string given in parameter is converted to lowercase. Syntax attribute = document.createAttribute(name) Parameters name is a string containing the name of the attribute. Return value A Attr node. Exceptions INVALID_
CHARACTER_ERR if the parameter contains invalid
characters for XML attribute. Example var node = document.getElementById("div1"); var a = document.createAttribute("my_attrib"); a.value = "newVal"; node.setAttributeNode(a); console.log(node.getAttribute("my_attrib")); // "newVal" Specifications Specification Status Comment DOMThe definition of 'Document.createAttribute()' ...
...ample var node = document.getElementById("div1"); var a = document.createAttribute("my_attrib"); a.value = "newVal"; node.setAttributeNode(a); console.log(node.getAttribute("my_attrib")); // "newVal" Specifications Specification Status Comment DOMThe definition of 'Document.createAttribute()' in that specification. Living Standard Precised behavior with uppercase
characters Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Document.createAttribute()' in that specification. Obsolete No change. Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Document.createAttribute()' in that specification. Obsolete No change. Document Object Model (DOM) Level 1 SpecificationThe definition of...
Document.createProcessingInstruction() - Web APIs
data) Parameters piNode is the resulting ProcessingInstruction node. target is a string containing the first part of the processing instruction (i.e., <?target ... ?>) data is a string containing any information the processing instruction should carry, after the target. The data is up to you, but it can't contain ?>, since that closes the processing instruction. Exceptions DOM_INVALID_
CHARACTER Throws if either of the following are true: The processing instruction target is invalid -- it should be a valid XML name that doesn't contain "xml", "XML", or any case combination of the two, other than standardized ones such as <?xml-stylesheet ?>. The closing processing instruction sequence (?>) is part of the data. Example var doc = new DOMParser().parseFromString('<foo />'...
...ruction()' in that specification. Obsolete Added more explicit definition of how the data parameter is validated. Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'createProcessingInstruction()' in that specification. Obsolete Added note that the namespace of the target name is not checked whether it is well-formed, defined what is considered an illegal
character for the target name and specified the returned ProcessingInstruction object more precisely. Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'createProcessingInstruction()' in that specification. Obsolete No change Document Object Model (DOM) Level 1 SpecificationThe definition of 'createProcessingInstruction()' in that specification. Obsolet...
Document.execCommand() - Web APIs
ection to the clipboard. Conditions of having this behavior enabled vary from one browser to another, and have evolved over time. Check the compatibility table to determine if you can use it in your case. createLink Creates an hyperlink from the selection, but only if there is a selection. Requires a URI string as a value argument for the hyperlink's href. The URI must contain at least a single
character, which may be whitespace. (Internet Explorer will create a link with a null value.) cut Removes the current selection and copies it to the clipboard. When this behavior is enabled varies between browsers, and its conditions have evolved over time. Check the compatibility table for usage details. decreaseFontSize Adds a <small> tag around the selection or at the insertion point. (Not supp...
... block element containing the line if one exists (in Firefox, <blockquote> is the exception -- it will wrap any containing block element). Requires a tag-name string as a value argument. Virtually all block-level elements can be used. (Internet Explorer and Edge support only heading tags H1-H6, ADDRESS, and PRE, which must be wrapped in angle brackets, such as "<H1>".) forwardDelete Deletes the
character ahead of the cursor's position, identical to hitting the Delete key on a Windows keyboard. heading Adds a heading element around a selection or insertion point line. Requires the tag-name string as a value argument (i.e. "H1", "H6"). (Not supported by Internet Explorer and Safari.) hiliteColor Changes the background color for the selection or at the insertion point. Requires a color valu...
Document: keydown event - Web APIs
For example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is reported as 65 by all events. ...
...For example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is reported as 65 by all events. ...
Element: compositionend event - Web APIs
The compositionend event is fired when a text composition system such as an input method editor completes or cancels the current composition session. For example, this event could be fired after a user finishes entering a Chinese
character using a Pinyin IME. ...
... this event could be fired after a user finishes entering a Chinese
character using a Pinyin IME. ...
Element: compositionstart event - Web APIs
The compositionstart event is fired when a text composition system such as an input method editor starts a new composition session. For example, this event could be fired after a user starts entering a Chinese
character using a Pinyin IME. ...
... this event could be fired after a user starts entering a Chinese
character using a Pinyin IME. ...
Element: compositionupdate event - Web APIs
The compositionupdate event is fired when a new
character is received in the context of a text composition session controlled by a text composition system such as an input method editor. For example, this event could be fired while a user enters a Chinese
character using a Pinyin IME. ...
...example, this event could be fired while a user enters a Chinese
character using a Pinyin IME. ...
Element: keydown event - Web APIs
For example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is reported as 65 by all events. ...
...For example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is reported as 65 by all events. ...
Element - Web APIs
through the browser's user interface. Also available via the onpaste property. Composition events compositionend Fired when a text composition system such as an input method editor completes or cancels the current composition session. compositionstart Fired when a text composition system such as an input method editor starts a new composition session. compositionupdate Fired when a new
character is received in the context of a text composition session controlled by a text composition system such as an input method editor. Focus events blur Fired when an element has lost focus. Also available via the onblur property. focus Fired when an element has gained focus. Also available via the onfocus property focusin Fired when an element is about to gain focus. focusout Fired ...
... or out of full-screen mode. Also available via the onfullscreenchange property. fullscreenerror Sent to an Element if an error occurs while attempting to switch it into or out of full-screen mode. Also available via the onfullscreenerror property. Keyboard events keydown Fired when a key is pressed. Also available via the onkeydown property. keypress Fired when a key that produces a
character value is pressed down. Also available via the onkeypress property. keyup Fired when a key is released. Also available via the onkeyup property. Mouse events auxclick Fired when a non-primary pointing device button (e.g., any mouse button other than the left button) has been pressed and released on an element. Also available via the onauxclick property. click Fired when a point...
FileSystemEntrySync - Web APIs
newName The new name of the entry. If you do not specify a name, the browser preserves the entry's current name. Returns FileSystemEntrySync An object that represents an entry in the file system. Exceptions This method can raise a FileException with the following codes: Exception Description ENCODING_ERR The name supplied is invalid, because at least one of the
characters is reserved or illegal. Examples include a backslash (\), dot (.), and two dots (..). NOT_FOUND_ERR The target directory does not exist. INVALID_MODIFICATION_ERR You tried one of the following disallowed operations: Moving an entry into its parent without changing its name Moving a parent directory into one of its child directories. [todo: v...
...new name of the entry. If you do not specify a name, the browser preserves the FileSystemEntrySync's current name. Returns FileSystemEntrySync An object that represents an entry in the file system. Exceptions This method can raise a FileException with the following codes: Exception Description ENCODING_ERR The name supplied is invalid, because at least one of the
characters is reserved or illegal. Examples include a backslash (\), dot (.), and two dots (..). NOT_FOUND_ERR The target directory does not exist. INVALID_MODIFICATION_ERR You tried one of the following disallowed operations: Moving an entry into its parent without changing its name Moving a parent directory into one of its child directories. ...
GlobalEventHandlers.onchange - Web APIs
side of the control or by using the Tab key to switch to a different control. Note: Unlike oninput, the onchange event handler is not necessarily called for each alteration to an element's value. Syntax target.onchange = functionRef; functionRef is a function name or a function expression. The function receives an Event object as its sole argument. Example This example logs the number of
characters in an <input> element, every time you modify its contents and then change focus away from it. HTML <input type="text" placeholder="Type something here, then click outside of the field." size="50"> <p id="log"></p> JavaScript let input = document.querySelector('input'); let log = document.getElementById('log'); input.onchange = handleChange; function handleChange(e) { log.textContent...
...contents and then change focus away from it. HTML <input type="text" placeholder="Type something here, then click outside of the field." size="50"> <p id="log"></p> JavaScript let input = document.querySelector('input'); let log = document.getElementById('log'); input.onchange = handleChange; function handleChange(e) { log.textContent = `The field's value is ${e.target.value.length}
character(s) long.`; } Result Specification Specification Status Comment HTML Living StandardThe definition of 'onchange' in that specification. Living Standard ...
GlobalEventHandlers.oninput - Web APIs
ents on elements where contenteditable or designMode are turned on. Note: Unlike oninput, the onchange event handler is not necessarily called for each alteration to an element's value. Syntax target.oninput = functionRef; Value functionRef is a function name or a function expression. The function receives an InputEvent object as its sole argument. Example This example logs the number of
characters in an <input> element, every time you modify its contents. HTML <input type="text" placeholder="Type something here to see its length." size="50"> <p id="log"></p> JavaScript let input = document.querySelector('input'); let log = document.getElementById('log'); input.oninput = handleInput; function handleInput(e) { log.textContent = `The field's value is ${e.target.value.lengt...
...ers in an <input> element, every time you modify its contents. HTML <input type="text" placeholder="Type something here to see its length." size="50"> <p id="log"></p> JavaScript let input = document.querySelector('input'); let log = document.getElementById('log'); input.oninput = handleInput; function handleInput(e) { log.textContent = `The field's value is ${e.target.value.length}
character(s) long.`; } Result Specifications Specification Status Comment HTML Living StandardThe definition of 'oninput' in that specification. Living Standard Initial definition ...
msAudioCategory - Web APIs
oreGroundOnlyMedia Games or other sounds designed only to work in the foreground, but will mute existing background media sounds. ...
...ture films (designed to pause when they go to the background) No GameEffects Game sound effects designed to mix with existing audio
Characters talking All non-music sounds No GameMedia Background music played by a game No SoundEffects Game or other sound effects designed to mix with existing audio:
Characters talking Beeps, dings, brief sounds No Other Default audio type, and recommended for all audio media that does not need to continue playing in the background. No If msAudioDeviceType is not explicitly set, msAudioDeviceType will be set to Communications. For hardware audio offload to be automatically applied, the audio category must be set to Foregro...
HTMLImageElement.alt - Web APIs
ngicon.svg" alt="Songs"</a> <a href="albums.html" aria-role="button"><img src="albumicon.svg" alt="Albums"</a> <a href="artists.html" aria-role="button"><img src="artisticon.svg" alt="Artists"</a> <a href="playlists.html" aria-role="button"><img src="playlisticon.svg" alt="Playlists"</a> </li> Images containining diagrams or maps When an image contains information presented as a diagram,
chart, graph, or map, the alt text should provide the same information, at least in summary form. This is true whether the /me image is in a bitmapped format such as PNG or JPEG or in a vector format like SVG. For a map, the alt text could be directions to the place indicated by the map, similarly to how you would explain it verbally. For a
chart, the text could describe the items in the
chart and...
...This may impact the decisions you make shen writing the alt text for the diagram. ...
HTMLInputElement.setSelectionRange() - Web APIs
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.setSelectionRange(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 last selected
character. An index greater than the length of the element's value is treated as pointing to the end of the value. selectionDirection Optional A string indicating the direction in which the selection is considered...
...ength of the element's value is treated as pointing to the end of the value. selectionDirection Optional A string indicating the direction in which the selection is considered to have been performed. Possible values: "forward" "backward" "none" if the direction is unknown or irrelevant. Default 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.setSelectionRange(2, 5); } Result Specifications Specification Status Comment ...
HTMLLinkElement - Web APIs
ibute, as a list of tokens. HTMLLinkElement.sizes Read only Is a DOMSettableTokenList that reflects the sizes HTML attribute, as a list of tokens. LinkStyle.sheet Read only Returns the StyleSheet object associated with the given element, or null if there is none. HTMLLinkElement.type Is a DOMString representing the MIME type of the linked resource. Obsolete properties HTMLLinkElement.
charset Is a DOMString representing the
character encoding for the target resource. HTMLLinkElement.rev Is a DOMString representing the reverse relationship of the linked resource from the resource to the document. Note: Currently the W3C HTML 5.2 spec states that rev is no longer obsolete, whereas the WHATWG living standard still has it labeled obsolete. Until this discrepancy is resolved, yo...
... Living StandardThe definition of 'HTMLLinkElement' in that specification. Living Standard Adds the following properties: crossOrigin, referrerPolicy, and as. HTML 5.1The definition of 'HTMLLinkElement' in that specification. Recommendation HTML5The definition of 'HTMLLinkElement' in that specification. Recommendation The following properties are now obsolete:
charset, rev, and shape. The following properties have been added: relList, and sizes. Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLLinkElement' in that specification. Obsolete Added a second inheritence, the LinkStyle interface. Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLLinkElement' in that specification. Obs...
KeyboardEvent.ctrlKey - Web APIs
The KeyboardEvent.ctrlKey read-only property returns a Boolean that indicates if the control key was pressed (true) or not (false) when the event occured. ...
...key was pressed (true) or not (false) when the event occured. Syntax var ctrlKeyPressed = instanceOfKeyboardEvent.ctrlKey Return value A Boolean Example <html> <head> <title>ctrlKey example</title> <script type="text/javascript"> function show
Char(e){ alert( "Key Pressed: " + e.key + "\n" + "CTRL key pressed: " + e.ctrlKey + "\n" ); } </script> </head> <body onkeypress="show
Char(event);"> <p>Press any
character key, with or without holding down the CTRL key.<br /> You can also use the SHIFT key together with the CTRL key.</p> </body> </html> Specifications Specification Status Comment Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'KeyboardEvent.ctrlKey' in that specification. Obsolete Initial definition. ...
LockManager.request() - Web APIs
The requested Lock is passed to a callback, while the function itself returns a Promise that resolves with undefined. The mode property of the options parameter may be either "exclusive" or "shared". Request an "exclusive" lock when it should only be held by one code instance at a time. This applies to code in both tabs and workers. Use this to represent mutually exclusive access to a resource. When an "exclusive" lock for a given name is held, no other lock with the same name can be held. ...
...hared" lock) but only one writer (a single "exclusive" lock). This is known as the readers-writer pattern. In the IndexedDB API, this is exposed as "readonly" and "readwrite" transactions which have the same semantics. Syntax LockManager.request(var promise = name[, {options}], callback) Parameters name An identifier for the lock you want to request. options Optional An object describing
characteristics of the lock you want to create. Valid values are: mode Optional: Either "exclusive" or "shared". The default value is "exclusive". ifAvailable Optional: If true, the lock request will only be granted if it is not already held. If it cannot be granted, the callback will be invoked with null instead of a Lock instance. The default value is false. steal Optional: If true, then any...
Navigator.battery - Web APIs
This interface was introduced in early drafts of the Battery Status API and but has been replaced with Promise-based Navigator.getBattery(). ...
...This interface was introduced in early drafts of the Battery Status API and but has been replaced with Promise-based Navigator.getBattery(). ...
Navigator.getBattery() - Web APIs
ions of some User Agents might allow use of this feature in insecure contexts. NotAllowedError Note: No User Agent currently throws this exception, but the specification describes the following behaviors: This document is not allowed to use this feature. For example, it might not be explicitly allowed or restricted via Feature-Policy battery feature. ...
...cure contexts. NotAllowedError Note: No User Agent currently throws this exception, but the specification describes the following behaviors: This document is not allowed to use this feature. For example, it might not be explicitly allowed or restricted via Feature-Policy battery feature. Example This example fetches the current
charging state of the battery and establishes a handler for the
chargingchange event, so that the
charging state is recorded whenever it changes. let batteryIs
Charging = false; navigator.getBattery().then(function(battery) { batteryIs
Charging = battery.
charging; battery.addEventListener('
chargingchange', function() { batteryIs
Charging = battery.
charging; }); }); For more examples and details, see Battery Status API. Specifications Specific...
NonDocumentTypeChildNode - Web APIs
Properties There are no inherited properties. ...
... There are neither inherited nor specific methods. Specifications Specification Status Comment DOMThe definition of 'NonDocumentTypeChildNode' in that specification. Living Standard Splitted the ElementTraversal interface in ParentNode, ChildNode, and NonDocumentTypeChildNode. The previousElementSibling and nextElementSibling are now defined on the latter. The
CharacterData and Element implemented the new interfaces. Element Traversal SpecificationThe definition of 'ElementTraversal' in that specification. Obsolete Added the initial definition of its properties to the ElementTraversal pure interface and use it on Element. ...
PaymentAddress.toJSON() - Web APIs
it chrome://flags.Edge Full support 15Firefox Full support 62Notes Disabled Full support 62Notes Disabled Notes Available only in nightly builds. Requires the comma-delineated list in dom.payments.request.supportedRegions to contain one or more of the supported 2-
character ISO locales, currently US and CA.Disabled From version 62: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari Full support ...
... be set to Enabled). To change preferences in Chrome, visit chrome://flags.Firefox Android Full support 62Notes Disabled Full support 62Notes Disabled Notes Available only in nightly builds. Requires the comma-delineated list in dom.payments.request.supportedRegions to contain one or more of the supported 2-
character ISO locales, currently US and CA.Disabled From version 62: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.Opera Android No support NoSafari iOS Full support YesSamsung Internet Android No ...
PaymentItem - Web APIs
This may be displayed to the user by the user agent, depending on the design of the interface. ...
...This may be displayed to the user by the user agent, depending on the design of the interface. pending Secure context A Boolean value which is true if the specified amount has not yet been finalized. ...
RTCDTMFSender.insertDTMF() - Web APIs
pecified tones to the end of the current tone buffer, so that those tones play after the previously-enqueued tones. Syntax RTCDTMFSender.insertDTMF(tones[, duration[, interToneGap]]); Parameters tones A DOMString containing the DTMF codes to be transmitted to the recipient. Specifying an empty string as the tones parameter clears the tone buffer, aborting any currently queued tones. A ","
character inserts a two second delay. duration Optional The amount of time, in milliseconds, that each DTMF tone should last. This value must be between 40 ms and 6000 ms (6 seconds), inclusive. The default is 100 ms. interToneGap Optional The length of time, in milliseconds, to wait between tones. The browser will enforce a minimum value of 30 ms (that is, if you specify a lower value, 30 ms will...
...interToneGap Optional The length of time, in milliseconds, to wait between tones. The browser will enforce a minimum value of 30 ms (that is, if you specify a lower value, 30 ms will be used instead); the default is 70 ms. Return value undefined Exceptions InvalidStateError The DTMF tones couldn't be sent because the track has been stopped, or is in a read-only or inactive state. Invalid
CharacterError One or more of the
characters in tones is not valid DTMF. Example tbd Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCDTMFSender.insertDTMF()' in that specification. Candidate Recommendation ...
RTCDTMFSender.toneBuffer - Web APIs
erConnection. To place tones into the buffer, call insertDTMF(). Tones are removed from the string as they're played, so only upcoming tones are listed. Syntax var toneBuffer = RTCDTMFSender.toneBuffer; Value A DOMString listing the tones to be played. If the string is empty, there are no tones pending. Tone buffer format The tone buffer is a string which can contain any combination of the
characters that are permitted by the DTMF standard. DTMF tone
characters The digits 0-9 These
characters represent the digit keys on a telephone keypad. The letters A-D These
characters represent the "A" through "D" keys which are part of the DTMF standard but not included on most telephones. These are not interpreted as digits. Lower-case "a"-"d" automatically gets converted to upper-case. Th...
...racters represent the "A" through "D" keys which are part of the DTMF standard but not included on most telephones. These are not interpreted as digits. Lower-case "a"-"d" automatically gets converted to upper-case. The pound/hash sign ("#") and the asterisk ("*") These correspond to the similarly-labeled keys which are typically on the bottom row of the telephone keypad. The comma (",") This
character instructs the dialing process to pause for two seconds before sending the next
character in the buffer. All other
characters are unrecognized and will cause insertDTMF() to throw an Invalid
CharacterError exception. Using tone buffer strings For example, if you're writing code to control a voicemail system by sending DTMF codes, you might use a string such as "*,1,5555". In this example...
ReadableStream.getReader() - Web APIs
ead using a ReadableStreamDefaultReader created using getReader(). (see our Simple random stream example for the full code). Each chunk is read sequentially and output to the UI, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the UI. function fetchStream() { const reader = stream.getReader(); let
charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.
...ed reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = value; return; } // value for fetch streams is a Uint8Array
charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Received ' +
charsReceived + '
characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Specifications Specific...
ReadableStream.tee() - Web APIs
array) are passed to a function that reads the data out of the two streams and prints each stream's chunks sequentially to a different part of the UI. See Simple tee example for the full code. function teeStream() { const teedOff = stream.tee(); fetchStream(teedOff[0], list2); fetchStream(teedOff[1], list3); } function fetchStream(stream, list) { const reader = stream.getReader(); let
charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); retur...
... // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); return; } // value for fetch streams is a Uint8Array
charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Read ' +
charsReceived + '
characters so far. Current chunk = ' + chunk; list.appendChild(listItem); // Read some more, and call this function again return reader.read().then(processText); }); } Specifications Specification Status Comment ...
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
ead using a ReadableStreamDefaultReader created using getReader(). (see our Simple random stream example for the full code). Each chunk is read sequentially and output to the UI, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the UI. function fetchStream() { const reader = stream.getReader(); let
charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.
...d reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; } // value for fetch streams is a Uint8Array
charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Received ' +
charsReceived + '
characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Specifications Specific...
ReadableStreamDefaultReader.cancel() - Web APIs
nk is read sequentially and output to the UI, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the UI. When the stream is done (if (done)), we run reader.cancel() to cancel the stream, signalling that we don't need to use it any more. function fetchStream() { const reader = stream.getReader(); let
charsReceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); reade...
...function processText({ done, value }) { // Result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); reader.cancel(); para.textContent = result; return; } // value for fetch streams is a Uint8Array
charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Received ' +
charsReceived + '
characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Specifications Specific...
SVGAltGlyphElement - Web APIs
Properties This interface also inherits properties from its parent interface, SVGGraphicsElement. SVGAltGlyphElement.glyphRef It corresponds to the attribute glyphRef on the given element. It's data type is 'String'. ...
... Properties This interface also inherits properties from its parent interface, SVGGraphicsElement. SVGAltGlyphElement.glyphRef It corresponds to the attribute glyphRef on the given element. It's data type is 'String'. ...
Selection - Web APIs
u made your selection. Properties Selection.anchorNodeRead only Returns the Node in which the selection begins. Can return null if selection never existed in the document (e.g., an iframe that was never clicked on). Selection.anchorOffsetRead only Returns a number representing the offset of the selection's anchor within the anchorNode. If anchorNode is a text node, this is the number of
characters within anchorNode preceding the anchor. If anchorNode is an element, this is the number of child nodes of the anchorNode preceding the anchor. Selection.focusNodeRead only Returns the Node in which the selection ends. Can return null if selection never existed in the document (for example, in an iframe that was never clicked on). Selection.focusOffsetRead only Returns a number represe...
... anchorNode preceding the anchor. Selection.focusNodeRead only Returns the Node in which the selection ends. Can return null if selection never existed in the document (for example, in an iframe that was never clicked on). Selection.focusOffsetRead only Returns a number representing the 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. Selection.rangeCountRead only Returns the number of ranges in the selection. Selection.typeRead only Returns a DOMS...
SubtleCrypto.deriveKey() - Web APIs
e SubtleCrypto interface can be used to derive a secret key from a master key. It takes as arguments some initial key material, the derivation algorithm to use, and the desired properties for the key to derive. It returns a Promise which will be fulfilled with a CryptoKey object representing the new key. It's worth noting that the three key derivation algorithms you can use have quite different
characteristics and are appropriate in quite different situations. See Supported algorithms for some more detail on this. Syntax const result = crypto.subtle.deriveKey( algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages ); Parameters algorithm is an object defining the derivation algorithm to use. To use ECDH, pass an EcdhKeyDeriveParams object. To use...
...'t contain deriveKey. NotSupported Raised when trying to use an algorithm that is either unknown or isn't suitable for derivation, or if the algorithm requested for the derived key doesn't define a key length. SyntaxError Raised when keyUsages is empty but the unwrapped key is of type secret or private. Supported algorithms The three algorithms supported by deriveKey() have quite different
characteristics and are appropriate in different situations. ECDH ECDH (Elliptic Curve Diffie-Hellman) is a key-agreement algorithm. It enables two people who each have an ECDH public/private key pair to generate a shared secret: that is, a secret that they -- and noone else -- share. They can then use this shared secret as a symmetric key to secure their communication, or can use the secret as an i...
SubtleCrypto.exportKey() - Web APIs
"click", () => { exportCryptoKey(key); }); }); PKCS #8 export This example exports an RSA private signing key as a PKCS #8 object. The exported key is then PEM-encoded. See the complete code on GitHub. /* Convert an ArrayBuffer into a string from https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String */ function ab2str(buf) { return String.from
CharCode.apply(null, new Uint8Array(buf)); } /* Export the given key and write it into the "exported-key" space. */ async function exportCryptoKey(key) { const exported = await window.crypto.subtle.exportKey( "pkcs8", key ); const exportedAsString = ab2str(exported); const exportedAsBase64 = window.btoa(exportedAsString); const pemExported = `-----BEGIN PRIVATE KEY-----\n${exportedA...
... exportCryptoKey(keyPair.privateKey); }); }); SubjectPublicKeyInfo export This example exports an RSA public encryption key as a PEM-encoded SubjectPublicKeyInfo object. See the complete code on GitHub. /* Convert an ArrayBuffer into a string from https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String */ function ab2str(buf) { return String.from
CharCode.apply(null, new Uint8Array(buf)); } /* Export the given key and write it into the "exported-key" space. */ async function exportCryptoKey(key) { const exported = await window.crypto.subtle.exportKey( "spki", key ); const exportedAsString = ab2str(exported); const exportedAsBase64 = window.btoa(exportedAsString); const pemExported = `-----BEGIN PUBLIC KEY-----\n${exportedAsB...
SubtleCrypto.importKey() - Web APIs
ey from a PEM-encoded PKCS #8 object. See the complete code on GitHub. ...
...ic encryption key from a PEM-encoded SubjectPublicKeyInfo object. See the complete code on GitHub. ...
TextDecoder - Web APIs
The TextDecoder interface represents a decoder for a specific text encoding, such as UTF-8, ISO-8859-2, KOI8-R, GBK, etc. A decoder takes a stream of bytes as input and emits a stream of code points. Examples Representing text with typed arrays This example shows how to decode a Chinese/Japanese
character , as represented by five different typed arrays: Uint8Array, Int8Array, Uint16Array, Int16Array, and Int32Array. let utf8decoder = new TextDecoder(); // default 'utf-8' or 'utf8' let u8arr = new Uint8Array([240, 160, 174, 183]); let i8arr = new Int8Array([-16, -96, -82, -73]); let u16arr = new Uint16Array([41200, 47022]); let i16arr = new Int16Array([-24336, -18514]); let i32arr = new Int32Array([-1213292304]); console.log(utf8decoder.decode(u8arr)); console.log(utf8decoder.decode(i8ar...
... let win1251decoder = new TextDecoder('windows-1251'); let bytes = new Uint8Array([207, 240, 232, 226, 229, 242, 44, 32, 236, 232, 240, 33]); console.log(win1251decoder.decode(bytes)); // ??????, ???! Constructor TextDecoder() Returns a newly constructed TextDecoder that will generate a code point stream with the decoding method speci...
UIEvent - Web APIs
fill: #0095DD; pointer-events: all;} Constructors UIEvent() Creates a UIEvent object. Properties This interface also inherits properties of its parent, Event. UIEvent.cancelBubble Is a Boolean indicating whether the bubbling of the event has been canceled or not. UIEvent.detailRead only Returns a long with details about the event, depending on the event type. UIEvent.is
Char Read only Returns a Boolean indicating whether the event produced a key
character or not. UIEvent.layerX Read only Returns the horizontal coordinate of the event relative to the current layer. UIEvent.layerY Read only Returns the vertical coordinate of the event relative to the current layer. UIEvent.pageX Read only Returns the horizontal coordinate of the event relative to the...
... the whole document. UIEvent.sourceCapabilities Read only Returns an instance of the InputDeviceCapabilities interface, which provides information about the physical device responsible for generating a touch event. UIEvent.viewRead only Returns a WindowProxy that contains the view that generated the event. UIEvent.which Read only Returns the numeric keyCode of the key pressed, or the
character code (
charCode) for an alphanumeric key pressed. Methods This interface also inherits methods of its parent, Event. UIEvent.initUIEvent() Initializes a UIEvent object. If the event has already being dispatched, this method does nothing. Specifications Specification Status Comment InputDeviceCapabilities Draft Added sourceCapabilities property. ...
Using IIR filters - Web APIs
wn if none of the alaready available settings is right for what you want. As well as this, if your audio graph needed a highpass and a bandpass filter within it, you could just use one IIR filter node in place of the two biquad filter nodes you would otherwise need for this. With the IIRFIlter node it's up to you to set what feedforward and feedback values the filter needs -- this determines the
characteristics of the filter. The downside is that this involves some complex maths. If you are looking to learn more there's some information about the maths behind IIR filters here. This enters the realms of signal processing theory -- don't worry if you look at it and feel like it's not for you. If you want to play with the IIR filter node and need some values to help along the way, there's a ta...
...o, otherwise nothing would be sent to the filter. Something like this is acceptable: let feedForward = [0.00020298, 0.0004059599, 0.00020298]; Our feedback values cannot start with zero, otherwise on the first pass nothing would be sent back: let feedBackward = [1.0126964558, -1.9991880801, 0.9873035442]; Note: These values are calculated based on the lowpass filter specified in the filter
characteristics of the Web Audio API specification. As this filter node gains more popularity we should be able to collate more coefficient values. Using an IIRFilter in an audio graph Let's create our context and our filter node: const AudioContext = window.AudioContext || window.webkitAudioContext; const audioCtx = new AudioContext(); const iirFilter = audioCtx.createIIRFilter(feedForward, feed...
Web Bluetooth API - Web APIs
The Web Bluetooth API provides the ability to connect and interact with Bluetooth Low Energy peripherals. Interfaces Bluetooth Returns a Promise to a BluetoothDevice object with the specified options. BluetoothAdvertisingData Provides advertising data about a particular Bluetooth device. Bluetooth
CharacteristicProperties Provides properties of a particular BluetoothRemoteGATT
Characteristic. BluetoothDevice Represents a Bluetooth device inside a particular script execution environment. BluetoothRemoteGATT
Characteristic Represents a GATT
Characteristic, which is a basic data element that provides further information about a peripheral's service. BluetoothRemoteGATTDescriptor Represents a GATT Descriptor, which provides further information about a
characteristic's value. Bl...
...s further information about a peripheral's service. BluetoothRemoteGATTDescriptor Represents a GATT Descriptor, which provides further information about a
characteristic's value. BluetoothRemoteGATTServer Represents a GATT Server on a remote device. BluetoothRemoteGATTService Represents a service provided by a GATT server, including a device, a list of referenced services, and a list of the
characteristics of this service. Specifications Specification Feedback Web Bluetooth To provide feedback on the Web Bluetooth API, file a spec issue. ...
Using the Web Speech API - Web APIs
to be included first. The second line indicates a type of term that we want to recognise. public declares that it is a public rule, the string in angle brackets defines the recognised name for this term (color), and the list of items that follow the equals sign are the alternative values that will be recognised and accepted as appropriate values for the term. Note how each is separated by a pipe
character. You can have as many terms defined as you want on separate lines following the above structure, and include fairly complex grammar definitions. For this basic demo, we are just keeping things simple. Plugging the grammar into our speech recognition The next thing to do is define a speech recogntion instance to control the recognition for our application. This is done using the SpeechRe...
...es[i].name === selectedOption) { utterThis.voice = voices[i]; } } utterThis.pitch = pitch.value; utterThis.rate = rate.value; synth.speak(utterThis); In the final part of the handler, we include an SpeechSynthesisUtterance.onpause handler to demonstrate how SpeechSynthesisEvent can be put to good use. When SpeechSynthesis.pause() is invoked, this returns a message reporting the
character number and name that the speech was paused at. utterThis.onpause = function(event) { var
char = event.utterance.text.
charAt(event.
charIndex); console.log('Speech paused at
character ' + event.
charIndex + ' of "' + event.utterance.text + '", which is "' +
char + '".'); } Finally, we call blur() on the text input. This is mainly to hide the keyboard on Firefox OS. inputTx...
Sending and Receiving Binary Data - Web APIs
rue); oReq.responseType = "blob"; oReq.onload = function(oEvent) { var blob = oReq.response; // ... }; oReq.send(); Receiving binary data in older browsers The load_binary_resource() function shown below loads binary data from the specified URL, returning it to the caller. function load_binary_resource(url) { var req = new XMLHttpRequest(); req.open('GET', url, false); //XHR binary
charset opt by Marcus Granado 2006 [http://mgran.blogspot.com] req.overrideMimeType('text\/plain;
charset=x-user-defined'); req.send(null); if (req.status != 200) return ''; return req.responseText; } The magic happens in line 5, which overrides 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...
...-user-defined'); req.send(null); if (req.status != 200) return ''; return req.responseText; } The magic happens in line 5, which overrides 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 transmissi...
Synchronous and asynchronous requests - Web APIs
ted. If the result is 200 -- HTTP's "OK" result -- the document's text content is output to the console. Example: Synchronous HTTP request from a Worker One of the few cases in which a synchronous request does not usually block execution is the use of XMLHttpRequest within a Worker. ...
...mpts to submit data to a server by using a synchronous XMLHttpRequest in an unload handler. This results in the unloading of the page to be delayed. window.addEventListener('unload', logData, false); function logData() { var client = new XMLHttpRequest(); client.open("POST", "/log", false); // third parameter indicates sync xhr. :( client.setRequestHeader("Content-Type", "text/plain;
charset=UTF-8"); client.send(analyticsData); } Using the sendBeacon() method, the data will be transmitted asynchronously to the web server when the User Agent has had an opportunity to do so, without delaying the unload or affecting the performance of the next navigation. The following example shows a theoretical analytics code pattern that submits data to a server by using the sendBeacon() me...
XMLHttpRequest.sendAsBinary() - Web APIs
ld instead simply use the send() method, which now supports binary data in various forms. Syntax XMLHttpRequest.sendAsBinary(binaryString); Parameters binaryString A DOMString which encodes the binary content to be sent. You can create the binary string using the FileReader method readAsBinaryString(). The string is converted to binary for transfer by removing the high-order byte of each
character. Return value undefined. Polyfill Since sendAsBinary() is an experimental feature, here is a polyfill for browsers that don't support the sendAsBinary() method but support typed arrays. /*\ |*| |*| :: XMLHttpRequest.prototype.sendAsBinary() Polyfill :: |*| |*| https://developer.mozilla.org/docs/DOM/XMLHttpRequest#sendAsBinary() |*| \*/ if (!XMLHttpRequest.prototype.sendAsBinary) { ...
... |*| |*| :: XMLHttpRequest.prototype.sendAsBinary() Polyfill :: |*| |*| https://developer.mozilla.org/docs/DOM/XMLHttpRequest#sendAsBinary() |*| \*/ if (!XMLHttpRequest.prototype.sendAsBinary) { XMLHttpRequest.prototype.sendAsBinary = function (sData) { var nBytes = sData.length, ui8Data = new Uint8Array(nBytes); for (var nIdx = 0; nIdx < nBytes; nIdx++) { ui8Data[nIdx] = sData.
charCodeAt(nIdx) & 0xff; } /* send as ArrayBufferView...: */ this.send(ui8Data); /* ...or as ArrayBuffer (legacy)...: this.send(ui8Data.buffer); */ }; } Note: It's possible to build this polyfill putting two types of data as argument for send(): an ArrayBuffer (ui8Data.buffer - the commented code) or an ArrayBufferView (ui8Data, which is a typed array of 8-bit unsigned integers - un...
Web APIs
ioWorklet AudioWorkletGlobalScope AudioWorkletNode AudioWorkletNodeOptions AudioWorkletProcessor AuthenticatorAssertionResponse AuthenticatorAttestationResponse AuthenticatorResponse B BaseAudioContext BasicCardRequest BasicCardResponse BatteryManager BeforeInstallPromptEvent BeforeUnloadEvent BiquadFilterNode Blob BlobBuilder BlobEvent Bluetooth BluetoothAdvertisingData Bluetooth
CharacteristicProperties BluetoothDevice BluetoothRemoteGATT
Characteristic BluetoothRemoteGATTDescriptor BluetoothRemoteGATTServer BluetoothRemoteGATTService Body BroadcastChannel BudgetService BudgetState BufferSource ByteLengthQueuingStrategy ByteString C CDATASection CSS CSSConditionRule CSSCounterStyleRule CSSGroupingRule CSSImageValue CSSKeyframeRule CSSKeyframesRule CSSK...
...itiveValue CSSPseudoElement CSSRule CSSRuleList CSSStyleDeclaration CSSStyleRule CSSStyleSheet CSSStyleValue CSSSupportsRule CSSUnitValue CSSUnparsedValue CSSValue CSSValueList CSSVariableReferenceValue Cache CacheStorage CanvasCaptureMediaStreamTrack CanvasGradient CanvasImageSource CanvasPattern CanvasRenderingContext2D CaretPosition ChannelMergerNode ChannelSplitterNode
CharacterData ChildNode Client Clients Clipboard ClipboardEvent ClipboardItem CloseEvent Comment CompositionEvent ConstantSourceNode ConstrainBoolean ConstrainDOMString ConstrainDouble ConstrainULong ContentIndex ContentIndexEvent ConvolverNode CountQueuingStrategy CrashReportBody Credential CredentialsContainer Crypto CryptoKey CryptoKeyPair CustomElementRegistry CustomEvent D DOMC...
Web accessibility for seizures and physical reactions - Accessibility
asurment of lux, because devices with a light sensor usually adjust the brightess of the screen automatically. The specifications also note the difference in technology, such as e-ink, which remains readable in bright daylight, versus liquid crystals, which do not. environment-blending From W3C's Draft document, Media Queries Level 5: "The environment-blending media feature is used to query the
characteristics of the user's display so the author can adjust the style of the document. An author might choose to adjust the visuals and/or layout of the page depending on the display technology to increase the appeal or improve legibility." User Preference Media Features (Planned in Media Queries Level 5) User Preference Media Features in W3C Editor's Draft Media Queries Level 5 are especially pr...
...rstanding 2.3.1 - missing/vague dimension definitions #585 Epilepsy and Seizures Shedding Light on Photosensitivity, One of Epilepsy's Most Complex Conditions Epilepsy Foundation Certain individuals are born with special sensitivity to flashing lights or contrasting visual patterns, such as stripes, grids and checkerboards. Because of this condition, their brain will produce seizure-like dis
charges when exposed to this type of visual stimulation Gamma oscillations and photosensitive epilepsy Current Biology Volume 27, Issue 9, 8 May 2017, Pages R336-R338 Certain visual images, even in the absence of motion or flicker, can trigger seizures in patients with photosensitive epilepsy. Photosensitive Seizures. Cedars-Sinai "Photosensitive seizures are triggered by flashing or flickering ligh...
Operable - Accessibility
his is very important so that keyboard users do not get trapped on specific sections of your apps. 2.1.3 Keyboard -- all functionality (AAA) This is a further step beyond criterion 2.1.1. To achieve AAA conformance, all functionality should be accessible using keyboard controls -- with no exceptions. ...
...trapped on specific sections of your apps. 2.1.3 Keyboard -- all functionality (AAA) This is a further step beyond criterion 2.1.1. To achieve AAA conformance, all functionality should be accessible using keyboard controls -- with no exceptions. See UI controls and Building keyboard accessibility back in 2.1.4
Character Key Shortcuts (A) added in 2.1 If a single
character key shortcut exists, then at least one of the following is true: single
character key shortcuts can be turned off, remapped or are only active when the relevant user interface component is in focus. Understanding
Character Key Shortcuts Note: Also see the WCAG description for Guideline 2.1 Keyboard Accessible: Make all functionality available from a keyboard. Guideline 2.2 -- En...
::before (:before) - CSS: Cascading Style Sheets
/* CSS3 syntax */ ::before /* CSS2 syntax */ :before Note: CSS3 introduced the ::before notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :before, introduced in CSS2. Examples Adding quotation marks One simple example of using ::before pseudo-elements is to provide quotation marks. Here we use both ::before and ::after to insert quotation
characters. HTML <q>Some quotes,</q> he said, <q>are better than none.</q> CSS q::before { content: "<<"; color: blue; } q::after { content: ">>"; color: red; } Result Decorative example We can style text or images in the content property almost any way we want. HTML <span class="ribbon">Notice where the orange box is.</span> CSS .ribbon { background-color: #5BC8F7; } .ribbon:...
... JavaScript var list = document.querySelector('ul'); list.addEventListener('click', function(ev) { if (ev.target.tagName === 'LI') { ev.target.classList.toggle('done'); } }, false); Here is the above code example running live. Note that there are no icons used, and the check-mark is actually the ::before that has been styled in CSS. Go ahead and get some stuff done. Result Special
characters As this is CSS; not HTML, you can not use markup entities in content values. If you need to use a special
character, and can not enter it literally into your CSS content string, use a unicode escape sequence, consisting of a backslash followed by the hexadecimal unicode value. HTML <ol> <li>Crack Eggs into bowl</li> <li>Add Milk</li> <li>Add Flour</li> <li aria-current='step'>Mix...
system - CSS: Cascading Style Sheets
ample, if the original symbols provided were "?" and "?", on each successive pass, they will become "??" and "??", "???" and "???" and so on. At least one symbol must be specified in the symbols descriptor or the counter style is not valid. This counter system works for positive counter values only. alphabetic Interprets the specified symbols as digits, to an alphabetic numbering system. If the
characters "a" to "z" are specified as symbols in a counter style, with the alphabetic system, then the first 26 counter representations will be "a", "b" upto "z". Until this point, the behavior is the same as that of the symbolic system, described above. However, after "z", it will continue as "aa", "ab", "ac"... The symbols descriptor must contain at least two symbols or the counter style is not ...
... HTML <ul class="list"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul> CSS @counter-style alpha-modified { system: extends lower-alpha; prefix: "("; suffix: ") "; } ul { list-style: alpha-modified; } Result Specifications Specification Status Comment CSS Counter Styles Le...
At-rules - CSS: Cascading Style Sheets
At-rules are CSS statements that instructs CSS how to behave. They begin with an at sign, '@' (U+0040 COMMERCIAL AT), followed by an identifier and includes everything up to the next semicolon, ';' (U+003B SEMICOLON), or the next CSS block, whichever comes first. /* General structure */ @IDENTIFIER (RULE); /* Example: tells browser to use UTF-8
character set */ @
charset "utf-8"; There are several at-rules, designated by their identifiers, each with a different syntax: @
charset -- Defines the
character set used by the style sheet. @import -- Tells the CSS engine to include an external style sheet. @namespace -- Tells the CSS engine that all its content must be considered prefixed with an XML namespace. Nested at-rules -- A subset of nested statements, which can be used as a statement ...
... @viewport -- Describes the aspects of the viewport for small screen devices. (currently at the Working Draft stage) @counter-style -- Defines specific counter styles that are not part of the predefined set of styles. (at the Candidate Recommendation stage, but only implemented in Gecko as of writing) @font-feature-values (plus @swash, @ornaments, @annotation, @stylistic, @styleset and @
character-variant) -- Define common names in font-variant-alternates for feature activated differently in OpenType. (at the Candidate Recommendation stage, but only implemented in Gecko as of writing) Conditional group rules Much like the values of properties, each at-rule has a different syntax. Nevertheless, several of them can be grouped into a special category named conditional group r...
CSS Fonts - CSS: Cascading Style Sheets
Basic example The following example shows a simple use of basic font properties to style a paragraph of text. ...
...e @font-feature-values Guides Fundamental text and font styling In this beginner's learning article we go through all the basic fundamentals of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. OpenType font features guide Font features or variants refer to different glyphs or
character styles contained within an OpenType font. These include things like ligatures (special glyphs that combine
characters like 'fi' or 'ffl'), kerning (adjustments to the spacing between specific letterform pairings), fractions, numeral styles, and a number of others. These are all referred to as OpenType Features, and are made available to use on the web via specific properties and a low-level ...
Descendant combinator - CSS: Cascading Style Sheets
The descendant combinator -- typically represented by a single space ( )
character -- combines two selectors such that elements matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors. ...
...the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors. /* List items that are descendants of the "my-things" list */ ul.my-things li { margin: 2em; } The descendant combinator is technically one or more CSS white space
characters -- the space
character and/or one of four control
characters: carriage return, form feed, new line, and tab
characters -- between two selectors in the absence of another combinator. Additionally, the white space
characters of which the combinator is comprised may contain any number of CSS comments. Syntax selector1 selector2 { /* property declarations */ } Examples CSS li { list-st...
Value definition syntax - CSS: Cascading Style Sheets
ue definition syntax, a formal grammar, is used for defining the set of valid values for a CSS property or function. In addition to this syntax, the set of valid values can be further restricted by semantic constraints (for example, for a number to be strictly positive). The definition syntax describes which values are allowed and the interactions between them. A component can be a keyword, some
characters considered as a literal, or a value of a given CSS data type or of another CSS property. Component value types Keywords Generic keywords A keyword with a predefined meaning appears literally, without quotation marks. For example: auto, smaller or ease-in. The specific case of inherit, initial and unset All CSS properties accept the keywords inherit, initial and unset, that are defined...
...ypes Keywords Generic keywords A keyword with a predefined meaning appears literally, without quotation marks. For example: auto, smaller or ease-in. The specific case of inherit, initial and unset All CSS properties accept the keywords inherit, initial and unset, that are defined throughout CSS. They are not shown in the value definition, and are implicitly defined. Literals In CSS, a few
characters can appear on their own, like the slash ('/') or the comma (','), and are used in a property definition to separate its parts. The comma is often used to separate values in enumerations, or parameters in mathematical-like functions; the slash often separates parts of the value that are semantically different, but have a common syntax. Typically, the slash is used in shorthand properties; to...
WebKit CSS extensions - CSS: Cascading Style Sheets
bkit-box-lines** -webkit-box-ordinal-group** -webkit-box-orient** -webkit-box-pack** -webkit-box-reflect** C -webkit-column-axis -webkit-column-break-after -webkit-column-break-before -webkit-column-break-inside -webkit-column-progression -webkit-cursor-visibility D-I -webkit-dashboard-region -webkit-font-size-delta -webkit-font-smoothing -webkit-highlight -webkit-hyphenate-
character -webkit-hyphenate-limit-after -webkit-hyphenate-limit-before -webkit-hyphenate-limit-lines -webkit-initial-letter L -webkit-line-align -webkit-line-box-contain -webkit-line-clamp -webkit-line-grid -webkit-line-snap -webkit-locale -webkit-logical-height -webkit-logical-width M -webkit-margin-after-collapse -webkit-margin-after -webkit-margin-before-collapse -webkit-mar...
...* Use flex-box properties instead. Deprecated -webkit- properties The following properties were once supported with the -webkit- prefix but are no longer supported in evergreen browsers, with or without the -webkit- prefix. ...
<color> - CSS: Cascading Style Sheets
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 #5f9ea0
chartreuse #7fff00 chocolate #d2691e coral #ff7f50 cornflowerblue #6495ed cornsilk #fff8dc crimson #dc143c cyan (synonym of aqua) #00ffff darkblue #00008b darkcyan #008b8b darkgoldenrod #b8860b darkgray #a9a9a9 darkgreen ...
...parency. Syntax RGB colors can be expressed through both hexadecimal (prefixed with #) and functional (rgb(), rgba()) notations. Note: As of CSS Colors Level 4, rgba() is an alias for rgb(). In browsers that implement the Level 4 standard, they accept the same parameters and behave the same way. Hexadecimal notation: #RRGGBB[AA] R (red), G (green), B (blue), and A (alpha) are hexadecimal
characters (0-9, A-F). A is optional. For example, #ff0000 is equivalent to #ff0000ff. Hexadecimal notation: #RGB[A] R (red), G (green), B (blue), and A (alpha) are hexadecimal
characters (0-9, A-F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a sh...
font-feature-settings - CSS: Cascading Style Sheets
re no other way exists to enable or access an OpenType font feature. In particular, font-feature-settings shouldn'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; f...
... Candidate Recommendation Init...
font-stretch - CSS: Cascading Style Sheets
as the most expanded. <percentage> A <percentage> value between 50% and 200% (inclusive). Negative values are not allowed for this property. In earlier versions of the font-stretch specification, the property accepts only the nine keyword values. CSS Fonts Level 4 extends the syntax to accept a <percentage> value as well. This enables variable fonts to offer something more like a continuum of
character widths. For TrueType or OpenType variable fonts, the "wdth" variation is used to implement varying widths. However, note that the <percentage> syntax is not yet supported by all browsers: check the Browser compatibility table for details. Keyword to numeric mapping The table below shows the mapping between keyword values and numeric percentages: Keyword Percentage ...
... You can use font-stretch to select a condensed or expanded face from such fonts. If the font you are using does not offer condensed or expanded faces, this property has no effect. Font face selection The face selected for a given value of font-stretch depends on the faces supported by the...
font-variant-position - CSS: Cascading Style Sheets
e baseline of the font, which remains unchanged. These glyphs are typically used in <sub> and <sup> elements. /* Keyword values */ font-variant-position: normal; font-variant-position: sub; font-variant-position: super; /* Global values */ font-variant-position: inherit; font-variant-position: initial; font-variant-position: unset; When the usage of these alternate glyphs is activated, if one
character in the run doesn't have such a typographically-enhanced glyph, the whole set of
characters of the run is rendered using a fallback method, synthesizing these glyphs. These alternate glyphs share the same em-box and the same baseline as the rest of the font. They are merely graphically enhanced, and have no effect on the line-height and other box
characteristics. Syntax The font-variant-p...
...t of the font. They are merely graphically enhanced, and have no effect on the line-height and other box
characteristics. Syntax The font-variant-position property is specified as one of the keyword values listed below. Values normal Deactivates alternate superscript and subscript glyphs. sub Activates subscript alternate glyphs. If, in a given run, one such glyph is not available for a
character, all the
characters in the run are rendered using synthesized glyphs. super Activates superscript alternate glyphs. If, in a given run, one such glyph is not available for a
character, all the
characters in the run are rendered using synthesized glyphs. Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed val...
<length> - CSS: Cascading Style Sheets
ne of the units listed below. As with all CSS dimensions, there is no space between the unit literal and the number. The length unit is optional after the number 0. Note: Some properties allow negative <length>s, while others do not. Units Relative length units Relative lengths represent a measurement in terms of some other distance. Depending on the unit, this can be the size of a specific
character, the line height, or the size of the viewport. Font-relative lengths Font-relative lengths define the <length> value in terms of the size of a particular
character or font attribute in the font currently in effect in an element or its parent. Note: These units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the u...
... element or its parent. Note: These units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the font size. cap Represents the "cap height" (nominal height of capital letters) of the element's font. ch Represents the width, or more precisely the advance measure, of the glyph "0" (zero, the Unicode
character U+0030) in the element's font. In the cases where it is impossible or impractical to determine the measure of the "0" glyph, it must be assumed to be 0.5em wide by 1em tall. em Represents the calculated font-size of the element. If used on the font-size property itself, it represents the inherited font-size of the element. ex Represents the x-height of the element's font. On fonts wit...
text-align - CSS: Cascading Style Sheets
eractive 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. ...
...t edges to the left and right edges of the line box, except for the last line. justify-all Same as justify, but also forces the last line to be justified. match-parent Similar to inherit, but the values start and end are calculated according to the parent's direction and are replaced by the appropriate left or right value. <string> When applied to a table cell, specifies the alignment
character around which the cell's contents will align. Accessibility concerns The inconsistent spacing between words created by justified text can be problematic for people with cognitive concerns such as Dyslexia. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.8 | Understanding WCAG 2.0 Formal definition Initial valuestart, or a nameless value that ac...
text-combine-upright - CSS: Cascading Style Sheets
If the combined text is wider than 1em, the user agent must fit the contents within 1em. The resulting composition is treated as a single upright glyph for layout and decoration. This property only has an effect in vertical writing modes. This is used to produce an effect that is known as tate-chu-yoko (???) in Japanese, or as ???? in Chinese. ...
...ht: digits; /* fits 2 consecutive digits horizontally inside vertical text */ text-combine-upright: digits 4; /* fits up to 4 consecutive digits horizontally inside vertical text */ /* Global values */ text-combine-upright: inherit; text-combine-upright: initial; text-combine-upright: unset; Syntax Values none There is no special processing. all Attempts to typeset all consecutive
characters within the box horizontally, such 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, i...
word-spacing - CSS: Cascading Style Sheets
-spacing: 50%; word-spacing: 200%; /* Global values */ word-spacing: inherit; word-spacing: initial; word-spacing: unset; Values normal The normal inter-word spacing, as defined by the current font and/or the browser. <length> Specifies extra spacing in addition to the intrinsic inter-word spacing defined by the font. <percentage> Specifies extra spacing as a percentage of the affected
character's advance width. Examples HTML <div id="mozdiv1">Here are many words...</div> <div id="mozdiv2">...and many more!</div> CSS #mozdiv1 { word-spacing: 15px; } #mozdiv2 { word-spacing: 5em; } Accessibility concerns A large positive or negative word-spacing value will make the sentences the styling is applied to unreadable. For text styled with a very large positive value, the wo...
...dable. For text styled with a very large positive value, the words will be so far apart that it will no longer appear to be a sentence. For text styled with a large negative value, the words will overlap each other to the point where the the beginning and end of each word is unrecognizable. Legible word-spacing must be determined on a case-by-case basis, as different font families have different
character widths. There is no one value that can ensure all font families automatically maintain their legibility. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.8 | W3C Understanding WCAG 2.0 Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesPercentagesrefer to the width of the aff...
str:tokenize() - EXSLT
Returns A node-set of token elements, each containing one token from the string. ...
... Returns A node-set of token elements, each containing one token from the string. ...
Event developer guide - Developer guides
The overview page provides an introduction to the design pattern and a summary of the types of incidents which are defined and reacted to by modern web browsers. ...
... pattern can be used in custom code to define new event types emitted by user objects, register listener functions to handle those events, and trigger the events in user code. The remaining pages describe how to use events of different kinds defined by web browsers. Unfortunately, these events have been defined piece by piece as web browsers have evolved so that there is no satisfying systematic
characterization of the events built-in or defined by modern web browsers. The device on which the web browser is running can trigger events, for example due to a change in its position and orientation in the real world, as discussed partially by the page on orientation coordinate systems and the page on the use of 3D transforms. That is different, but similar, to the change in device vertical orient...
Content categories - Developer guides
This is a loose grouping (it doesn't actually create a relationship among elements of these categories), but they help define and describe the categories' shared behavior and their associated rules, especially when you come upon their intricate details. It's also possible for elements to not be a member of any of these categories. There are three types of content categories: Main content categories, which describe common rules shared by many elements. ...
... A few other elements belong to this category, but only if a specific condition is fulfilled: <a>, if it contains only phrasing content <area>, if it is a descendant of a <map> element <del>, if it contains only phrasing content <ins>, if it contains only phrasing content <link>, if the itemprop attribute is present <map>, if it contains only phrasing content <meta>, if the itemp...
Constraint validation - Developer guides
integral multiple of the step. ...
... An integer number of weeks datetime, datetime-local, time An integer number of seconds range, number An integer minlength text, search, url, tel, email, password; also on the <textarea> element An integer length The number of
characters (code points) must not be less than the value of the attribute, if non-empty. All newlines are normalized to a single
character (as opposed to CRLF pairs) for <textarea>. tooShort constraint violation maxlength text, search, url, tel, email, password; also on the <textarea> element An integer length The number of
characters (code points) must not exceed the value of the attribute. tooLong constraint violation Constraint validation process Constraint validation is done through the Const...
HTML5 Parser - Developer guides
<script, </script>, and <!--, you should prevent them from being parsed literally by expressing them as \u003cscript,\u003c/script>, and \u003c!--. The older practice of escaping the string </script> by surrounding it with comment markers, while supported by HTML5, is problematic in cases where the closing comment marker is omitted (see preceding point). You can avoid such problems by using the
character code for the initial '<' instead. (It is valid to use an escape
character, e.g., <\/script>, but this strategy does not work for <script and <!--, because \s and \! are not valid JavaScript escapes; the
character code strategy is more general-purpose.) Inline SVG and MathML support As a completely new parsing feature, HTML5 introduced support for inline SVG and MathML in text/html. This m...
...s must not have prefixes or colons in them. The content of SVG script elements is tokenized like they are tokenized in XML--not like the content of HTML script elements is tokenized. When an SVG or MathML element is open <![CDATA[...]]> sections work the way they do in XML. You can use this to hide text content from older browsers that don't support SVG or MathML in text/html. The MathML named
characters are available for use in named
character references everywhere in the document (also in HTML content). To deal with legacy pages where authors have pasted partial SVG fragments into HTML (who knows why) or used a <math> tag for non-MathML purposes, attempts to nest various common HTML elements as children of SVG elements (without foreignObject) will immediately break out of SVG or MathML c...
Printing - Developer guides
EventListener() is preferred. Examples Here are some common examples. ...
...int an external page without opening it If you want to be able to print an external page without opening it, you can utilize a hidden <iframe> (see: HTMLIFrameElement), automatically removing it after the user prints its contents. ...
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
op shadows in Fundamental text and font styling to learn more. text-decoration-color By default, text decorations (such as underlines, strikethroughs, etc) use the color property as their colors. However, you can override that behavior and use a different color for them with the text-decoration-color property. text-emphasis-color The color to use when drawing emphasis symbols adjacent to each
character in the text. This is used primarily when drawing text for East Asian languages. caret-color The color to use when drawing the caret (sometimes referred to as the text input cursor) within the element. This is only useful in elements that are editable, such as <input> and <textarea> or elements whose HTML contenteditable attribute is set. Boxes Every element is a box with some sort of co...
...an be represented as a number between 0 and 255 (0x00 and 0xFF) or, optionally, as a number between 0 and 15 (0x0 and 0xF). All components must be specified using the same number of digits. If you use the single-digit notation, the final color is computed by using each component's digit twice; that is, "#D" becomes "#DD" when drawing. A color in hexadecimal string notation always begins with the
character "#". After that come the hexadecimal digits of the color code. The string is case-insensitive. "#rrggbb" Specifies a fully-opaque color whose red component is the hexadecimal number 0xrr, green component is 0xgg, and blue component is 0xbb. "#rrggbbaa" Specifies a color whose red component is the hexadecimal number 0xrr, green component is 0xgg, and blue component is 0xbb. The alpha ch...
HTML attribute: minlength - HTML: Hypertext Markup Language
This must be an integer value 0 or higher. If no minlength is specified, or an invalid value is specified, the input has no minimum length. This value must be less than or equal to the value of maxlength, otherwise the value will never be valid, as it is impossible to meet both criteria. The input will fail constraint validation if the length of the text value of the field is less than minlength UTF-16 code units long, with validityState.tooShort returning true. Constraint validation is only applied when the value is changed by the user. ...
...he text value of the field is less than minlength UTF-16 code units long, with validityState.tooShort returning true. Constraint validation is only applied when the value is changed by the user. Once submission fails, some browsers will display an error message indicating the minimum length required and the current length. Examples By adding minlength="5", the value must either be empty or five
characters or longer to be valid. <label for="fruit">Enter a fruit name that is at least 5 letters long</label> <input type="text" minlength="5" id="fruit"> We can use pseudoclasses to style the element based on whether the value is valid. The value will be valid as long as it is either null (empty) or five or more
characters long. Lime is invalid, lemon is valid. input { border: 2px solid curren...
<a>: The Anchor element - HTML: Hypertext Markup Language
g to it. Can be used with or without a value: Without a value, the browser will suggest a filename/extension, generated from various sources: The Content-Disposition HTTP header The final segment in the URL path The media type (from the (Content-Type header, the start of a data: URL, or Blob.type for a blob: URL) Defining a value suggests it as the filename. / and \
characters are converted to underscores (_). Filesystems may forbid other
characters in filenames, so browsers will adjust the suggested name if necessary. Notes: download only works for same-origin URLs, or the blob: and data: schemes. If Content-Disposition has a different filename than download, the header takes priority. (If Content-Disposition: inline, Firefox prefers the header while ...
... as _self. Note: When using target, add rel="noreferrer noopener" to avoid exploitation of the window.opener API; Note: In newer browser versions (e.g. Firefox 79+) setting target="_blank" on <a> elements implicitly provides the same rel behavior as setting rel="noopener". type Hints at the linked URL's format with a MIME type. No built-in functionality. Obsolete attributes
charsetObsolete since HTML5 Hinted at the
character encoding of the linked URL. Note: This attribute is obsolete and should not be used by authors. Use the HTTP Content-Type header on the linked URL. coordsObsolete since HTML5 Used with the shape attribute. A comma-separated list of coordinates. nameObsolete since HTML5 Was required to define a possible target location in a page. In HTML 4...
<body>: The Document Body element - HTML: Hypertext Markup Language
The HTML <body> Element represents the content of an HTML document. There can be only one <body> element in a document. Content categories Sectioning root. Permitted content Flow content. Tag omission The start tag may be omitted if the first thing inside it is not a space
character, comment, <script> element or <style> element. The end tag may be omitted if the <body> element has contents or has a start tag, and is not immediately followed by a comment. Permitted parents It must be the second element of an <html> element. Implicit ARIA role document Permitted ARIA roles No role permitted DOM interface HTMLBodyElement The <body> element exposes the HTMLBodyElement interface. You can access the ...
...user requests printing of the document. onbeforeunload Function to call when the document is about to be unloaded. onblur Function to call when the document loses focus. onerror Function to call when the document fails to load properly. onfocus Function to call when the document receives focus. onhashchange Function to call when the fragment identifier part (starting with the hash ('#')
character) of the document's current address has changed. onlanguagechange Function to call when the preferred languages changed. onload Function to call when the document has finished loading. onmessage Function to call when the document has received a message. onoffline Function to call when network communication has failed. ononline Function to call when network communication has been r...
<input type="image"> - HTML: Hypertext Markup Language
ribute. This attribute is also available on <input type="submit"> and <button> elements. formmethod A string indicating the HTTP method to use when submitting the form's data; this value overrides any method attribute given on the owning form. Permitted values are: get A URL is constructed by starting with the URL given by the formaction or action attribute, appending a question mark ("?")
character, then appending the form's data, encoded as described by formenctype or the form's enctype attribute. This URL is then sent to the server using an HTTP get request. This method works well for simple forms that contain only ASCII
characters and have no side effects. This is the default value. post The form's data is included in the body of the request that is sent to the URL given by the fo...
...Specifies the HTTP method that the browser uses to submit the form. Possible values are: post: The data from the form is included in the body of the form and is sent to the server. get: The data from the form is appended to the form attribute URI, with a '?' as a separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII
characters. If specified, this attribute overrides the method attribute of the element's form owner. formnovalidate HTML5 A Boolean attribute specifying that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the novalidate attribute of the element's form owner. formtarget HTML5 A name or keyword indicating where to display the response that is...
<input type="number"> - HTML: Hypertext Markup Language
information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds. If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting
characters to override directionality within the placeholder; see Overriding BiDi using Unicode control
characters in The Unicode Bidirectional Text Algorithm for those
characters. Note: Avoid using the placeholder attribute if you can. It is not as semantically useful as other ways to explain your form, and can cause unexpected technical issues with your content. See Labels and placeholders in <inp...
...umber"> elements can help simplify your work when building the user interface and logic for entering numbers into a form. When you create a number input with the proper type value, number, you get automatic validation that the entered text is a number, and usually a set of up and down buttons to step the value up and down. Important: Bear in mind that, logically, you should not be able to enter
characters inside a number input other than numbers. There seems to be some disagreement about this among browsers; see bug 1398528. Note: It's crucial to remember that a user can tinker with your HTML behind the scenes, so your site must not use simple client-side validation for any security purposes. You must verify on the server side any transaction in which the provided value may have any secur...
<input type="submit"> - HTML: Hypertext Markup Language
tribute. This attribute is also available on <input type="image"> and <button> elements. formmethod A string indicating the HTTP method to use when submitting the form's data; this value overrides any method attribute given on the owning form. Permitted values are: get A URL is constructed by starting with the URL given by the formaction or action attribute, appending a question mark ("?")
character, then appending the form's data, encoded as described by formenctype or the form's enctype attribute. This URL is then sent to the server using an HTTP get request. This method works well for simple forms that contain only ASCII
characters and have no side effects. This is the default value. post The form's data is included in the body of the request that is sent to the URL given by the fo...
...e" type="text" name="text"> </div> <div> <input type="submit" value="Send"> </div> </form> This renders like so: Try entering some text into the text field, and then submitting the form. Upon submitting, the data name/value pair gets sent to the server. In this instance, the string will be text=usertext, where "usertext" is the text entered by the user, encoded to preserve special
characters. Where and how the data is submitted depends on the configuration of the <form>; see Sending form data for more details. Adding a submit keyboard shortcut Keyboard shortcuts, also known as access keys and keyboard equivalents, let the user trigger a button using a key or combination of keys on the keyboard. To add a keyboard shortcut to a submit button -- just as you would with any <input...
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
diately followed by an <rt>, <rtc>, or <rp> element or another <rb> element, or if there is no more content in the parent element. Permitted parents A <ruby> element. Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Ruby annotations are for showing pronunciation of East Asian
characters, like using Japanese furigana or Taiwanese bopomofo
characters. The <rb> element is used to separate out each segment of the ruby base text. Even though <rb> is not an empty element, it is common to just include the opening tag of each element in the source code, so that the ruby markup is less complex and easier to read. The browser can then fill in the full element in the rendered versio...
...n empty element, it is common to just include the opening tag of each element in the source code, so that the ruby markup is less complex and easier to read. The browser can then fill in the full element in the rendered version. You need to include one <rt> element for each base segment/<rb> element that you want to annotate. Examples In this example, we provide an annotation for the original
character equivalent of "Kanji": <ruby> <rb>?<rb>? <rp>(</rp><rt>kan<rt>ji<rp>)</rp> </ruby> Note how we've included two <rb> elements, to delimit the two separate parts of the ruby base text. The annotation on the other hand is delimited by two <rt> elements. Note that we could also write this example with the two base text parts annotated completely separately. In this case we don't need to i...
<ruby> - 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, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. ...
...content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. 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. Examples Example 1:
Character <ruby> ? <rp>(</rp><rt>Kan</rt><rp>)</rp> ? <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> Example 2: Word <ruby> ?? <rp>(</rp><rt>Ashita</rt><rp>)</rp> </ruby> Specifications Specification Status Comment HTML Living StandardThe definition of '<ruby>' in that specification. Living Standard HTML5The definition of '<ruby>' in that specification. ...
accesskey - HTML: Hypertext Markup Language
The accesskey global attribute provides a hint for generating a keyboard shortcut for the current element. The attribute value must consist of a single printable
character (which includes accented and other
characters that can be generated by the keyboard). 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. Note: In the WHATWG spec, it says you can specify multiple space-separated
characters, and the browser will use the first one it supports. However, this does not work in most browsers. IE/Edge uses the first one it supports without problems, provided there are no conflicts with other commands. The way to activate...
...ted in reality. HTML Living StandardThe definition of 'accesskey' in that specification. Living Standard No change from latest W3C HTML 5.1 spec. HTML 5.1The definition of 'accesskey' in that specification. Recommendation No change from HTML5. HTML5The definition of 'accesskey' in that specification. Recommendation From HTML 4.01 Specification, several
characters can now be set as the accesskey. Also, it can be set on any element. HTML 4.01 SpecificationThe definition of 'accesskey' in that specification. Recommendation Only supported on <a>, <area>, <button>, <input>, <label>, <legend> and <textarea> ...
Accept-Patch - HTTP
s. Two others content encoding, bzip and bzip2, are sometimes used, though not standard. They implement the algorithm used by these two UNIX programs. Note that the first one was discontinued due to patent licensing problems. ...
... the first one was discontinued due to patent licensing problems. ...
Content-Disposition - HTTP
sition: form-data; name="fieldName"; filename="filename.jpg" Directives name Is followed by a string containing the name of the HTML field in the form that the content of this subpart refers to. When dealing with multiple files in the same field (for example, the multiple attribute of an <input type="file"> element), there can be several subparts with the same name. A name with a value of '_
charset_' indicates that the part is not an HTML field, but the default
charset to use for parts without explicit
charset information. filename Is followed by a string containing the original name of the file transmitted. The filename is always optional and must not be used blindly by the application: path information should be stripped, and conversion to the server file system rules should be done.
...ventual "Save As" dialog presented to the user. filename* The parameters filename and filename* differ only in that filename* uses the encoding defined in RFC 5987. When both filename and filename* are present in a single header field value, filename* is preferred over filename when both are understood. Examples A response triggering the "Save As" dialog: 200 OK Content-Type: text/html;
charset=utf-8 Content-Disposition: attachment; filename="cool.html" Content-Length: 21 <HTML>Save me!</HTML> This simple HTML file will be saved as a regular download rather than displayed in the browser. Most browsers will propose to save it under the cool.html filename (by default). An example of an HTML form posted using the multipart/form-data format that makes use of the Content-Disposition ...
Content-Location - HTTP
d) Say you're creating a new blog post through a site's API: PUT /new/post Host: example.com Content-Type: text/markdown # My first blog post! I made this through `example.com`'s API. I hope it worked. The site returns a generic success message confirming the post was published. The server specifies where the new post is with Content-Location: HTTP/1.1 201 Created Content-Type: text/plain;
charset=utf-8 Content-Location: /my-first-blog-post ? Success! Indicating the URL of a transaction's result Say you have a <form> for sending money to another user of a site. <form action="/send-payment" method="post"> <p> <label>Who do you want to send the money to? <input type="text" name="recipient"> </label> </p> <p> <label>How much? <input type="number" name="a...
...e="text" name="recipient"> </label> </p> <p> <label>How much? <input type="number" name="amount"> </label> </p> <button type="submit">Send Money</button> </form> When the form is submitted, the site generates a receipt for the transaction. ...
Index - HTTP
tand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Type response header. Browsers set adequate values for this header depending on the context where the request is done: when fetching a CSS stylesheet a different value is set for the request than when fetching an image, video or a script. 3 Accept-
Charset Content Negotiation, HTTP, HTTP Header, Reference, Request header The Accept-
Charset request HTTP header advertises which
character set the client is able to understand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice within the Content-Type response header. Browsers usually don't set this header as the default val...
...-Insecure-Requests HTTP, HTTPS, Security, header The HTTP Upgrade-Insecure-Requests request header sends a signal to the server expressing the client's preference for an encrypted and authenticated response, and that it can successfully handle the upgrade-insecure-requests CSP directive. 110 User-Agent HTTP, Reference, header The User-Agent request header contains a
characteristic string that allows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent. 111 Firefox user agent string reference Compatibility, Firefox, Firefox 4, Gecko, Gecko 2.0, Guide This document describes the user agent string used in Firefox 4 and later and applications based...
WWW-Authenticate - HTTP
The HTTP WWW-Authenticate response header defines the authentication method that should be used to gain access to a resource. The WWW-Authenticate header is sent along with a 401 Unauthorized response. Header type Response header Forbidden header name no Syntax WWW-Authenticate: <type> realm=<realm>[,
charset="UTF-8"] Directives <type> Authentication type. A common type is "Basic". IANA maintains a list of Authentication schemes. realm=<realm> A description of the protected area. If no realm is specified, clients often display a formatted hostname instead.
charset=<
charset> Tells the client the server's prefered encoding scheme when submitting a username and password. The only allowed value is the case insensitive string "UTF-8". This does not relat...
...lls the client the server's prefered encoding scheme when submitting a username and password. The only allowed value is the case insensitive string "UTF-8". This does not relate to the encoding of the realm string. Examples Typically, a server response contains a WWW-Authenticate header that looks like these: WWW-Authenticate: Basic WWW-Authenticate: Basic realm="Access to the staging site",
charset="UTF-8" See also HTTP authentication for examples on how to configure Apache or nginx servers to password protect your site with HTTP basic authentication. Specifications Specification Title RFC 7235, section 4.1: WWW-Authenticate HTTP/1.1: Authentication RFC 7617 The 'Basic' HTTP Authentication Scheme ...
HTTP headers - HTTP
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. Keep-Alive Controls how long a persistent connection should stay open. Content negotiation Accept Informs the server about the types of data that can be sent back. Accept-
Charset Which
character encodings the client understands. Accept-Encoding The encoding algorithm, usually a compression algorithm, that can be used on the resource sent back. Accept-Language Informs the server about the human language the server is expected to send back. This is a hint and is not necessarily under the full control of the user: the server should always pay attention not to overrid...
...ent. Host Specifies the domain name of the server (for virtual hosting), and (optionally) the TCP port number on which the server is listening. Referer The address of the previous web page from which a link to the currently requested page was followed. Referrer-Policy Governs which referrer information sent in the Referer header should be included with requests made. User-Agent Contains a
characteristic string that allows 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...
HTTP Index - HTTP
header is set by the server to specify which Client Hints headers client should include in subsequent requests. 49 Accept-CH-Lifetime Client hints, HTTP, header The Accept-CH-Lifetime header is set by the server to specify the persistence of Accept-CH header value that specifies for which Client Hints headers client should include in subsequent requests. 50 Accept-
Charset Content Negotiation, HTTP, HTTP Header, Reference, Request header The Accept-
Charset request HTTP header advertises which
character encodings the client understands. 51 Accept-Encoding Content Negotiation, HTTP, HTTP Header, Reference, Request header The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the cl...
...s HTTP, HTTPS, Security, header The HTTP Upgrade-Insecure-Requests request header sends a signal to the server expressing the client's preference for an encrypted and authenticated response, and that it can successfully handle the upgrade-insecure-requests CSP directive. 191 User-Agent HTTP, HTTP Header, Reference, User-agent The User-Agent request header contains a
characteristic string that allows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent. 192 Firefox user agent string reference Compatibility, Firefox, Firefox 4, Gecko, Gecko 2.0, Guide This document describes the user agent string used in Firefox 4 and later and applications based...
Equality comparisons and sameness - JavaScript
omparisons table below that this is due to the way that Object.is handles NaN. Notice that if Object.is(NaN, NaN) evaluated to false, we could say that it fits on the loose/strict spectrum as an even stricter form of triple equals, one that distinguishes between -0 and +0. The NaN handling means this is untrue, however. Unfortunately, Object.is simply has to be thought of in terms of its specific
characteristics, rather than its looseness or strictness with regard to the equality operators. Sameness Comparisons x y == === Object.is SameValueZero undefined undefined true true true true null null true true true true true true true true true true false false true true true ...
...If your use case does not require this, it is suggested to avoid Object.is and use === instead. Even if your requirements involve having comparisons between two NaN values evaluate to true, generally it is easier to special-case the NaN checks (using the isNaN method available from previous versions of ECMAScript) than it is to work out how surrounding computa...
Control flow and error handling - JavaScript
<< PreviousNext >> JavaScript supports a compact set of statements, specifically control flow statements, that you can use to incorporate a great deal of interactivity in your application. This chapter provides an overview of these statements. The JavaScript reference contains exhaustive details about the statements in this chapter. The semicolon (;)
character is used to separate statements in JavaScript code. Any JavaScript expression is also a statement. See Expressions and operators for complete information about expressions. Block statement The most basic statement is a block statement, which is used to group statements. The block is delimited by a pair of curly brackets: { statement_1; statement_2; ? statement_n; } Example Block statements are commonly use...
...hen passed to a conditional statement. Caution: Do not confuse the primitive boolean values true and false with the true and false values of the Boolean object! For example: var b = new Boolean(false); if (b) // this condition evaluates to true if (b == true) // this condition evaluates to false Example In the following example, the function checkData returns true if the number of
characters in a Text object is three. Otherwise, it displays an alert and returns false. function checkData() { if (document.form1.three
Char.value.length == 3) { return true; } else { alert( 'Enter exactly three
characters. ' + `${document.form1.three
Char.value} is not valid.`); return false; } } switch statement A switch statement allows a program to evaluate an ...
Indexed collections - JavaScript
k[, initialValue]) works like reduce(), but starts with the last element. reduce and reduceRight are the least obvious of the iterative array methods. They should be used for algorithms that combine two values recursively in order to reduce a sequence down to a single value. Multi-dimensional arrays Arrays can be nested, meaning that an array can contain another array as an element. Using this
characteristic of JavaScript arrays, multi-dimensional arrays can be created. The following code creates a two-dimensional array. let a = new Array(4) for (let i = 0; i < 4; i++) { a[i] = new Array(4) for (let j = 0; j < 4; j++) { a[i][j] = '[' + i + ', ' + j + ']' } } This example creates an array with the following rows: Row 0: [0, 0] [0, 1] [0, 2] [0, 3] Row 1: [1, 0] [1, 1] [1, 2] [...
...s.forEach(function(item) { // TypeError: arguments.forEach is not a function console.log(item); }); } But you can call them indirectly using Function.prototype.call(). function printArguments() { Array.prototype.forEach.call(arguments, function(item) { console.log(item); }); } Array prototype methods can be used on strings as well, since they provide sequential access to their
characters in a similar way to arrays: Array.prototype.forEach.call('a string', function(chr) { console.log(chr) }) Typed Arrays JavaScript typed arrays are array-like objects and provide a mechanism for accessing raw binary data. As you already know, Array objects grow and shrink dynamically and can have any JavaScript value. JavaScript engines perform optimizations so that these arrays are fas...
Meta programming - JavaScript
er apply function In ES5, you typically use the Function.prototype.apply() method to call a function with a given this value and arguments provided as an array (or an array-like object). ...
... an array (or an array-like object). Function.prototype.apply.call(Math.floor, undefined, [1.75]) With Reflect.apply this becomes less verbose and easier to understand: Reflect.apply(Math.floor, undefined, [1.75]) // 1 Reflect.apply(String.from
CharCode, undefined, [104, 101, 108, 108, 111]) // "hello" Reflect.apply(RegExp.prototype.exec, /ab/, ['confabulation']).index // 4 Reflect.apply(''.
charAt, 'ponies', [3]) // "i" Checking if property definition has been successful With Object.defineProperty, which returns an object if successful, or throws a TypeError otherwise, you would use a try...catch block to catch any error that occurred while defining a property. Because Reflect.defineProperty returns a Boolean success status, you can just use an if...else block here: if (Reflect.defin...
Deprecated and obsolete features - JavaScript
sing these properties can result in problems, since browser extensions can modify them. Avoid them! $_ See input. $* See multiline. $& See lastMatch. $+ See lastParen. $` See leftContext. $' See rightContext. input The string against which a regular expression is matched. lastMatch The last matched
characters. lastParen The last parenthesized substring match, if any. leftContext The substring preceding the most recent match. rightContext The substring following the most recent match. The following are now properties of RegExp instances, no longer of the RegExp object: Property Description global Whether or not to test the regula...
...wnPropertyNames (bug 1007334, Firefox 33) keys (bug 1007334, Firefox 33) Escape sequences Octal escape sequences (\ followed by one, two, or three octal digits) are deprecated in string and regular expression literals. The escape and unescape functions are deprecated. Use encodeURI, encodeURIComponent, decodeURI or decodeURIComponent to encode and decode escape sequences for special
characters. String methods HTML wrapper methods like String.prototype.fontsize and String.prototype.big. String.prototype.quote is removed from Firefox 37. non standard flags parameter in String.prototype.search, String.prototype.match, and String.prototype.replace are deprecated. String.prototype.substr probably won't be removed anytime soon, but it's defined in Annex B of the ECMA-262 standa...
Intl.Locale.prototype.numeric - JavaScript
This special numeric handling means that sequences of decimal digits will be compared as numbers. ...
...This special numeric handling means that sequences of decimal digits will be compared as numbers. For example, the string "A-21" will be considered less than "A-123". Examples Setting the numeric value via the locale string In the Unicode locale string spec, the values that numeric represents correspond to the key kn. ...
Intl - JavaScript
d by hyphens. Locale identifiers are case-insensitive ASCII. However, it's conventional to use title case (first letter capitalized, successive letters lower case) for script code, upper case for region codes, and lower case for everything else. For example: "hi": Hindi (language) "de-AT": German (language) as used in Austria (region) "zh-Hans-CN": Chinese (language) written in simplified
characters (script) as used in China (region) "en-emodeng": English (language) in the "Early modern English" dialect (variant) The subtags identifying languages, scripts, regions (including countries), and (rarely used) variants in Unicode BCP 47 locale identifiers are registered in the IANA Language Subtag Registry. This registry is periodically updated over time, and implementations may not alwa...
...) and one or more two- to eight-letter or digit tags, all separated by hyphens. JavaScript internationalization functions use the "u" (Unicode) extension, which can be used to request additional customization of Collator, NumberFormat, or DateTimeFormat objects. Examples: "de-DE-u-co-phonebk": Use the phonebook variant of the German sort order, which interprets umlauted vowels as corresponding
character pairs: a -> ae, o -> oe, u -> ue. "th-TH-u-nu-thai": Use Thai digits (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) in number formatting. "ja-JP-u-ca-japanese": Use the Japanese calendar in date and time formatting, so that 2013 is expressed as the year 25 of the Heisei period, or ??25. "en-GB-u-ca-islamic": use British English with the Islamic (Hijri) calendar, where the Gregorian date 14 October, 2017 ...
RegExp() constructor - JavaScript
thub.com/mdn/interactive-examples 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 f...
...s 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) will be copied over. flags may contain any combination of the following
characters: g (global match) Find all matches rather than stopping after the first match. i (ignore case) If u flag is also enabled, use Unicode case folding. m (multiline) Treat beginning and end
characters (^ and $) as working over multiple lines. In other words, match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input stri...
RegExp.prototype.exec() - JavaScript
input; see below) and updates the lastIndex property of the regular expression object. The returned array has the matched text as the first item, and then one item for each parenthetical capture group of the matched text. If the match fails, the exec() method returns null, and sets lastIndex to 0. ...
... The number of possible parenthesized substrings is unlimited. result[1] === "Brown" result[2] === "Jumps" index The 0-based index of the match in the string. ...
RegExp - JavaScript
user input. Flags in constructor Starting with ECMAScript 6, new RegExp(/ab+c/, 'i') no longer throws a TypeError ("can't supply flags when constructing one RegExp from another") when the first argument is a RegExp and the second flags argument is present. A new RegExp from the arguments is created instead. When using the constructor function, the normal string escape rules (preceding special
characters with \ when included in a string) are necessary. For example, the following are equivalent: let re = /\w+/ let re = new RegExp('\\w+') Perl-like RegExp properties Note that several of the RegExp properties have both long and short (Perl-like) names. Both names always refer to the same value. (Perl is the programming language from which JavaScript modeled its regular expressions.). See ...
...g(r, "AND re.lastIndex", re.lastIndex); // [ '1', index: 0, input: '123 456', groups: undefined ] AND re.lastIndex 1 // [ '2', index: 1, input: '123 456', groups: undefined ] AND re.lastIndex 2 // [ '3', index: 2, input: '123 456', groups: undefined ] AND re.lastIndex 3 // ... and no more match. With the global flag g, all 6 digits would be matched, not just 3. Regular expression and Unicode
characters \w and \W only matches ASCII based
characters; for example, a to z, A to Z, 0 to 9, and _. To match
characters from other languages such as Cyrillic or Hebrew, use \uhhhh, where hhhh is the
character's Unicode value in hexadecimal. This example demonstrates how one can separate out Unicode
characters from a word. let text = '??????? text ?? ??????? ?????' let regex = /[\u0400-\u04FF]+/g...
String.prototype.lastIndexOf() - JavaScript
itHub 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 str.lastIndexOf(searchValue[, fromIndex]) Parameters searchValue A string representing the value to search for. If searchValue is an empty string, then fromIndex is returned. fromIndex Optional The index of the last
character in the string to be considered as the beginning of a match. The default value is +Infinity. If fromIndex >= str.length, the whole string is searched. If fromIndex < 0, the behavior will be the same as if it would be 0. Return value The index of the last occurrence of searchValue; -1 if not found. Description
Characters in a string are indexed from left to right. The index of the first ...
...acter in the string to be considered as the beginning of a match. The default value is +Infinity. If fromIndex >= str.length, the whole string is searched. If fromIndex < 0, the behavior will be the same as if it would be 0. Return value The index of the last occurrence of searchValue; -1 if not found. 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 is str.length - 1. 'canal'.lastIndexOf('a'); // returns 3 'canal'.lastIndexOf('a', 2); // returns 1 'canal'.lastIndexOf('a', 0); // returns -1 'canal'.lastIndexOf('x'); // returns -1 'canal'.lastIndexOf('c', -5); // returns 0 'canal'.lastIndexOf('c', 0); // returns 0 'canal'.lastIndexOf(''); // returns 5 'canal'.lastIndexOf('', 2); ...
String.prototype.link() - JavaScript
Return value A string containing an <a> HTML element. Description Use the link() method to create an HTML snippet for a hypertext link. ...
... Return value A string containing an <a> HTML element. Description Use the link() method to create an HTML snippet for a hypertext link. ...
String.prototype.replace() - JavaScript
e 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 and $2 replacement patterns. let re = /(\w+)\s(\w+)/; let str = 'John Smith'; let newstr = str.replace(re, '$2, $1'); console.log(newstr); // Smith, John This logs 'Smith, John'. Using an inline function that modifies the matched
characters In this example, all occurrences of capital letters in the string are converted to lower case, and a hyphen is inserted just before the match location. The important thing here is that additional operations are needed on the matched item before it is given back as a replacement. The replacement function accepts the matched snippet as its parameter, and uses it to transform the case and co...
...on. This forces the evaluation of the match prior to the toLowerCase() method. If we had tried to do this using the match without a function, the toLowerCase() would have no effect. let newString = propertyName.replace(/[A-Z]/g, '-' + '$&'.toLowerCase()); // won't work This is because '$&'.toLowerCase() would first be evaluated as a string literal (resulting in the same '$&') before using the
characters as a pattern. Replacing a Fahrenheit degree with its Celsius equivalent The following example replaces a Fahrenheit degree with its equivalent Celsius degree. The Fahrenheit degree should be a number ending with "F". The function returns the Celsius number ending with "C". For example, if the input number is "212F", the function returns "100C". If the number is "0F", the function returns ...
String.prototype.slice() - JavaScript
ce(beginIndex[, endIndex]) Parameters beginIndex The zero-based index at which to begin extraction. If negative, it is treated as str.length + beginIndex. (For example, if beginIndex is -3 it is treated as str.length - 3.) If beginIndex is greater than or equal to str.length, slice() returns an empty string. endIndex Optional The zero-based index before which to end extraction. The
character at this index will not be included. If endIndex is omitted, slice() extracts to the end of the string. If negative, it is treated as str.length + endIndex. (For example, if endIndex is -3 it is treated as str.length - 3.) Return value A new string containing the extracted section of the string. Description slice() extracts the text from one string and returns a new string. Changes t...
...length + endIndex. (For example, if endIndex is -3 it is treated as str.length - 3.) Return value A new string containing the extracted section of the string. Description slice() extracts the text from one string and returns a new string. Changes to the text in one string do not affect the other string. slice() extracts up to but not including endIndex. str.slice(1, 4) extracts the second
character through the fourth
character (
characters indexed 1, 2, and 3). As an example, str.slice(2, -1) extracts the third
character through the second to last
character in the string. Examples Using slice() to create a new string The following example uses slice() to create a new string. let str1 = 'The morning is upon us.', // the length of str1 is 23. str2 = str1.slice(1, 8), str3 = s...
unescape() - JavaScript
Warning: Although unescape() is not strictly deprecated (as in "removed from the Web standards"), it is defined in Annex B of the ECMA-262 standard, whose introduction states: ... All of the language features and behaviours specified in this annex have one or more undesirable
characteristics and in the absence of legacy usage would be removed from this specification. ... ... Programmers should not use or assume the existence of these features and behaviours when writing new ECMAScript code. ... The unescape() function computes a new string in which hexadecimal escape sequences are replaced with the
character that it represents. The escape sequences might be introduced by a function like escape. Usually, decodeURI or decodeURIComponent are preferred over unescape. Note: Do not use un...
... Description The unescape function is a property of the global object. ...
<mi> - MathML
future. mathvariant This logical class of the identifier, which varies in typography. That is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. ...
... typography. That is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. ...
MathML documentation index - MathML
rom the latest MathML standard and modern browsers no longer support it. 15 <mfrac> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <mfrac> element is used to display fractions. 16 <mglyph> MathML, MathML Reference, MathML:Element The MathML <mglyph> element is used to display non-standard symbols where existing Unicode
characters are not available. It may be used within token elements. 17 <mi> MathML, MathML Reference, MathML:Element, MathML:Token Elements The MathML <mi> element indicates that the content should be rendered as an identifier such as function names, variables or symbolic constants. You can also have arbitrary text in it to mark up terms. 18 <mlabeledtr> MathML, Mat...
...al row containing its arguments. 27 <ms> MathML, MathML Reference, MathML:Element, MathML:Token Elements The MathML <ms> element represents a string literal meant to be interpreted by programming languages and computer algebra systems. By default, string literals are displayed as enclosed by double quotes ("); by using the lquote and rquote attributes, you can set custom
characters to display. Note that quotation marks should not be specified unless they are part of the string literal. The content of an <ms> element is not an ASCII string per se, but rather a sequence of
characters and <mglyph> and <malignmark> elements. 28 <mspace> MathML, MathML Reference, MathML:Element, MathML:Token Elements The MathML <mspace> element is used to display a bla...
Web audio codec guide - Web media technologies
e user. If you need to choose just one format, select one that makes sense given your requirements and the type of audio content being downloaded. Generally, of course, MP3 is the most common format used for music; choose a bit rate of at least 192 kbps if possible. The iTunes store, on the other hand, distributes music in 256 kbps AAC format. Example: Voice recording and playback The specific
characteristics of human speech allow speech-specific codecs to compress the audio far more than most general-purpose codecs can. That's because although humans hear frequencies ranging from around 20 Hz to 20,000 Hz, and human speech sounds range from about 300 Hz to 18,000 Hz, the majority of the speech sounds that we need in order to understand what's being said lie in the frequency range of 500 Hz...
...ost. This makes these codecs completely unsuitable for anything but spoken words. Even audio that contains only voices, but singing rather than simply speaking, will likely not be of acceptable quality in one of these formats. Voice recording and playback usually needs to be low-latency in order to synchronize with video tracks, or in order to avoid cross-talk or other problems. Fortunately, the
characteristics that lead to speech codecs being so efficient storage space-wise also make them tend to be very low latency. If you're working with WebRTC, G.722, for example, has 4 ms latency (compared with over 100 ms for MP3), and AMR's latency is around 25 ms. Note: For more about WebRTC and the codecs it can use, see Codecs used by WebRTC. The codecs generally used on the web that are used fo...
Web Performance
web server. Intersection Observer API Learn to time element visibility with the Intersection Observer API and be asynchronously notified when elements of interest becomes visible. Other documentation Developer Tools Performance Features This section provides information on how to use and understand the performance features in your developer tools, including Waterfall, Call Tree, and Flame
Charts. Profiling with the built-in profiler Learn how to profile app performance with Firefox's built-in profiler. Glossary Terms Beacon Brotli compression Client hints Code splitting CSSOM Domain sharding Effective connection type First contentful paint First CPU idle First input delay First interactive First meaningful paint First paint HTTP HTTP/2 Jank Latency Lazy load ...
...gative impacts TLS has had on server performance, it still represents a substantial slice of the time we spend waiting for browsers to connect to servers. This article explains the TLS handshake process, and offers some tips for reducing this time, such as OCSP stapling, HSTS preload headers, and the potential role of resource hints in masking TLS latency for third parties. Reading performance
charts Developer tools provide information on performance, memory, and network requests. Knowing how to read waterfall
charts, call trees, traces, flame
charts , and allocations in your browser developer tools will help you understand waterfall and flame
charts in other performance tools. Alternative media formats When it comes to images and videos, there are more formats than you're likely aware o...
alignment-baseline - SVG: Scalable Vector Graphics
baseline Uses the dominant baseline choice of the parent. Matches the box's corresponding baseline to that of its parent. before-edge The alignment-point of the object being aligned is aligned with the "before-edge" baseline of the parent text content element. text-bottom Matches the bottom of the box to the top of the parent's...
...ned with the "after-edge" baseline of the parent text content element. text-top Matches the top of the box to the top of the parent's content area. text-after-edge The alignment-point of the object being aligned is aligned with the "text-after-edge" baseline of the parent text content element. Note: This keyword may be mapped to text-bottom. ideographic Matches the box's ideographic
character face under-side baseline to that of its parent. alphabetic Matches the box's alphabetic baseline to that of its parent. hanging The alignment-point of the object being aligned is aligned with the "hanging" baseline of the parent text content element. mathematical Matches the box's mathematical baseline to that of its parent. top Aligns the top of the aligned subtree with the to...
class - SVG: Scalable Vector Graphics
An element's class name serves two key roles: As a style sheet selector, for when an author assigns style information to a set of elements. For general use by the browser. You can use this class to style SVG content using CSS. ...
...n): The class attribute List-of-Ts <list-of-Ts> (Where T is some type.) A list consists of a separated sequence of values. Unless explicitly described differently, lists within SVG's XML attributes can be either comma-separated (with optional white space before or after the comma), or white space-separated. White space in lists is defined as one or more of the following consecutive
characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form-feed" (U+000C). The following is a template for an EBNF grammar describing the <list-of-Ts> syntax: list-of-Ts ::= T | T, list-of-Ts Within the SVG DOM, values of a <list-of-Ts> type are represented by an interface specific for the particular type T. For example, a <list-of-le...
glyph-name - SVG: Scalable Vector Graphics
The glyph names can be referenced in kerning definitions created by <hkern> and <vkern> elements. ...
... The glyph names can be referenced in kerning definitions created by <hkern> and <vkern> elements. ...
glyph-orientation-vertical - SVG: Scalable Vector Graphics
be applied to any element but it has effect only on the following five elements: <altGlyph>, <textPath>, <text>, <tref>, and <tspan> Context notes Value auto | <angle> Default value auto Animatable No auto Fullwidth ideographic and fullwidth Latin text will be set with a glyph orientation of 0 degrees. Ideographic punctuation and other ideographic
characters having alternate horizontal and vertical forms will use the vertical form of the glyph. Text which is not fullwidth will be set with a glyph orientation of 90 degrees. This reorientation rule applies only to the first-level non-ideographic text. All further embedding of writing modes or bidirectional processing will be based on the first-level rotation. Note: Text set in this "rotated...
...graphic text. All further embedding of writing modes or bidirectional processing will be based on the first-level rotation. Note: Text set in this "rotated" manner may contain ligatures or other glyph combining and reordering common to the language and script. (This presentation form does not disable auto-ligature formation or similar context-driven variations.) The determination of which
characters should be auto-rotated may vary across user agents. The determination is based on a complex interaction between country, language, script,
character properties, font, and
character context. <angle> The value of the angle is restricted to 0, 90, 180, and 270 degrees. If another angle is specified, it is rounded to the closest of the permitted values. A value of 0deg indicates that al...
kernelMatrix - SVG: Scalable Vector Graphics
The number of entries in the list must equal to <orderX> by <orderY> as defined in the order attribute. ...
...mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolveMatrix2); transform:translateX(220px);"/> </svg> Usage notes Value <list of numbers> Default value None Animatable Yes <list of numbers> The list of <number>s that make up the kernel matrix for the convolution. Values are separated by space
characters and/or a comma. The number of entries in the list must equal <orderX> times <orderY>. If the result of orderX * orderY is not equal to the the number of entries in the value list, the filter primitive acts as a pass through filter. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'kernelMatrix' in that specificatio...
kerning - SVG: Scalable Vector Graphics
xt x="10" y="110" kerning="20px">length</text> </svg> Usage notes Value auto | <length> Default value auto Animatable Yes auto This value indicates that the spacing between glyphs is adjusted based on kerning tables that are included in the font that will be used. <length> If a length is provided, then auto-kerning is disabled. Instead, inter-
character spacing is set to the given length. If a length is provided without a unit identifier (e.g., an unqualified number such as 128), the length is processed as a width value in the current user coordinate system. If a unit identifier (e.g., 0.25em or 1%) is provided, then the length is converted into a corresponding value in the current user coordinate system. The most common scenario, other...
... ...
lang - SVG: Scalable Vector Graphics
d with a different meaning and only applying to <glyph> elements. That attribute specified a list of languages in BCP 47 format. The glyph was meant to be used if the xml:lang attribute exactly matched one of the languages given in the value of this parameter, or if the xml:lang attribute exactly equaled a prefix of one of the languages given in the value of this parameter such that the first tag
character following the prefix was "-". All elements are using this attribute. <svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <text lang="en-US">This is some English text</text> </svg> Usage notes Value <language-tag> Default value None Animatable No <language-tag> This value specifies the language used for the element. The syntax...
...//www.w3.org/2000/svg"> <text lang="en-US">This is some English text</text> </svg> Usage notes Value <language-tag> Default value None Animatable No <language-tag> This value specifies the language used for the element. The syntax of this value is defined in the BCP 47 specification. The most common syntax is a value formed by a lowercase two-
character part for the language and an uppercase two-
character part for the region or country, separated by a minus sign, e.g. en-US for US English or de-AT for Austrian German. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'lang' in that specification. Candidate Recommendation Made the lang attribute (without names...
stemh - SVG: Scalable Vector Graphics
Also, either by design or by error, all stems may have slightly different widths. If this attribute is used, the units-per-em must also be used. ...
...Also, either by design or by error, all stems may have slightly different widths. If this attribute is used, the units-per-em must also be used. ...
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 t...
...e 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 the u1 and g1 attributes. Two elements are using this attribute: <hkern> and <vkern> Context notes Value [ <
character> | <urange> ]# Default value None Animatable No [ <
character> | <urange> ]# 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.
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...
... 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 the u2 and g2 attributes. Two elements are using this attribute: <hkern> and <vkern> Context notes Value [ <
character> | <urange> ]# Default value None Animatable No [ <
character> | <urange> ]# 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...
xlink:href - SVG: Scalable Vector Graphics
defines the location of the referenced object. Value <iri> Default value None Animatable Yes altGlyph For <altGlyph>, xlink:href defines the reference either to a <glyph> element in an SVG document fragment or to an <altGlyphDef> element. If the reference is to a <glyph> element and that glyph is available, then that glyph is rendered instead of the
characters that are inside of the <altGlyph> element. If the reference is to an <altGlyphDef> element, then if an appropriate set of alternate glyphs is located from processing the <altGlyphDef> element, then those alternate glyphs are rendered instead of the
characters that are inside of the <altGlyph> element. Value <iri> Default value None Animatable No ...
...es a reference to the <path> element onto which the glyphs will be rendered. Value <iri> Default value None Animatable Yes use For <use>, xlink:href defines the location of the referenced object. Value <iri> Default value None Animatable Yes tref For <tref>, xlink:href defines a reference to an element whose
character data content shall be used as
character data for this <tref> element. Value <iri> Default value None Animatable Yes Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'href for <a>' in that specification. Recommendation Defines href for the <a> element.
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
mplementation status unknown Deprecated xml:space attribute Implementation status unknown kerning property removed Implementation status unknown path attribute for <textPath> Implemented (bug 1446617) Reference basic shapes to <textPath> Implementation status unknown side attribute for <textPath> Implemented (bug 1446650) Render
characters for one loop of a single closed path, effected by the startOffset attribute and text-anchor property Implementation status unknown <tref> removed Implementation status unknown <altGlyph>, <altGlyphDef>, <altGlyphItem> and <glyphRef> removed <altGlyph>, <altGlyphDef> and <altGlyphItem> removed (bug 1260032), <glyphRef> never really implemented (bug 1302693) ...
...nd <glyphRef> removed <altGlyph>, <altGlyphDef> and <altGlyphItem> removed (bug 1260032), <glyphRef> never really implemented (bug 1302693) SVGTextContentElement.selectSubString() deprecated Implementation status unknown getComputedTextLength() not including dx and dy values Implementation status unknown Text in non-rendered elements not included in addressable
characters Implementation status unknown Unknown elements in text render as unpositioned spans Implementation status unknown Offset distances of text positioned along a transformed path measured in text elements coordinate system Implementation status unknown Embedded Content Change Notes <video> Implementation status unknown <aud...
Basic shapes - SVG: Scalable Vector Graphics
tion of point 2. y2 The y position of point 2. Polyline A <polyline> is a group of connected straight lines. Since the list of points can get quite long, all the points are included in one attribute: <polyline points="60, 110 65, 120 70, 115 75, 130 80, 125 85, 140 90, 135 95, 150 100, 145"/> points A list of points. Each number must be separated by a space, comma, EOL, or a line feed
character. Each point must contain two numbers: an x coordinate and a y coordinate. So, the list (0,0), (1,1), and (2,2) would be written as 0, 0 1, 1 2, 2. Polygon A <polygon> is similar to a <polyline>, in that it is composed of straight line segments connecting a list of points. For polygons though, the path automatically connects the last point with the first, creating a closed shape. Note:...
...nects the last point with the first, creating a closed shape. Note: A rectangle is a type of polygon, so a polygon can be used to create a <rect/> element in cases where you need a little more flexibility. <polygon points="50, 160 55, 180 70, 180 60, 190 65, 205 50, 195 35, 205 40, 190 30, 180 45, 180"/> points A list of points, each number separated by a space, comma, EOL, or a line feed
character. Each point must contain two numbers: an x coordinate and a y coordinate. So, the list (0,0), (1,1), and (2,2) would be written as 0, 0 1, 1 2, 2. The drawing then closes the path, so a final straight line would be drawn from (2,2) to (0,0). Path A <path> is the most general shape that can be used in SVG. Using a path element, you can draw rectangles (with or without rounded corners), cir...
SVG fonts - SVG: Scalable Vector Graphics
<missing-glyph><path d="M0,0h200v200h-200z"/></missing-glyph> <glyph unicode="!" horiz-adv-x="300"><!-- Outline of exclam. pt. glyph --></glyph> <glyph unicode="@"><!-- Outline of @ glyph --></glyph> <!-- more glyphs --> </font> We start with the <font> element. This bears an id attribute, to enable it to be referenced via a URI (see below). The horiz-adv-x attribute determines how wide a
character is on average compared to the path definitions of the single glyphs. The value 1000 sets a reasonable value to work with. There are several accompanying attributes that help further define the basic glyph-box layout. The <font-face> element is the SVG equivalent of the CSS @font-face declaration. It defines basic properties of the final font such as weight, style, etc. In the example above ...
...s glyph. If you also specify the lang attribute on a glyph, you can further restrict it to certain languages (represented by xml:lang on the target) exclusively. Again, you can use arbitrary SVG to define the glyph, which allows for great effects in supporting user agents. There are two further elements that can be defined inside font: <hkern> and <vkern>. Each carries references to at least two
characters (attributes u1 and u2) and an attribute k that determines how much the distance between those
characters should be decreased. The below example instructs user agents to place the "A" and "V"
characters closer together the standard distance between
characters. <hkern u1="A" u2="V" k="20" /> Referencing a font When you have put together your font declaration as described above, you can ju...
SVG: Scalable Vector Graphics
lying SVG effects to HTML content SVG works together with HTML, CSS and JavaScript. Use SVG to enhance a regular HTML page or web application. View All... Community View Mozilla forums... Mailing list Newsgroup RSS feed Tools SVG Test Suite Markup Validator More Tools... Other resources: XML, CSS, DOM, Canvas Examples Google Maps (route overlay) & Docs (spreadsheet
charting) SVG bubble menus SVG authoring guidelines An overview of the Mozilla SVG Project Frequently asked questions regarding SVG and Mozilla SVG as an image SVG animation with SMIL SVG art gallery Animation and interactions Like HTML, SVG has a document model (DOM) and events, and is accessible from JavaScript. This allows developers to create rich animations and interactive images. So...
...ery Animation and interactions Like HTML, SVG has a document model (DOM) and events, and is accessible from JavaScript. This allows developers to create rich animations and interactive images. Some real eye-candy SVG at svg-wow.org Firefox extension (Grafox) to add a subset of SMIL animation support Interactive photos manipulation HTML transformations using SVG's foreignObject Mapping,
charting, games & 3D experiments While a little SVG can go a long way to enhanced web content, here are some examples of heavy SVG usage. Connect 4 jVectorMap (interactive maps for data visualization) JointJS (JavaScript diagramming library) D3 ( JavaScript library for visualizing data with HTML, SVG, and CSS ) ...
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
SLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The <xsl:number> element counts things sequentially. It can also be used to quickly format a number. Syntax <xsl:number count=EXPRESSION level="single" | "multiple" | "any" from=EXPRESSION value=EXPRESSION format=FORMAT-STRING lang=XML:LANG-CODE letter-value="alphabetic" | "traditional" grouping-separator=
CHARACTER grouping-size=NUMBER /> Required Attributes None. Optional Attributes count Specifies what in the source tree should be numbered sequentially. It uses an XPath expression. level Defines how levels of the source tree should be considered in generating sequential numbers. It has three valid values: single, multiple, and any. The default value is single: single Numbers ...
...habet should be used in letter-based numbering formats. letter-value Disambiguates between numbering sequences that use letters. Some languages have more than one numbering system that use letters. If both systems begin with the same token, ambiguity can arise. This attribute can have the value "alphabetic" or "traditional". The default is "alphabetic". grouping-separator Specifies what
character should be used as the group (e.g. thousands) separator. The default is the comma (,). grouping-size Indicates the number of digits that make up a numeric group. The default value is "3". Type Instruction, appears within a template. Defined XSLT, section 7.7 Gecko support Partial support. See comments above. ...
Communicating With Other Scripts - Archive of obsolete content
var tabs = require("sdk/tabs"); var mod = require("sdk/page-mod"); var self = require("sdk/self"); var pageUrl = self.data.url("page.html") var pageMod = mod.PageMod({ include: pageUrl, contentScriptFile: self.data.url("content-script.js"), contentScriptWhen: "ready" }) tabs.open(pageUrl); The target web page "page.html" includes a button and a page script: <html> <head> <meta
charset="utf-8"> </head> <body> <input id="message" type="button" value="Send a message"/> <script type="text/javascript" src="page-script.js"></script> </body> </html> The content script "content-script.js" adds an event listener to the button, that sends a custom event containing a message: var messenger = document.getElementById("message"); messenger.addEventListener("click", sendCu...
Interacting with page scripts - Archive of obsolete content
var tabs = require("sdk/tabs"); var mod = require("sdk/page-mod"); var self = require("sdk/self"); var pageUrl = self.data.url("page.html") var pageMod = mod.PageMod({ include: pageUrl, contentScriptFile: self.data.url("content-script.js"), contentScriptWhen: "ready" }) tabs.open(pageUrl); The target web page "page.html" includes a button and a page script: <html> <head> <meta
charset="utf-8"> </head> <body> <input id="message" type="button" value="Send a message"/> <script type="text/javascript" src="page-script.js"></script> </body> </html> The content script "content-script.js" adds an event listener to the button, that sends a custom event containing a message: var messenger = document.getElementById("message"); messenger.addEventListener("click", sendCu...
clipboard - Archive of obsolete content
r sit amet"); var contents = clipboard.get(); Set the clipboard contents to some HTML. var clipboard = require("sdk/clipboard"); clipboard.set("<blink>Lorem ipsum dolor sit amet</blink>", "html"); If the clipboard contains HTML content, open it in a new tab. var clipboard = require("sdk/clipboard"); if (clipboard.currentFlavors.indexOf("html") != -1) require("sdk/tabs").open("data:text/html;
charset=utf-8," + clipboard.get("html")); Set the clipboard contents to an image. var clipboard = require("sdk/clipboard"); clipboard.set("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYA" + "AABzenr0AAAASUlEQVRYhe3O0QkAIAwD0eyqe3Q993AQ3cBSUKpygfsNTy" + "N5ugbQpK0BAADgP0BRDWXWlwEAAAAAgPsA3rzDaAAAAHgPcGrpgAnzQ2FG" + "bWRR9AAAAABJRU5ErkJggg%3D%3D"); ...
context-menu - Archive of obsolete content
e image string The item's icon, a string URL. The URL can be remote, a reference to an image in the add-on's data directory, or a data URI. data string An optional arbitrary value to associate with the item. It must be either a string or an object that implements toString(). It will be passed to click listeners. accesskey single-
character string New in Firefox 35. Access key for the item. Pressing this key selects the item when the context menu is open. context value If the item is contained in the top-level context menu, this declaratively specifies the context under which the item will appear; see Specifying Contexts above. contentScript string,array If ...
hotkeys - Archive of obsolete content
': "accel-s" "meta-shift-i" "control-alt-d" All Hotkeys require at least one modifier as well as the key. These are the possible modifiers you can supply: shift: The Shift key. alt: The Alt key. On the Macintosh, this is the Option key. On Macintosh this can only be used in conjunction with another modifier, since Alt-Letter combinations are reserved for entering special
characters in text. meta: The Meta key. On the Macintosh, this is the Command key. control: The Control key. accel: The key used for keyboard shortcuts on the user's platform, which is Control on Windows and Linux, and Command on Mac. Usually, this would be the value you would use. pageup: The Page Up key. pagedown: The Page Down key. onPress Function ...
simple-prefs - Archive of obsolete content
e SDK. You can change the sub-branch of extensions using the preferences-branch key in your add-on's package.json file. Globals Functions on(prefName, listener) Registers an event listener that will be called when a preference is changed. The event listener may take an optional parameter that specifies the name of the property which changed. Preference change events are triggered for every
character typed by the user. They are also triggered once during add-on initialization. Example: function onPrefChange(prefName) { console.log("The preference " + prefName + " value has changed!"); } require("sdk/simple-prefs").on("somePreference", onPrefChange); require("sdk/simple-prefs").on("someOtherPreference", onPrefChange); // `""` listens to all changes in the...
net/url - Archive of obsolete content
to read content from a URI. Globals Functions readURI(uri, options) Reads a URI and returns a promise. Parameters uri : string The URL, as a string, to load. options : object Optional options: Name Type sync boolean If this option is set to true, the promise returned will be resolved synchronously. Defaults to false if not provided.
charset string The
character set to use when read the content of the uri given. Defaults to UTF-8 if not provided. Returns promise : The promise that will be resolved with the content of the URL given. ...
net/xhr - Archive of obsolete content
s may be inconsequential if the client can't access the network. If access to local area networks isn't prevented, malicious code could access sensitive data. If transmission of cookies isn't prevented, malicious code could access sensitive data. Attenuating access based on a regular expression may be ineffective if it's easy to write a regular expression that looks safe but contains a special
character or two that makes it far less secure than it seems at first glance. Possible Attenuations Before being exposed to unprivileged code, this object needs to be attenuated in such a way that, at the very least, it can't access the user's filesystem. This can probably be done most securely by white-listing the protocols that can be used in the URL passed to the open() method, and limiting them ...
Add a Context Menu Item - Archive of obsolete content
' var text = window.getSelection().toString();' + ' self.postMessage(text);' + '});', image: self.data.url("icon-16.png"), onMessage: function (selectionText) { console.log(selectionText); } }); Adding an access key New in Firefox 35. From Firefox 35 you can specify an access key using the accesskey option. This must be a single-
character string. Pressing the key selects the option when the context menu is open: var contextMenu = require("sdk/context-menu"); var menuItem = contextMenu.Item({ label: "Log Selection", context: contextMenu.SelectionContext(), contentScript: 'self.on("click", function () {' + ' var text = window.getSelection().toString();' + ' self.postMessage(text);' + ...
Storing annotations - Archive of obsolete content
e able to click links in the panel, but we want to open them in the main browser window rather than the panel. So the content script binds a click handler to the links which will send the URL to the add-on. Save this file in data/list as annotation-list.js. ...
Finding window handles - Archive of obsolete content
Ci.nsIBaseWindow); var NSWindowString = baseWindow.nativeHandle; Components.utils.import('resource://gre/modules/ctypes.jsm'); var objc = ctypes.open(ctypes.libraryName('objc')); // types let id = ctypes.voidptr_t; let SEL = ctypes.voidptr_t; // constants let nil = ctypes.voidptr_t(0); //common functions let sel_registerName = objc.declare('sel_registerName', ctypes.default_abi, SEL, ctypes.
char.ptr); let objc_msgSend = objc.declare('objc_msgSend', ctypes.default_abi, id, id, SEL, '...'); /* https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/index.html#//apple_ref/occ/instp/NSApplication/orderFront: * [NSWindowPtr orderFront:nil] */ var orderFront = sel_registerName('orderFront:'); var NSWindowPtr = ctypes.voidptr_t(ctyp...
Forms related code snippets - Archive of obsolete content
Here are some <form> related code snippets. Date picker (before implementing it in a working environment, please read the note about the const statement compatibility) <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" /> <title>DatePicker Example - MDN</title> <script type="text/javascript"> /*\ |*| |*| DatePicker Example MDNDeveloper Network |*| |*| https://developer.mozilla.org/docs/Code_snippets/Forms |*| https://developer.mozilla.org/User:fusionchess |*| |*| This snippet is released under the GNU Public License, version 3 or later. |*| http://www.gnu.org/licenses/gpl-3.0-standalone.html |*| \*/ (function () { function DatePicker (oTarget) { const oTable = document.createElement("table"), oHRow = document.createElemen...
getAttributeNS - Archive of obsolete content
This is assumed so don't try to get an xmlns for the 'xml' prefix return thisitem.getAttribute('xml:'+nsatt); // Prefix must be 'xml' per the specs } var attrs2, result; var attrs = thisitem.attributes; var prefixAtt = new RegExp('^(.*):'+nsatt.replace(/\./g, '\\.')+'$'); // e.g., xlink:href // Find any prefixes with the local-name being searched (escape period since only
character (besides colon) allowed in an XML Name which needs escaping) for (var j = 0; j < attrs.length; j++) { // thisitem's atts // e.g., abc:href, xlink:href while (((result = prefixAtt.exec(attrs[j].nodeName)) !== null) && thisitem.nodeName !== '#document' && thisitem.nodeName !== '#document-fragment') { var xmlnsPrefix = new RegExp('^xmlns:'+result[1]+...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
build tree at db/sqlite. By adapting the makefile in this way, the library is created as part of the standard Mozilla build process, which eliminates additional build steps. The downside is that you will need to update the modified makefile any time a new version of the library is released. For libraries that have complex configuration processes, use a non-standard compiler or have other special
characteristics, it may be unfeasible to create a Mozilla-compliant makefile. In this case, I would recommend placing the entire library distribution inside the project or subproject that uses it. So if library acmelib is used inside the multifarious/ subproject in the above example, it would be placed as a subdirectory underneath that subproject (at the same level as public/ and src/). Of course, th...
Listening to events in Firefox extensions - Archive of obsolete content
rontend already listens for a number of these progress events from web pages. Most of this goes on in browser.js. DOMLinkHandler The DOMLinkHandler object is called by the DOMLinkAdded event in order to detect any RSS feeds, site icons, or OpenSearch plugins for the web site. pageShowEventHandlers The pageShowEventHandlers() function is called by the pageshow event and is used to populate the
character set menu and update the UI elements associated with any detected feeds or OpenSearch plugins for the website. XULBrowserWindow XULBrowserWindow is an nsIWebProgressListener used to get progress events for the currently visible browser. It is used to update the UI for many different reasons: Update the progress bar and status messages as pages load Turn on and off the throbber as pages ...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
jp/~t-susumu/ 3 - Reverse-Polish Notation. A way to represent arithmetic formulas. For example, (1+2)*(3-4) would be represented in RPN as 1 2 + 3 4 - * It uses no parentheses. It is also easy to program. 4 - gonzui does not handle search strings with spaces very well; instead, go to the Advanced Search page, search on a few terms, and then use your browser's Find function to search for the ":"
character. 5 - Mac OS X and other OSs seemingly do not internationalize their directory names, but this hasn't been confirmed. ...
Connecting to Remote Content - Archive of obsolete content
uations were you may want to use XSLT: Convert a large XML document directly into XUL. Filter a complex XML file and generate a simpler XML document with only the data you need, so then you can use regular DOM functions to read it. Convert XML into SQL statements. You could use this to generate a script to run on your local database. You would of course need to be very careful about escaping
characters and protecting yourself against SQL injection attacks. Convert XML into RDF. This was more useful when RDF was the default storage format. You can still use RDF as an intermediate format, though, and then use templates to generate XUL and display the data. HTTP debugging When you start debugging HTTP requests, you may find it hard to know exactly what data was sent, especially with POST...
Intercepting Page Loads - Archive of obsolete content
k for TYPE_SUBDOCUMENT as well if we want frames. if ((Components.interfaces.nsIContentPolicy.TYPE_DOCUMENT == aContentType) && SOME_REGULAR_EXPRESSION.test(aContentLocation.spec)) { // do stuff here, possibly changing result. } return result; } The content policy is applied very early in the process, even before the request is made, allowing a very clean cancel operation. This
characteristic brings 2 limitations to this approach. The first one is that you can't easily read or modify the content to be loaded. The second one is that shouldLoad is not invoked for redirects. You only get one call, for the first URL requested. If you let it pass, it can redirect anywhere without you noticing it. This approach is used in popular filtering extensions, such as AdBlock Plus. We reco...
Firefox addons developer guide - Archive of obsolete content
method and variable names: class name If you want to add a FIXME, add: FIXME: a message Notes: The original document is in Japanese and distributed via the xuldev.org website. So there may be still some reference to the xuldev website (we want to host source code on MDC, not on xuldev), and to Japanese things (like some specific locales, which have been translated to French since non-latin
characters are not well supported). There are a few things that could be done to make this fit the site better, and for general cleaning up: Tables should use the "standard-table" CSS class so they're styled the same as those on the rest of MDC. There should be some introductory text on the table of contents page at https://developer.mozilla.org/En/Firefox_addons_developer_guide Obviously there ...
Add-ons - Archive of obsolete content
sers and developers compared to the old xpinstall/-style extensions. Firefox addons developer guide The original document is in Japanese and distributed via the xuldev.org website. So there may be still some reference to the xuldev website (we want to host source code on MDC, not on xuldev), and to Japanese things (like some specific locales, which have been translated to French since non-latin
characters are not well supported). Hotfix Extension This document has been moved to the Add-ons wiki. How to convert an overlay extension to restartless First off, what kind of add-on are we talking about here? Well, XUL overlays and windows, JSM files, chrome & resource mappings with localization, default preferences, but no XPCOM components of your own. Some of that will have to be replaced and...
XML data - Archive of obsolete content
} depth:before { content: "Mean depth: "; } depth:after { content: " m"; } Open the document in your browser: Oceans Arctic Area: 13,000 million km2 Mean depth: 1,200 m Atlantic Area: 87,000 million km2 Mean depth: 3,900 m . . . Notes about this demonstration: The superscript 2 (in "million km2") a Unicode
character, coded as \B2 in the CSS file. The heading, "Oceans", has a negative top margin, moving it up so it is displayed on top of the border. Challenge Change the stylesheet so that it displays the document as a table. (See the Tables chapter in the CSS Specification for examples that you can adapt.) What next? If you had difficulty understanding this page, or if you h...
Beginner tutorials - Archive of obsolete content
This page includes archived beginners tutorials, from various places around MDN. Creating reusable content with CSS and XBLThis page illustrates how you can use CSS in Mozilla to improve the structure of complex applications, making code and resources more easily reusable.Underscores in class and ID NamesSummary: The use of the underscore
character in CSS can lead to major display problems in multiple browsers. Learn why this is so, and how to keep your sites from being bitten by this problem. This technical note examines the use of underscores in CSS, and why they should be generally avoided in most circumstances.XML dataThis page contains an example of how you can use CSS with XML data.XUL user interfacesThis page illustrates Mozilla's specialized language for creating user interfac...
Case Sensitivity in class and id Names - Archive of obsolete content
n. In section 7.5.2, which defines class and IDs, we find the following text: id = name [CS] This attribute assigns a name to an element. This name must be unique in a document. class = cdata-list [CS] This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space
characters. The marker "[CS]" means "case sensitive," as defined in section 6.1 of the specification. Thus, the Mozilla team, committed to following open standards as closely as possible, implemented both class and id names as case-sensitive values. As of this writing, Netscape 6 is the only browser to honor this defined behavior; other browsers treat both class and id names as case-insensitive. I...
Events - Archive of obsolete content
Archived event pages DOMSubtreeModifiedMozAudioAvailableMozBeforeResizeMozOrientationcached
chargingchange
chargingtimechangecheckingdis
chargingtimechangedownloadingerrorlevelchangenoupdateobsoleteprogressupdateready ...
cert_override.txt - Archive of obsolete content
m:443 OID.2.16.840.1.101.3.4.2.1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:FF:EE:DD:CC:BB:AA:99:88:77:66:55:44:33:22:11:00 U AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAA== Fields Fields are separated by a tab
character. Each line is terminated by a line feed
character (UNIX format). domainname:port : port 443 for HTTPS (SSL) hash algorithm OID SHA1-256: OID.2.16.840.1.101.3.4.2.1 (most used) SHA-384: OID.2.16.840.1.101.3.4.2.2 SHA-512: OID.2.16.840.1.101.3.4.2.3 Certificate fingerprint using previous hash algorithm One or more
characters for override type: M : allow mismatches in the hostname U : allo...
No Proxy For configuration - Archive of obsolete content
hat was within the intranet, and should not be accessed via the proxy server. Due to various limitations, this feature should be used for only the most simple blacklist scenarios. In almost all cases, PAC gives better control and flexibility. User interface "No proxy for" is an optional field, part of "Manual proxy configuration". The field is relatively short, but can hold reasonably long (2K+
characters) entries. New profiles contain the values "localhost, 127.0.0.1", by default. Entry points: Preferences | Advanced | Proxies control-click menu for off line-online icon (network plug) Configuration The no proxy list is composed of either domain elements or IPv4 address elements. The elements are separated by either a space (" ") or a comma (","). Note for former-IE users: "*" is ...
Source code directories overview - Archive of obsolete content
r platform independent drawing and imaging. It can be used to draw rectangles, lines, images, etc. Essentially, it is a a set of interfaces for a platform-independent device (drawing) context. It does not handle widgets or specific drawing routines; it just provides the primitive operations for drawing. intl contains C interfaces and code for supporting localization. It contains code for various
character sets, locale formats (e.g. the format of the date and time for different cultures) and other localization facilities. ipc contains jpeg contains C code for reading/writing JPEG images. This code originated as the reference implementation for the JPEG specification from the Independent JPEG Group. js contains C code for tokenizing, parsing, interpretting and executing Javascript scripts. T...
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
about:plugins to verify the plugin is detected Open the file "test.html" and begin testing. Make sure the mimetypes of your html embed tags match the mimetype specified in your nprt.rc file and the top of your npp_gate.cpp file Version Issues If VC++ compiler throws you error C2664 on 'DrawText' function call, you may replace it by 'DrawTextA'. In fact, all win32 API functions dealing with
character strings can be added an 'A' to the end to avoid unicode cast errors. Visual C++ 2008 Express don't support C99 standard about int32_t, uint32_t. You have to add #include "nptypes.h" in top of plugin.h file. Feel free to append here your issues fixes if the above guide helped you. ...
Creating a hybrid CD - Archive of obsolete content
content of this article may be out of date. It was last updated in 2001. As a cross platform product, releases of Mozilla on CD should also work on any platform. The CD should support HFS (Macintosh), Joliet (Win32), and Rock Ridge (Unix). Many Mozilla files have long file names which makes creating the CD on a Macintosh difficult because the HFS filesystem limits the length of file names to 32
characters. The utility mkhybrid lets you create hybrid CDs that work with all three filesystems. Mkhybrid was written by James Pearson and is is a component of the latest versions of cdrecord. I used version 1.8.1a03 although you'll probably want to get a newer one. Here's what I did to create the CD for the second anniversary party. mkhybrid -o ~/party.iso -r -J -hfs -V mozilla.party -map ~/HFSmapp...
Using Dehydra - Archive of obsolete content
As GCC compiles file, Dehydra calls functions in the user analysis script with information about the code being compiled. For more information, see the function reference and the object reference. ...
Introducing the Audio API extension - Archive of obsolete content
mentById('audio-element'); audio.addEventListener('MozAudioAvailable', audioAvailable, false); audio.addEventListener('loadedmetadata', loadedMetadata, false); </script> </body> </html> Creating an audio stream It is also possible to create and setup an <audio> element for raw writing from script (i.e., without a src attribute). Content scripts can specify the audio stream's
characteristics, then write audio samples. Users must create an audio object and then use the mozSetup() function to specify the number of channels and the frequency (in Hz). For example: // Create a new audio element var audioOutput = new Audio(); // Set up audio element with 2 channel, 44.1KHz audio stream. audioOutput.mozSetup(2, 44100); Once this is done, the samples need to be created. Those ...
Menu - Archive of obsolete content
icon string The URL of an icon to display in the menuitem. Note that some environments, notably Gnome 2.28, do not support menuitem icons either by default or at all. label string The label of the menuitem. menu jetpack.Menu If defined, the menuitem expands into a submenu. mnemonic string A
character that is used as the item's shortcut key while the menu is open. It should be one of the
characters that appears in the item's label. On some platforms this
character is underlined in the label. type string Currently only "separator" is supported. If this property is undefined, the item is a normal menuitem. Note that when type == "separator", any other properties...
New Security Model for Web Services - Archive of obsolete content
pecified, will be checked against the type of request being requested by the script, such as "soap", "soapv", or "load". Types must not contain spaces. Specify "any" as the type to permit any requested type of access to resources. The principle URI of the script will be checked for the specified URI prefix. If "from" is not specified, then all scripts will be allowed. Note: One can also use wild
charater(s) in "from" value. For example: <wsa:allow type="soapv" from="http://www.mozilla.org"/> This command allows SOAP requests with verification headers from scripts loaded from the domain www.mozilla.org. <wsa:allow type="soapv" from="http://*.mozilla.org"/> This command allows SOAP requests with verification headers from scripts loaded from the domain with host name containing mozilla.or...
Plug-n-Hack - Archive of obsolete content
capabilities to all browsers and all security tools is much more useful for security researchers and application developers and testers. As a result we have designed and developed the PnH protocol to be both browser and tool independent. The current protocol and Firefox implementation are released under the Mozilla Public License 2.0 which means it can be incorporated in commercial tools without
charge. Plug-n-Hack topics Phase 1 This provides simplified integration and allows tools to advertize their capabilities to browsers Phase 2 This will allow browsers to advertize their capabilities to security tools Tools supporting PnH The browsers and tools known to support or be working on support for PnH Get Involved How to implement PnH in ...
RDF Datasource How-To - Archive of obsolete content
ntiated from the repository. Constructing a DLL for a component is beyond the scope of this document; the reader is referred to the RDF factory as a guideline. Registering an RDF datasource is fairly simple: in the DLL's NSRegisterSelf() method, you simply call the component manager's RegisterComponent() method: extern "C" PR_IMPLEMENT(nsresult) NSRegisterSelf(nsISupports* aServiceManager, const
char* aPath) { nsresult rv; ... // Assume compMgr refers to the component manager rv = compMgr->RegisterComponent(kMyDataSourceCID, "My Data Source", NS_RDF_DATASOURCE_PROGID_PREFIX "my-datasource", aPath, PR_TRUE, PR_TRUE); ... } Replace kMyDataSourceCID with your datasource's CLSID. Replace "My Data Source" with a descriptive string that should app...
Property - Archive of obsolete content
currentIndex currentItem currentNotification currentPage currentPane currentSet currentURI customToolbarCount database datasources date dateLeadingZero dateValue decimalPlaces decimalSymbol defaultButton defaultValue description dir disableAutocomplete disableAutoComplete disableautoselect disabled disableKeyNavigation dlgType docShell document
CharsetInfo editable editingColumn editingRow editingSession editor editortype emptyText Deprecated since Gecko 2 enableColumnDrag eventNode firstOrdinalColumn firstPermanentChild flex focused focusedItem forceComplete group handleCtrlPageUpDown handleCtrlTab hasUserValue height hidden hideSeconds highlightNonMatches homePage hour hourLeadingZero ...
Providing Command-Line Options - Archive of obsolete content
he command line."); } // CHANGEME: change "myapp" to your command line flag (no argument) if (cmdLine.handleFlag("myapp", false)) { openWindow(CHROME_URI, null); cmdLine.preventDefault = true; } }, // CHANGEME: change the help info as appropriate, but // follow the guidelines in nsICommandLineHandler.idl // specifically, flag descriptions should start at //
character 24, and lines should be wrapped at // 72
characters with embedded newlines, // and finally, the string should end with a newline helpInfo : " -myapp Open My Application\n" + " -viewapp <uri> View and edit the URI in My Application,\n" + " wrapping this description\n" }; var NSGetFactory = XPCOMUtils.generateNSGetFac...
Attribute Substitution - Archive of obsolete content
to an attribute value. To do this, just use two question marks or two carets in a row. For instance: <label value="What is my name?? My name is ?name"/> In this example, the label might be 'What is my name? My name is Jake'. Note that a caret only has a special meaning at the end of a variable, thus two in a row are only needed after a variable. One last thing to point out is that since the only
characters that can separate a variable are a caret, a space or the end of the attribute, this means that any other
character is valid as a variable name. However, for readability, you should restrict variable names to letters, numbers and perhaps hyphens to separate words. It may be desirable to have longer text wrap by placing it as the content of a description element. This means that we want to do...
XML Templates - Archive of obsolete content
between the action element and this element are only copied once. This is useful when recursive generation or multiple rules are used, and we'll see examples of why this is useful later. For an RDF query, the uri attribute specifies the member variable; for an XML query the member variable is always '?' so the value of the uri attribute for XML templates should always be the single question mark
character as in this example. The label attribute has been set to a special value ?name. When a question mark
character followed by a string appears in an attribute value, the label value is not directly, but instead the value of an attribute for the source XML is used. For each node generated by the XPath expression used in the query, the attribute on the generated XML node is taken and substituted ...
Code Samples - Archive of obsolete content
signed to work in Firefox, Thunderbird, Sunbird and SeaMonkey, except where the text says otherwise. Launch a file on your computer To launch a file on your computer, use code like this. Change the first line to specify the file that you want to launch. You can launch an executable file or some other file that your operating system knows how to open. Note: On operating systems that use backslash
characters, double each backslash
character. On operating systems that use forward-slash
characters, specify the file in the normal way. const path = "C:\\WINDOWS\\
CHARMAP.EXE" var file = Components .classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile) file.initWithPath(path) file.launch() Open a web page If your button is in Firefox or SeaMonkey, use code li...
Adding Properties to XBL-defined Elements - Archive of obsolete content
larly, you can replace the onset attribute with a setter element. The example below shows this: <property name="number"> <getter> return this.getAttribute('number'); </getter> <setter> var v = parseInt(val,10); if (!isNaN(v)) { this.setAttribute('number', '' + v); } </setter> </property> The property in this example will only be able to hold integer values. If other
characters are entered, they are stripped off. If there are no digits, the value is not changed. This is done in the code inside the setter element. The real value of the property is stored in the number attribute. You can use either syntax for creating get and set handlers. Readonly Attribute You can make a field or property read-only by adding a readonly attribute to the field tag or property tag an...
Localization - Archive of obsolete content
lace the DTD files in which you declare entities. Typically, you will have one DTD file for each XUL file, usually with the same filename except with a .dtd extension. So, for the find files dialog, we will need a file called findfile.dtd. For non-installed chrome files, you can just put the DTD file in the same directory as the XUL file. Note: You should encode DTD files as UTF-8 for non-ASCII
characters. That is, you should save them in UTF-8 format (without BOM). For more information, see Mozilla Language Packs. Once you have created a DTD file for your XUL, you will need to add a line to the XUL file which indicates that you want to use the DTD file. Otherwise, errors will occur as it won't be able to find the entities. To do this, add a line of the following form somewhere near the top...
Numeric Controls - Archive of obsolete content
<< PreviousNext >> 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. 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. However, the minimum and maximum values can also be specified using the min and max attributes. If these are set, ...
Skinning XUL Files by Hand - Archive of obsolete content
with the ID "navbar", and it will pick up the style information in the block. The third type of selector, thepseudo-class, is one you may have seen in the in-line style definitions for hyperlinks which commonly appear in HTML documents. The pseudo-class is connected to an element (or not: you can also define styles that apply to any element in the state specified by a pseudo-class) with the ":"
character. In this third type of style definition, the "A" element picks up the style information defined in the block only when it is, as a link, active. This last type is new to CSS2. To start creating the XUL skin: add the stylesheet processing instruction to the top of your XUL file. <?xml-stylesheet href="sample.css" type="text/css"?> create a new text file called sample.css. add the f...
Using nsIXULAppInfo - Archive of obsolete content
g/xre/app-info;1" in Components.classes) { // running under Mozilla 1.8 or later id = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULAppInfo).ID; } else { try { id = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch) .get
CharPref("app.id"); } catch(e) { // very old version dump(e); } } return id; } alert(getAppID()); See also MXR: nsIXULAppInfo.idl ...
XUL Accesskey FAQ and Policies - Archive of obsolete content
ntly In Mozilla, we use DTD's for one more layer of abstraction, for purposes of internationalization. The above example should say: <button label="Apply instantly" accesskey="&applyInstantly.accesskey" /> (Always use accesskey instead of akey). If methods like confirm(), confirmEx() or prompt() are being used to create a dialog, use an & before the button or checkbox text to make the next
character an accesskey. For example, "Do it &now" makes "n" the underlined accesskey. To insert a real ampersand, use &&. How do I pick an accesskey letter? Accesskey attribute is case sensitive! Notice that the difference between the button examples above is the case of the accesskey specified. Mozilla's accesskey implementation will first try to underline a letter of the same case, but if th...
XUL accessibility guidelines - Archive of obsolete content
anding the guidelines is vital. Learn More Accessibility Platform Features Mozilla Community Software Accessibility - Where Are We Today? Intro to accessibility, assistive technologies, and Mozilla resources. Introduction to Web Accessibility. Overview of web accessibility from WebAIM. Dive Into Accessibility. Downloadable book on web accessibility with tips and
character sketches. Assistive technology compatibility. List of popular assistive technologies and their respective compatibility levels with XUL. #accessibility. Accessibility channel for general discussion around Internet accessibility with logger. Useful at conferences. Apple Accessibility. Portal to Apple accessibility. LARS (Linux Accessibility Resource Site). Portal for general L...
XUL controls - Archive of obsolete content
ox. <textbox type="autocomplete" autocompletesearch="history"/> Textbox Reference <textbox type="number"> A textbox for entering numbers. Two arrow buttons are displayed for cycling through values. <textbox type="number" min="1" max="20"/> Textbox Reference <textbox type="password"> A textbox that hides the
characters typed, used for entering passwords. <textbox type="password"/> Textbox Reference <textbox type="search"> A textbox for searching. <textbox type="search"/> Textbox Reference <textbox type="timed"> Deprecated in Gecko 1.9.1 A textbox for responding to user input. The command event is fired after th...
menu - Archive of obsolete content
em label="Redo"/> </menupopup> </menu> </menubar> Attributes acceltext Type: string Text that appears beside the menu label to indicate the shortcut key (accelerator key) to use to invoke the command. If this value is set, it overrides an assigned key set in the key attribute. This attribute does not apply to menus directly on the menubar. 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. allowevents Type: boolean If true, events are passed to children of the element. Otherwise, events are passed to the element only. crop Type: one of the values below If the label of the eleme...
preference - Archive of obsolete content
order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. type Type: one of the values below The preference type which should be one of the following values. bool A boolean set to either true or false. Usually a checkbox would be connected to these preferences. int An integer string A string uni
char A Unicode string wstring A localized string. In this situation the preference will save the path to a property file which contains the actual value of the preference. file A file. The file path will be stored in the preferences. Properties defaultValue (readonly) Returns the default value of the preference. The type of the property depends on the value of the type property.
Application Update - Archive of obsolete content
I easier to construct. pref("app.update.auto", true); // Defines how the Application Update Service notifies the user about updates: // // AUM Set to: Minor Releases: Major Releases: // 0 download no prompt download no prompt // 1 download no prompt download no prompt if no incompatibilities // 2 download no prompt prompt // // See
chart in nsUpdateService.js.in for more details // pref("app.update.mode", 1); // If set to true, the Update Service will present no UI for any event. pref("app.update.silent", false); // Update service URL: // You do not need to use all the %VAR% parameters. Use what you need, %PRODUCT%,%VERSION%,%BUILD_ID%,%CHANNEL% for example pref("app.update.url", "https://yourserver.net/update/3/%PRODUCT%/%VER...
Getting started with XULRunner - Archive of obsolete content
on=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 application resources. This will become clearer when we see how the "chrome://" URI is used. Application chrome can be in a single or a few JAR files or uncompressed as folders and files. I am using the uncompressed method for now. Here is the chrome/ch...
XULRunner Hall of Fame - Archive of obsolete content
ing environment based on the use of a server-side headless mozilla-based browser. 30b A XULRunner-based wrapper for 30boxes.com XUL Explorer "a lightweight XUL IDE... an easy way to experiment with XUL" XULExplorer A patched version of XUL Explorer to re-enable application and extension skeleton generation. Foxkeh Clock (for Japanese page) A clock application based
charactor Foxkeh. Pyjamas-Desktop A Python Web Widget toolkit (similar to pyqt4 and pygtk2) that uses XULrunner DOM to implement the widgets and event handling. python-hulahop is required Python-Hulahop from the OLPC Sugarlabs A Python GTK Widget with XULrunner embedded, providing full access to nsI DOM and all other XULrunner interfaces, in a GTK window. It's possible to create your o...
nsIContentPolicy - Archive of obsolete content
r file #include "_path_to_sdk/include/content/nsIContentPolicy.h" class MyClass: public nsISupports, public nsIContentPolicy { ... NS_DECL_NSICONTENTPOLICY ... } // And this into your implementation file NS_IMPL_ISUPPORTSn(MyClass, nsISupports, nsIContentPolicy, ...) Note: Before you can recieve notifications, you must register your plugin with nsICategoryManager. See example below.
char* previous = nsnull; nsCOMPtr<nsICategoryManager> catman; servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID, NS_GET_IID(nsICategoryManager), getter_AddRefs(catman)); rv = catman->AddCategoryEntry("content-policy", COMPONENT_CLASSNAME, COMPONENT_CONTRACTID, PR_TRUE, PR_TRUE, &previous); JavaScript developers can also implement an XPCOM component that extends nsIContentPolicy. ...
Archived Mozilla and build documentation - Archive of obsolete content
jpeg images for the buttons and CSS to style everything else in the interface. Creating a Skin for SeaMonkey 2.x You're going to make a theme for SeaMonkey 2, but don't know how? I hope this manual will help you. Creating regular expressions for a microsummary generator A regular expression is a special kind of string (i.e. a sequence of
characters) that matches patterns of
characters in other strings. Microsummary generators use them to identify the pages that the generators know how to summarize by matching patterns in those pages' URLs. Dehydra The development focus switched to DXR (where the "D" comes from "Dehydra"), which is based on clang instead of gcc. Try DXR instead, or else try t...
Gecko Compatibility Handbook - Archive of obsolete content
t directory, use URLs of the form /path/file.html. Invalid use of spaces in name Attributes (such as image maps) Many authors seem to be infected by a penchant to use spaces in names. A name or id attribute in HTML 4.01 may not legally contain spaces. This can cause problems with Gecko-based browsers, especially in image maps. You should make sure that your name attributes are coded using valid
characters only. Bad Code Due to Old APIS and Tools Problem: Obsolete APIs or web authoring tools generate non-standard code. Many older versions of cross-browser APIs in common use around the web such as DYNAPI do not support Gecko for one or more of the reasons listed above. This is also the case for older versions of web authoring tools such as Macromedia's Dreamweaver 2 and 3. Newer versions o...
2006-12-01 - Archive of obsolete content
SS feeds. Devs say this is the way its supposed to be, others say its a bug! The debate continues. Discussion of support for Modal windows within Firefox 2.0 A lengthy post regarding the re-implementation of modal windows into firefox. Basic Feature that I think is a must in any web broswer A discussion revolving around the idea of having firefox automatically convert mistaken non-English
characters to English so that web addresses will be completed. mozStorage documentation up A revisted discussion surround the mozStorage documentation. rich results for searches A proposal to implement "rich results", a set of registered sites that would provide information as it relates to a user's search. Windows DDE Shell Integration removal A call for responses or concerns regarding th...
2006-10-20 - Archive of obsolete content
hancing the capabilities and ease of use of both Eudora and Thunderbird. Discussions How to use the TB/AB lastModifiedDate Item and how to solve the problem regarding to this item. There is a link provided might solve the stated problem. However, detail info of the problem is not clear, no futher suggestion or solution is provided thus far. Stefan Goppert suspect Thunderbird inserts a wrong
char("") in the BCC-field and want to confirm this issue. No respond posted for this discussion yet. Meetings None for this week. ...
2006-10-27 - Archive of obsolete content
Summary: mozilla.dev.apps.thunderbird - October 21-27, 2006 Announcements None for this week. Discussions Effect of Eudora/Thunderbird re-write JoeS is voicing a concern about the recent announcement regarding the Eudora/Thunderbird rewrite: "Is Thunderbird destined to become a hybrid of the existing code and Eudora?". Jonathan Prit
chard has clarified that announcement does not mean Thunderbird will be changing direction, just certain areas of development that are of interest to the Eudora developers will have more attention paid to them. Calling TB with a specific message to be displayed There's a new question by Guenter about calling TB from an external program (eg. Firefox) to display a message. Meetings None for this week. ...
2006-11-17 - Archive of obsolete content
Announcements Relicensing Rhino to MPL Rhino has been released under MPL/GPL license which makes it possible to distribute third party software with Apache. Discussions JS_AddNamedRoot A user is wondering where and when he would need to call JS_AddNamedRoot in C code. Special
characters Inquiry of how to use special
characters in spidermonkey. Recycle array objects A user trying to overcome the need of using huge number of arrays (as vectors) asks if its possible to reuse unreferenced array objects instead of create new ones in SpiderMonkey. Mike Shaver's response was that resurrecting objects is not possible and that objects in SpiderMonkey are not reference counted. ...
NPN_GetURLNotify - Archive of obsolete content
<< Gecko Plugin API Reference << Browser Side Plug-in API Summary Requests creation of a new stream with the contents of the specified URL; gets notification of the result. Syntax #include <npapi.h> NPError NPN_GetURLNotify(NPP instance, const
char* url, const
char* target, void* notifyData); Parameters The function has the following parameters: instance Pointer to the current plug-in instance. url Pointer to the URL of the request. Can be of any type, such as HTTP, FTP, news, or mailto. target Name of the target window or frame, or one of several special target names. For values, see NPN_GetURL(). notifyData Plug-in-private value for associating the request with the subsequent NPP_URLNot...
NPN_GetValueForURL - Archive of obsolete content
o Plugin API Reference << Browser Side Plug-in API Summary Provides information to a plugin which is associated with a given URL, for example the cookies or preferred proxy. Syntax #include <npapi.h> typedef enum { NPNURLVCookie = 501, NPNURLVProxy } NPNURLVariable; NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const
char *url,
char **value, uint32_t *len); Parameters This function has the following parameters: instance Pointer to the current plug-in instance. variable Selects the type of information to be retrieved (NPNURLVCookie or NPNURLVProxy) url The URL for which to fetch information. value Out parameter. The browser passes back the requested inf...
NPN_PostURLNotify - Archive of obsolete content
<< Gecko Plugin API Reference << Plug-in Side Plug-in API Summary Posts data to a URL, and receives notification of the result. Syntax #include <npapi.h> NPError NPN_PostURLNotify(NPP instance, const
char* url, const
char* target, uint32 len, const
char* buf, NPBool file, void* notifyData); Parameters The function has the following parameters: instance Current plug-in instance, specified by the plug-in. url URL of the POST request, specified by the plug-in. target Target window, specified by the plug-in. For values, see NPN_GetURL. len Length of th...
NPN_Status - Archive of obsolete content
message Pointer the buffer that contains the status message string to display. Description You can use this function to make your plug-in display status information in the browser window, in the same place the browser does. ...
NPN_Write - Archive of obsolete content
ser makes a copy of the buffer if necessary, so the plug-in can free the buffer as the method returns, if desired. See "Example of Sending a Stream" for an example that includes NPN_Write(). Example This example pushes a snippet of HTML over a newly created stream, then destroys the stream when it's done. Note: You should actually handle errors, which this example doesn't do. NPStream* stream;
char* myData = "<HTML><B>This is a message from my plug-in!</B></HTML>"; int32 myLength = strlen(myData) + 1; /* Create the stream. */ err = NPN_NewStream(instance, "text/html", "_blank", &stream) /* Push data into the stream. */ err = NPN_Write(instance, stream, myLength, myData); /* Delete the stream. */ err = NPN_DestroyStream(instance, stream, NPRES_DONE); See also NPP_NewStrea...
NPString - Archive of obsolete content
Summary NPString is a struct that holds a pointer to a sequence of 8-bit units (NPUTF8) making up a UTF-8 string, and the number of 8-bit units in the UTF-8 string. Note: Whenever an NPString owns its string data and the data may be released through a call to NPN_ReleaseVariantValue(), the string data must be allocated using NPN_MemAlloc(). Syntax typedef struct _NPString { const NPUTF8 *UTF8
Characters; uint32_t UTF8Length; } NPString; Fields The data structure has the following fields: UTF8
Characters An array of the UTF-8
characters comprising the string. UTF8Length The number of bytes in the UTF-8 string (not the number of
characters). ...
NPUTF8 - Archive of obsolete content
<< Gecko Plugin API Reference << Scripting plugins Summary NPUTF8 is a byte representing an 8-bit unit of a UTF-8
character. This is not the same thing as an entire UTF-8
character, which may be comprised of multiple NPUTF8 bytes. Syntax typedef
char NPUTF8; Description The NPUTF8 type is used in constructing UTF-8 strings for use by the plugin scripting API extension. ...
NPAPI plugin reference - Archive of obsolete content
environment. NPStream Represents a stream of data either produced by the browser and consumed by the plug-in, or produced by the plug-in and consumed by the browser. NPString NPString is a struct that holds a pointer to a sequence of 8-bit units (NPUTF8) making up a UTF-8 string, and the number of 8-bit units in the UTF-8 string. NPUTF8 NPUTF8 is a byte representing an 8-bit unit of a UTF-8
character. This is not the same thing as an entire UTF-8
character, which may be comprised of multiple NPUTF8 bytes. NPVariant NPVariant is a struct that holds a value and the type of that value. The value is held in a union, and the type is one of types defined in the NPVariantType enumeration. NPVariantType NPVariantType is an enumeration that is used to identify the data type of an NPVariant st...
Why RSS Content Module is Popular - Including HTML Contents - Archive of obsolete content
ce to putXML escaped HTML data in it. (Even through you are not suppose to.) For example, if your blog post was: This is <b>bold</b>. then the <description> would be: <description>This is <b>bold</b>.</description> Note that the "<" has been turned into "<". And the ">" has been turned into ">". This greatly bloats the size of contents but is necessary since certain
characters are no allowed in XML. XML does however have the CDATA convention. You can put (almost) whatever you want in a CDATA section. Including "<" and ">" without having to escape them. Using the example above we'd have: <description><![CDATA[This is <b>bold</b>.]]></description> This helps reduce the bloat. However, the <description> is NOT suppose to be used for any of this. It is only su...
Entity list - Archive of obsolete content
es a list of the entities supported by various versions of RSS. Note: There are 3 different versions of RSS 0.91. There is Netscape's RSS 0.91 (Revision 1) (N 0.91 R1), Netscape's RSS 0.91 Revision 3 (N 0.91 R3) and Userland's RSS 0.91 (U 0.91). Netscape's RSS 0.91 uses a DTD which defines 96 additional named entities. ...
Content - Archive of obsolete content
t out Getting Started A guided tutorial that will help you get started with the RSS Content Module. The RSS Content Module provides facilities to include content for an <item>. But doing this in more efficient ways. Documentation Selected Articles Why RSS Content Module is Popular - Including HTML Contents
Charles Iliya Krempeaux talks about the RSS Content Module, why it is popular among some, and how it is used to include HTML contents. References RSS Content Module Element List Examples none available at this time Community none available at this time Tools ...
Slash - Archive of obsolete content
Getting Started A guided tutorial that will help you get started with the RSS Slash Module. The RSS Slash Module is popular among Slash based blogs and blogs imitating the feel for Slashdot. Slash is the engine behind the famous Slashdot. Documentation Selected Articles UP TO 10 Why RSS Slash is Popular: Counting Your Comments
Charles Iliya Krempeaux talks about the RSS Slash Module, why it is popular among some, and how it is used to give a count for your comments (2005-08-22). References RSS Slash Module Element List Examples none available at this time Community none available at this time Tools none available at this time Other Resource...
Well-Formed Web - Archive of obsolete content
arted A guided tutorial that will help you get started with the Well-Formed Web RSS Module. The Well-Formed Web RSS Module provides facilities for <item> level commenting: for linking to comments contained in an external RSS Feed, and for posting new comments. Documentation Selected Articles Why Well-Formed Web RSS Module is Popular - Syndicating Your Comments
Charles Iliya Krempeaux talks about the RSS Well-Formed Web Module, why it is popular among some, and how it is used to link to your comments (2005-08-22). References RSS Well-Formed Web Module Element List Examples none available at this time Community none available at this time Tools none available at this ti...
RSS - Archive of obsolete content
syndication. RSS has a sordid history and a multitude of different incompatible RSS versions. (Some being based on RDF, but most only being based on XML.) Nonetheless, RSS is an extremely popular format that is used for syndicating news, blog posts, IPradio, and IPTV, with an amazing amount of momentum. Documentation Why RSS Slash is Popular - Counting Your Comments
Charles Iliya Krempeaux talks about the RSS Slash Module, why it is popular among some, and how it is used to give a count for your comments. Why Well-Formed Web RSS Module is Popular - Syndicating Your Comments
Charles Iliya Krempeaux talks about the RSS Well-Formed Web Module, why it is popular among some, and how it is used to link to your comments. Atomic RSS Tim Bray talks abo...
title - Archive of obsolete content
RSSTitle Element <title>...</title> - The RSS Title element has 4 uses. It is used to specify thetitle of a <channel>, an <image>, an <item>, or a <textinput>. The RSStitle element contain onlyplain text data. NOTE: in Userland's RSS 0.91 there is a 100
character maximum limit. Netscape RSS 0.91 Revision 3 Example <?xml version="1.0"?> <!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91"> <channel> <title>Advogato</title> <link>http://www.advogato.org/article/</link> <description>Recent Advogato articles</description> <language>en-us</language> <image> <link>http://www.advogato.org/</link> <title>Advogato</title> ...
SAX - Archive of obsolete content
'" + attributes.getValue(i) + "'"); } print("startElement: namespace='" + uri + "', localName='" + localName + "', qName='" + qName + "', attributes={" + attrs.join(",") + "}"); }, endElement: function(uri, localName, qName) { print("endElement: namespace='" + uri + "', localName='" + localName + "', qName='" + qName + "'"); },
characters: function(value) { print("
characters: " + value); }, processingInstruction: function(target, data) { print("processingInstruction: target='" + target + "', data='" + data + "'"); }, ignorableWhitespace: function(whitespace) { // don't care }, startPrefixMapping: function(prefix, uri) { // don't care }, endPrefixMapping: function(prefix) { //...
Digital Signatures - Archive of obsolete content
of this document. But encryption and decryption, by themselves, do not address another problem: tampering. This section describes how public-key cryptography addresses the problem of tampering. Tamper detection and related authentication techniques rely on a mathematical function called a one-way hash (also called a message digest). A one-way hash is a number of fixed length with the following
characteristics: The value of the hash is unique for the hashed data. Any change in the data, even deleting or altering a single
character, results in a different value. The content of the hashed data cannot, for all practical purposes, be deduced from the hash-which is why it is called "one-way." Similarly, in public key encryption, a key pair is generated for digital signing. The key pair cons...
-ms-accelerator - Archive of obsolete content
or: true">N</u>ame: </label> <input type="text" id="oName" size="25" accesskey="N" value="Your name here" /> </body> </html> Specifications Not part of any specification. Remarks This property is supported by Windows 2000 and later. It enables users to hide navigation indicators for menu items and controls until the Alt key is pressed. An access key is a single
character used as a keyboard shortcut for selecting an object. The user presses the Alt key and holds it while pressing the
character to move input focus to the object, and to invoke the default event associated with the object. In Internet Explorer 8 (IE8) the -ms-accelerator attribute is an extension to CSS, and can be used as a synonym for accelerator in IE8 Standards mode. ...
CSS - Archive of obsolete content
-ms-flow-into CSS property is a Microsoft extension that gets or sets a value identifying an iframe container in the document that serves as the region's data source.-ms-high-contrast-adjustThe -ms-high-contrast-adjust CSS property is a Microsoft extension that gets or sets a value indicating whether to override any CSS properties that would have been set in high contrast mode.-ms-hyphenate-limit-
charsThe -ms-hyphenate-limit-
chars CSS property is a Microsoft extension that specifies one to three values indicating the minimum number of
characters in a hyphenated word. If the word does not meet the required minimum number of
characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated.-ms-hyphenate-limit-linesThe -ms-hyphenate-limit-lines CSS property is a Micr...
ActiveXObject - Archive of obsolete content
least one type of object. For example, a word-processing application may provide an application object, a document object, and a toolbar object. You may be able to identify servername.typename values on a host PC in the HKEY_CLASSES_ROOT registry key. For example, here are a few examples of values you may find there, depending on which programs are installed: Excel.Application Excel.
Chart Scripting.FileSystemObject WScript.Shell Word.Document Important: ActiveX objects may present security issues. To use the ActiveXObject, you may need to adjust security settings in Internet Explorer for the relevant security zone. For example, for the local intranet zone, you typically need to change a custom setting to "Initialize and script ActiveX controls not marked as...
Debug.write - Archive of obsolete content
str2, ... , strN Optional Strings to send to the script debugger. Remarks The Debug.write function sends strings to the Immediate window of a script debugger at run time. If the script is not being debugged, the Debug.write function has no effect. The Debug.write function is almost identical to the Debug.writeln function. The only difference is that the Debug.writeln function sends a newline
character after the strings are sent. Example This example uses the Debug.write function to display the value of the variable in the Immediate window of the script debugger. Note: To run this example, you must have a script debugger installed and the script must run in debug mode. Internet Explorer 8 includes the JavaScript debugger. If you are using an earlier version of Internet Explorer, see H...
Debug.writeln - Archive of obsolete content
The debug.writeln function sends strings to the script debugger, followed by a newline
character. Syntax Debug.writeln([str1 [, str2 [, ... [, strN]]]]) Parameters str1, str2, ... , strN Optional Strings to send to the script debugger. Remarks The Debug.writeln function sends strings, followed by a newline
character, to the Immediate window of the Microsoft Script Debugger at run time. If the script is not being debugged, the Debug.writeln function has no effect. The Debug.writeln function is almost identical to the Debug.write function. The only difference is that the Debug.write function does not send a newline
character after sending the strings. Example This example uses the Debug.writeln function to display the value of the variable in the Immediate window of the Mic...
Debug - Archive of obsolete content
asynchronous operation has completed. Debug.msTraceAsyncOperationStarting Initiates a trace for an asynchronous operation. Debug.msUpdateAsyncCallbackRelation Updates the relationship status between a synchronous work item and the associated asynchronous operation. Debug.write Sends strings to the script debugger. Debug.writeln Sends strings to the script debugger, followed by a newline
character. Examples Print the value of a variable This example uses the write function to display the value of the variable. var counter = 42; Debug.write("The value of counter is " + counter); Requirements Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explor...
@set - Archive of obsolete content
compilation is not supported in Internet Explorer 11 Standards mode and Windows 8.x Store apps. Conditional compilation is supported in Internet Explorer 10 Standards mode and in all earlier versions. The @set statement creates variables used with conditional compilation statements. Syntax @set @varname = term Parameters varname Valid JavaScript variable name. Must be preceded by an "@"
character at all times. term Zero or more unary operators followed by a constant, conditional compilation variable, or parenthesized expression. Remarks Numeric and Boolean variables are supported for conditional compilation. Strings are not. Variables created using @set are generally used in conditional compilation statements, but can be used anywhere in JavaScript code. Examples of variable de...
New in JavaScript 1.1 - Archive of obsolete content
(was previously a built-in function); it evaluates a string of JavaScript code in the context of the specified object. Math.random() now works on every platform. toString(): Added radix parameter, which specifies the base to use for representing numeric values. isNaN() now works on every platform (not only Unix anymore) parseFloat() and parseint() now return NaN on all platforms, if the first
character of the specified string cannot be converted to a number; in previous releases, it returned NaN on Solaris and Irix and zero on all other platforms. ...
String.prototype.quote() - Archive of obsolete content
Obsolete since Gecko 37 (Firefox 37 / Thunderbird 37 / SeaMonkey 2.34)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 non-standard quote() method returns a copy of the string, replacing various special
characters in the string with their escape sequences and wrapping the result in double-quotes ("). Syntax str.quote() Return value A new string representing the original string wrapped in double-quotes, with any special
characters escaped. Examples Using quote In the table below the quote() method replaces any special
characters and wraps the strings in double-quotes. Also note the third column where a wrapped eval() evaluates the escape sequences again. str...
Archived JavaScript Reference - Archive of obsolete content
om Browsers. You can use the more general Proxy object instead.Reflect.enumerate()The static Reflect.enumerate() method used to return an iterator with the enumerable own and inherited properties of the target object, but has been removed in ECMAScript 2016 and is deprecated in browsers.String.prototype.quote()The non-standard quote() method returns a copy of the string, replacing various special
characters in the string with their escape sequences and wrapping the result in double-quotes ("). ...
Troubleshooting XForms Forms - Archive of obsolete content
ocal machine using Apache Tomcat for example then add the following regular expression on a new line: ^http://localhost:8080/.* Use the XForms Buddy to view instance data The XForms Buddy extension allows you to dynamically view model instance data while the XForms is running in the FireFox browser. The home page for XFroms Buddy is located at: XForms Buddy Using HTTP Proxy You can use the
Charles FireFox extension to view your HTTP session data including HTTP header data. If All Else Fails Ask The Community Ask on one of the mailing lists or on IRC. See the Community section on the XForms main page. Check For Known Bugs / Missing Features You can check the known bugs/missing features we have in the release notes of the extension. You can also see the current list of open XForms...
XForms Label Element - Archive of obsolete content
ecified for this element, the order of precedence is: single node binding attributes, linking attributes, inline text. UI behavior accesskey support - if the accesskey attribute is specified on labeled XForms controls or on the label element itself then the label text for the control will contain an indicator as to what the access key is in a standard way. Usually by underlining the accesskey
character in the label text. focus behavior - when a label element is clicked or its accesskey is activated then the form control that contains the label will be given the focus. Attributes UI Common accesskey - used to specify the keyboard shortcut for focusing the parent form control. Single-Node Binding Linking src - URL of a document whose contents will be retrieved by the label element ...
XForms Range Element - Archive of obsolete content
t 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. ...
XForms Submit Element - Archive of obsolete content
ct on a submit. If the bound node is irrelevant, then the submit will be hidden. Representations The XForms submit element can be represented by the following widgets for the specified appearance attribute values: button - default representation (xhtml/xul) link/clickable text - used when appearance = 'minimal' (xhtml only) button Displaying a button is the default presentation (xhtml/xul).
Characteristics analogous widgets are <html:input type="submit"/> and <xul:button/> link/clickable text XForms authors can use this representation if they want to have a widget like a XHTML anchor (xhtml only).
Characteristics appearance attribute contains the value minimal analogue widget is <html:a onClick="form.submit();"/>. ...
XForms Textarea Element - Archive of obsolete content
- used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special inputmode - isn't supported. incremental - supported. The default value is false. Type restrictions The textarea element can be bound to a node of type xsd:string or any type derived from it. Representations The XForms textarea element is represented by a multiline text field (xhtml/xul).
Characteristics analogous widgets are <xhtml:textarea/> and <xul:textbox multiline="true"/> if the incremental attribute has the value true, then the bound instance node is updated on every user input. ...
XForms Trigger Element - Archive of obsolete content
trigger. If the bound node is irrelevant, then the trigger will be hidden. Representations The XForms trigger element can be represented by the following widgets for the specified appearance attribute values: button - default representation (xhtml/xul) link/clickable text - used when appearance = 'minimal' (xhtml only) button Displaying a button is the default presentation (xhtml/xul).
Characteristics analogous widgets are <html:input type="button"/> and <xul:button/> link/clickable text XForms authors can use this representation if they want to have a widget like a XHTML anchor (xhtml only).
Characteristics appearance attribute contains the value minimal analogue widget is <xhtml:a/>. ...
Mozilla XForms User Interface - Archive of obsolete content
o a combobox. Consists of a text field for direct input and a dropdown calendar that can also be used to input the date value. calendar - used for date data types when appearance = 'full'. days list - used when the data has a data type of day. months list - used when the data has a data type of month. number field - used for numerical data types. secret Used for inputting passwords. Each
character typed by the user is represented by an asterisk on the screen (see the spec). textarea Serves to show/change multiline text (see the spec). output Serves to show the instance data that the element is bound to in a read-only manner (see the spec). It can have the following presentations: text - default representation for data of most types, especially static text. calendar - used for dat...
Using XForms and PHP - Archive of obsolete content
Introduction A few tips on using XForms and PHP together. Returning XML data To either serve a page (with XForms in it) or to generate data used as instance data for XForms, the page needs to be served as XML, for example application/xhtml+xml. To do that, you need to use the header() PHP function: <?php header("Content-Type: application/xhtml+xml;
charset=UTF-8"); ... ?> But remember this (quote from PHP documentation): Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
alue nav are applied to hyperlinks, this will work fine. However, rules of this type are usually seen in conjunction with markup like this: <td class="nav"> <a href="one.html" class="nav">one</a> | <a href="two.html" class="nav">two</a> | <a href="thr.html" class="nav">three</a> | <a href="fou.html" class="nav">four</a> </td> Because the enclosing table cell has a class of nav, the vertical-bar
characters will turn red when the user moves the mouse pointer anywhere within the table cell. The links will also turn red when they are hovered. Gecko Behavior In browsers based on Netscape Gecko builds later than 20020410 (Netscape 6.1+), :hover styles can be applied to any element in a document. Thus authors who have used bare pseudo-classes, or bare class-pseudo-class combinations, are at risk ...
The Business Benefits of Web Standards - Archive of obsolete content
an easier goal to achieve, as standards have been created with accessibility in mind. Taking care of accessibility means being able to serve web content to a larger audience, increasing web site usability, even for non-disabled people. Comporting with the relevant legislation in the jurisdiction is an important driver particularly for developers who wish to access public funds, or who work with
charities and other socially responsible organisations. Just as important as the obvious necessity to comply with the law; an enthusiastic adoption of web standards is an important indicator of a sense of Community Social Responsibility. Many industry leaders are applying this thinking to everything they do. Sites which satisfy the ego of the designer - and very few other people are going to have an i...
Using the DOM File API in chrome code - Extensions
e To reference a file by its path, you can simply use a string literal: var file = File.createFromFileName("path/to/some/file"); Cross platform note: However using hard-coded paths raises cross platform issues since it uses a platform-dependent path separator (here "/"). In the XUL/Mozilla platform there isn't sadly an equivalent to Java File.pathSeparator (the system-dependent path-separator
character). So the good practice is to avoid trying to determine and to use the path separator at all. Instead, use the nsIFile::append() method as explained in the next section. Accessing files in a special directory You can also use the directory service to obtain and build the path to a file to access. For example, let's say your add-on needs to access a file in the user's profile. You can do so ...
Examples - Game development
Firestorm Rainbow-coloured particles, falling like rain, bouncing around on a terrain of orbs. Crowd Simulation Simulation of a bustling crowd of people all trying to reach their opposite positions. SVG Masking Experiment An Xray machine, creating using an SVG mask. Realistic Water Simulation Flowing water, like the waves on the ocean. Dungeon demo Haxor-based dungeon scene with walkable
character. Massive Assault tech demo Rendered archipelago with futuristic military vehicles. Flight Stream 3D globe with simulated flight paths. WebGL filters Demo showing WebGL filters being used to add effects to HTML elements. SVG isometic tiles Generating isometric tiles with SVG matricies. ThreeJS App Player A player into which you can load and run Three.js examples. ...
Introduction to game development for the Web - Game development
to promoting your app on someone else's app store. Instead, you can advertise and promote your game all over the Web as well as other media, taking advantage of the Web's inherent linkability and shareability to reach new customers. You have control where it matters: Payments. You don't have to hand over 30% of your revenues to someone else just because your game is in their ecosystem. Instead,
charge what you want and use whatever payment processing service you like. Again with more control, you can update your game whenever you want. No waiting breathlessly for approval while someone hidden within another company decides whether or not your critical bug fix will ship today or tomorrow. Control your analytics! Instead of relying on someone else to make all the decisions about what analyti...
Bounding volume collision detection with THREE.js - Game development
nt mathematical volumes and shapes -- for 3D AABB and bounding spheres we can use the Box3 and Sphere objects. Once instantiated, they have methods available to do intersection tests against other volumes. Instantiating boxes To create a Box3 instance, we need to provide the lower and upper boundaries of the box. Usually we will want this AABB to be "linked" to an object in our 3D world (like a
character.) In Three.js, Geometry instances have a boundingBox property with min and max boundaries for the object. Keep in mind that in order for this property to be defined, you need to manually call Geometry.computeBoundingBox beforehand. var knot = new THREE.Mesh( new THREE.TorusKnotGeometry(0.5, 0.1), new MeshNormalMaterial({})); knot.geometry.computeBoundingBox(); var knotBBox = new Box3( ...
Type - MDN Web Docs Glossary: Definitions of Web-related terms
A value's data type also affects the operations that are valid on that value. For example, a value of type number can be multiplied by another number, but not by a string - even if that string contains only a number, such as the string "2". Types also provides us with useful knowledge about the comparison between different values. ...
UTF-8 - MDN Web Docs Glossary: Definitions of Web-related terms
UTF-8 (UCS Transformation Format 8) is the World Wide Web's most common
character encoding. Each
character is represented by one to four bytes. UTF-8 is backward-compatible with ASCII and can represent any standard Unicode
character. The first 128 UTF-8
characters precisely match the first 128 ASCII
characters (numbered 0-127), meaning that existing ASCII text is already valid UTF-8. All other
characters use two to four bytes. Each byte has some bits reserved for encoding purposes. Since non-ASCII
characters require more than one byte for storage, they run the risk of being corrupted if the bytes are separated and not recombined. Learn more General knowledge UTF-8 on Wikipedia FAQ about UTF-8 on Unicode website ...
VoIP - MDN Web Docs Glossary: Definitions of Web-related terms
through VoIP is digital. It is also known as IP telephony, or broadband telephony. The main reason for using VoIP technology is because of cost. VoIP allows you to make a call directly from a computer, a special VoIP phone, or a traditional phone connected to a special adapter. A high speed internet connection is required for VoIP. Usually, telephone calls over the Internet do not incur further
charges beyond what the user is paying for Internet access, much in the same way that the user doesn't pay for sending individual emails over the Internet. Learn more General knowledge VoIP on Wikipedia ...
Web standards - MDN Web Docs Glossary: Definitions of Web-related terms
vern set-up and use of URIs, HTTP, and MIME W3C: specifications for markup language (e.g., HTML), style definitions (i.e., CSS), DOM, accessibility IANA (Internet Assigned Numbers Authority): name and number registries Ecma Intl.: scripting standards, most prominently for JavaScript ISO (International Organization for Standardization): standards governing a diverse array of aspects, including
character encodings, website management, and user-interface design Learn more General knowledge Web standards on Wikipedia ...
Property (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
A CSS property is a
characteristic (like color) whose associated value defines one aspect of how the browser should display the element. Here's an example of a CSS rule: /* "div" is a selector indicating that all the div elements */ /* in the document will be styled by that rule */ div { /* The property "color" with the value "black" indicates */ /* that the text will have the color black */ color: black; /* The property "background-color" with the value "white" indicates */ /* that the background color of the elements will be white */ background-color: white; } Learn more General knowledge Learn CSS Technical reference The CSS reference on MDN The CSS Working Group current work ...
Property (JavaScript) - MDN Web Docs Glossary: Definitions of Web-related terms
There are two kinds of properties: Instance properties hold data that are specific to a given object instance. Static properties hold data that are shared among all object instances. A property has a name (a string) and a value (primitive, method, or object reference). Note that when we say that "a property holds an object", that is shorthand for "a property holds an object reference". This distinction matters because the original referenced object remains unchanged when you change the property's value. ...
Property - MDN Web Docs Glossary: Definitions of Web-related terms
The term property can have several meanings depending on the context. It may refer to: Property (CSS) A CSS property is a
characteristic (like color) whose associated value defines one aspect of how the browser should display the element. Property (JavaScript) A JavaScript property is a
characteristic of an object, often describing attributes associated with a data structure. ...
Accessible multimedia - Learn web development
to provide audio descriptions of some kind to describe that extra content. In many cases this will simply take the form of video, in which case you can implement captions using the techniques described in the next section of the article. However, there are some edge cases. You might for example have an audio recording of a meeting that refers to an accompanying resource such as a spreadsheet or
chart. In such cases, you should make sure that the resources are provided along with the audio + transcript, and specifically link to them in the places where they are referred to in the transcript. This of course will help all users, not just people who are deaf. Note: An audio transcript will in general help multiple user groups. As well as giving deaf users access to the information contained in...
What is accessibility? - Learn web development
content accessible. Having all your multimedia content transcribed is one option which, while expensive, is possible. Also, be realistic. "100% accessibility" is an unobtainable ideal -- you will always come across some kind of edge case that results in a certain user finding certain content difficult to use -- but you should do as much as you can. If you are planning to include a whizzy 3D pie
chart graphic made using WebGL, you might want to include a data table as an accessible alternative representation of the data. Or, you might want to just include the table and get rid of the 3D pie
chart -- the table is accessible by everyone, quicker to code, less CPU-intensive, and easier to maintain. On the other hand, if you are working on a gallery website showing interesting 3D art, it would b...
Backgrounds and borders - Learn web development
ave a gradient with a size and position, then an image background with no-repeat and a position, then a color. There are a few rules that need to be followed when writing background image shorthand values, for example: A background-color may only be specified after the final comma. The value of background-size may only be included immediately after background-position, separated with the '/'
character, like this: center/80%. Take a look at the MDN page for background to see all of the considerations. Accessibility considerations with backgrounds When placing text on top of a background image or color, you should take care that you have enough contrast for the text to be legible for your visitors. If specifying an image, and text will be placed on top of that image, you should also s...
Attribute selectors - Learn web development
li[class$="a"] matches any attribute value that ends with a, so matches the first and third list item. li[class*="a"] matches any attribute value where a appears anywhere in the string, so it matches all of our list items. Case-sensitivity If you want to match attribute values case-insensitively you can use the value i before the closing bracket. This flag tells the browser to match ASCII
characters case-insensitively. Without the flag the values will be matched according to the case-sensitivity of the document language -- in HTML's case it will be case sensitive. In the example below, the first selector will match a value that begins with a -- it only matches the first list item because the other two list items start with an uppercase A. The second selector uses the case-insensitive ...
Combinators - Learn web development
quisites: Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn about the different combinator selectors that can be used in CSS. Descendant combinator The descendant combinator -- typically represented by a single space ( )
character -- combines two selectors such that elements matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors. body article p In the example below, we are matching only the <p> element which is inside an element wi...
The box model - Learn web development
basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn about the CSS Box Model, what makes up the box model and how to switch to the alternate model. Block and inline boxes In CSS we broadly have two types of boxes -- block boxes and inline boxes. These
characteristics refer to how the box behaves in terms of page flow, and in relation to other boxes on the page: If a box is defined as a block, it will behave in the following ways: The box will break onto a new line. The box will extend in the inline direction to fill the space available in its container. In most cases this means that the box will become as wide as its container, filling up 100%...
Grids - Learn web development
ings according to these lines by specifying the start and end line. We do this using the following properties: grid-column-start grid-column-end grid-row-start grid-row-end These properties can all have a line number as the value. You can also use the shorthand properties: grid-column grid-row These let you specify the start and end lines at once, separated by a / -- a forward slash
character. Download this file as a starting point or see it live here. It has a grid defined already, and a simple article outlined. You can see that auto-placement is placing items one into each cell of the grid that we have created. We will instead place all of the elements for our site on the grid, using the grid lines. Add the following rules to the bottom of your CSS: header { grid-column: 1...
Normal Flow - Learn web development
as tall as its content. Inline elements are as tall as their content, and as wide as their content. You can't set width or height on inline elements -- they just sit inside the content of block level elements. If you want to control the size of an inline element in this manner, you need to set it to behave like a block level element with display: block; (or even,display: inline-block; which mixes
characteristics from both.) That explains individual elements, but what about how elements interact with one another? The normal layout flow (mentioned in the layout introduction article) is the system by which elements are placed inside the browser's viewport. By default, block-level elements are laid out in the block flow direction, based on the parent's writing mode (initial: horizontal-tb) -- eac...
Practical positioning examples - Learn web development
... </aside> To start with here we've got a <label> element and an <input> element -- <label> elements are normally used to associate a text label with a form element for accessibility purposes (allowing a screen user to see what description goes with what form element). Here it is associated with the <input> checkbox using the for and id attributes. Note: We've put a special question mark
character into our HTML to act as our info icon -- this represents the button that will be pressed to show/hide the panel. Here we are going to use these elements for a slightly different purpose -- another useful side effect of <label> elements is that you can click a checkbox's label to check the checkbox, as well as just the checkbox itself. This has led to the well-known checkbox hack, which pro...
What is CSS? - Learn web development
ers to implement a feature at the same time, and so there is usually a gap where you can use some part of CSS in some browsers and not in others. For this reason, being able to check implementation status is useful. On each property page on MDN you can see the status of the property you are interested in, so you can tell if you will be able to use it on a website. What follows is the compat data
chart for the CSS font-family property. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetfont-familyChrome Full support 1Edge Full support 12Firefox Full support ...
How much does it cost to do something on the Web? - Learn web development
and, you'll need a high-bandwidth connection, such as DSL, cable, or fiber access, if you want a more advanced website with hundreds of files, or if you want to deliver heavy video/audio files directly from your web server. It could cost the same as low-bandwidth access, upwards to several hundred dollars per month for more professional needs. Hosting Understanding bandwidth Hosting providers
charge you according to how much bandwidth your website consumes. This depends on how many people, and Web crawling robots, access your content during a given time, and how much server space your content takes up. This is why people usually store their videos on dedicated services such as Youtube, Dailymotion, and Vimeo. For example, your provider may have a plan that includes up to several thousand v...
Basic native form controls - Learn web development
e but it is still sent with the rest of the form data) or disabled (the input value can't be modified and is never sent with the rest of the form data). They can have a placeholder; this is text that appears inside the text input box that should be used to briefly describe the purpose of the box. They can be constrained in size (the physical size of the box) and maxlength (the maximum number of
characters that can be entered into the box). They can benefit from spell checking (using the spellcheck attribute), if the browser supports it. Note: The <input> element is unique amongst HTML elements because it can take many different forms depending on its type attribute value. It is used for creating most types of form widgets including single line text fields, time and date controls, control...
HTML forms in legacy browsers - Learn web development
to not style HTML Form widgets at all. But you can still apply styles to all the surrounding items. And, if you must alter the default styles of your form widgets, define a style guide to ensure consistency among all your form controls so user experience is not destroyed. You can also investigate some hard techniques such as rebuilding widgets with JavaScript. But in that case, do not hesitate to
charge your client for such foolishness. Feature detection and polyfills CSS and JavaScript are awesome technologies, but it's important to ensure you don't break legacy browsers. Before using features that aren't fully supported in the browsers your targeting, you should feature detect: CSS feature detection Before styling a replaced form control widget, you can check to see if the browser suppor...
Other form controls - Learn web development
me 79 on Windows 10. Note: You can find a slightly more interesting example of text area usage in the example we put together in the first article of the series (see the source code also). Controlling multi-line rendering <textarea> accepts three attributes to control its rendering across several lines: cols Specifies the visible width (columns) of the text control, measured in average
character widths. This is effectively the starting width, as it can be changed by resizing the <textarea>, and overriden using CSS. The default value if none is specified is 20. rows Specifies the number of visible text rows for the control. This is effectively the starting height, as it can be changed by resizing the <textarea>, and overriden using CSS. The default value if none is specified is 2. ...
Sending forms through JavaScript - Learn web development
nst XHR = new XMLHttpRequest(); let urlEncodedData = "", urlEncodedDataPairs = [], name; // Turn the data object into an array of URL-encoded key/value pairs. for( name in data ) { urlEncodedDataPairs.push( encodeURIComponent( name ) + '=' + encodeURIComponent( data[name] ) ); } // Combine the pairs into a single string and replace all %-encoded spaces to // the '+'
character; matches the behaviour of browser form submissions. urlEncodedData = urlEncodedDataPairs.join( '&' ).replace( /%20/g, '+' ); // Define what happens on successful data submission XHR.addEventListener( 'load', function(event) { alert( 'Yeah! Data sent and response loaded.' ); } ); // Define what happens in case of error XHR.addEventListener( 'error', function(event) { ale...
Test your skills: Basic controls - Learn web development
the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Basic controls 2 The next task requires you to create working sets of checkboxes and radio buttons, from the provided text labels. Turn the first <fieldset>'s contents into a set of radio buttons -- you should only be able to select one pony
character at once. Make it so that the first radio button is selected upon page load. Turn the second <fieldset>'s content into a set of checkboxes. Add a couple more hotdog choices of your own. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Basic controls 3 The final task in th...
JavaScript basics - Learn web development
h an event handler to an element. Here we select the <html> element, setting its onclick handler property equal to an anonymous (i.e. nameless) function, which contains the code we want the click event to run. Note that document.querySelector('html').onclick = function() {}; is equivalent to let myHTML = document.querySelector('html'); myHTML.onclick = function() {}; It's just shorter. Super
charging our example website With this review of JavaScript basics completed (above), let's add some new features to our example site. Adding an image changer In this section, you will learn how to use JavaScript and DOM API features to alternate the display of one of two images. This change will happen as a user clicks the displayed image. Choose an image you want to feature on your example sit...
What will your website look like? - Learn web development
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 strange 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..., and choos...
Using data attributes - Learn web development
support dataset. To support IE 10 and under you need to access data attributes with getAttribute() instead. Also, the performance of reading data-attributes compared to storing this data in a regular JS object is poor. That said, though, for custom element-associated metadata, they are a great solution. In Firefox 49.0.2 (and perhaps earlier/later versions), the data attributes that exceed 1022
characters will not be read by Javascript (EcmaScript 4). ...
Creating hyperlinks - Learn web development
and its value is specified as a query term. Here's an example that includes a cc, bcc, subject and body: <a href="mailto:nowhere@mozilla.org?cc=name2@rapidtables.com&bcc=name3@rapidtables.com&subject=The%20subject%20of%20the%20email&body=The%20body%20of%20the%20email"> Send mail with cc, bcc, subject and body </a> Note: The values of each field must be URL-encoded, that is with non-printing
characters (invisible
characters like tabs, carriage returns, and page breaks) and spaces percent-escaped. Also note the use of the question mark (?) to separate the main URL from the field values, and ampersands (&) to separate each field in the mailto: URL. This is standard URL query notation. Read The GET method to understand what URL query notation is more commonly used for. Here are a few other...
Document and website structure - Learn web development
; often placed inside <main>. footer: <footer>. Active learning: exploring the code for our example Our example seen above is represented by the following code (you can also find the example in our GitHub repository). We'd like you to look at the example above, and then look over the listing below to see what parts make up what section of the visual. ...
Marking up a letter - Learn web development
espectively). Try to mark up at least two appropriate words in the text with strong importance/emphasis. There are two places where the letter should have a hyperlink. Add appropriate links with titles. For the location that the links point to, you may use http://example.com as the URL. Mark up the university motto quote and citation with appropriate elements. The head of the document The
character set of the document should be set as utf-8 using the appropriate meta tag. The author of the letter should be specified in an appropriate meta tag. The provided CSS should be included inside an appropriate tag. Hints and tips Use the W3C HTML validator to validate your HTML. Award yourself bonus points if it validates. You don't need to know any CSS to do this assignment. You just n...
Index - Learn web development
87 What is JavaScript? 3rd party, API, Article, Beginner, Browser, CodingScripting, Core, JavaScript, Learn, Script, comments, external, inline, l10n:priority, what So there you go, your first step into the world of JavaScript. We've begun with just theory, to start getting you used to why you'd use JavaScript and what kind of things yo...
Functions — reusable blocks of code - Learn web development
f you don't, the function will generally adopt some kind of default behavior. As an example, the array join() function's parameter is optional: let myArray = ['I', 'love', 'chocolate', 'frogs']; let madeAString = myArray.join(' '); // returns 'I love chocolate frogs' let madeAString = myArray.join(); // returns 'I,love,chocolate,frogs' If no parameter is included to specify a joining/delimiting
character, a comma is used by default. Function scope and conflicts Let's talk a bit about scope -- a very important concept when dealing with functions. When you create a function, the variables and other things defined inside the function are inside their own separate scope, meaning that they are locked away in their own separate compartments, unreachable from code outside the functions. The top ...
Manipulating documents - Learn web development
can manipulate the DOM with JavaScript after the page has been rendered. We have created a simple example page at dom-example.html (see it live also). Try opening this up in your browser -- it is a very simple page containing a <section> element inside which you can find an image, and a paragraph with a link inside. ...
A first splash into JavaScript - Learn web development
rtunity to practice thinking like a programmer throughout the course. With that in mind, let's look at the example we'll be building up in this article, and review the general process of dissecting it into tangible tasks. ...
Test your skills: Arrays - Learn web development
and assignment. Then add a new item to the beginning of the array. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Arrays 2 Now let's move on to another task. Here you are provided with a string to work with. We'd like you to: Convert the string into an array, removing the +
characters in the process. Save the result in a variable called myArray. Store the length of the array in a variable called arrayLength. Store the last item in the array in a variable called lastItem. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Arrays 3 For this final array ta...
Storing the information you need — Variables - Learn web development
). Updating a variable Once a variable has been initialized with a value, you can change (or update) that value by simply giving it a different value. Try entering the following lines into your console: myName = 'Bob'; myAge = 40; An aside on variable naming rules You can call a variable pretty much anything you like, but there are limitations. Generally, you should stick to just using Latin
characters (0-9, a-z, A-Z) and the underscore
character. You shouldn't use other
characters because they may cause errors or be hard to understand for an international audience. Don't use underscores at the start of variable names -- this is used in certain JavaScript constructs to mean specific things, so may get confusing. Don't use numbers at the start of variables. This isn't allowed and caus...
JavaScript First Steps - Learn web development
w about strings when learning JavaScript, such as creating strings, escaping quotes in string, and joining them together. Useful string methods Now we've looked at the very basics of strings, let's move up a gear and start thinking about what useful operations we can do on strings with built-in methods, such as finding the length of a text string, joining and splitting strings, substituting one
character in a string for another, and more. Arrays In the final article of this module, we'll look at arrays -- a neat way of storing a list of data items under a single variable name. Here we look at why this is useful, then explore how to create an array, retrieve, add, and remove items stored in an array, and more besides. Assessments The following assessment will test your understanding of t...
JavaScript performance - Learn web development
or home spun solutions? Some features may not be necessary, and though they may add some bling, is the cost of the feature in terms of performance worth it? Remove unused code Split the JavaScript into smaller files Code-split JavaScript into critical and non-critical parts. Module bundlers like webpack support code-splitting. Optimize these smaller files Minification reduces the number of
characters in your file, thereby reducing the number of bytes or weight of your JavaScript. Gzipping compresses the file further, and should be used even if you don't minify. Brotli is similar to Gzip, generally outperforming Gzip's compression. Render impact Web applications include a lot of JavaScript. Many applications are built with a JavaScrpit framework, or multiple, with several addit...
TypeScript support in Svelte - Learn web development
nerics; let's find out more. Understanding TypeScript generics Generics allow us to create reusable code components that work with a variety of types instead of a single type. They can be applied to interfaces, classes, and functions. Generic types are passed as parameters using a special syntax: they are specified between angle-brackets, and by convention are denoted with an upper-cased single
char letter. Generic types allows us to capture the types provided by the user to be used later. Let's see a quick example, a simple Stack class that let's us push and pop elements, like this: export class Stack { private elements = [] push = (element) => this.elements.push(element) pop() { if (this.elements.length === 0) throw new Error('The stack is empty!') return this.elements.po...
Getting started with Svelte - Learn web development
nt and compiles them into the public/build/bundle.css file. It also compiles the markup and <script> section of every component and stores the result in public/build/bundle.js. It also adds the code in src/main.js to reference the features of each component. ...
Dynamic behavior in Svelte: working with variables and props - Learn web development
me = '' } Note: For the moment we are just assigning the same id to every todo, but don't worry, we will fix that soon. Now we want to update our HTML so that we call addTodo() whenever the form is submitted. Update the NewTodo form's opening tag like so: <form on:submit|preventDefault={addTodo}> The on:eventname directive supports adding modifiers to the DOM event with the |
character. In this case, the preventDefault modifier tells Svelte to generate the code to call event.preventDefault() before running the handler. Explore the previous link to see what other modifiers are available. If you try adding new todos at this point, the new todos are added to the todos array but our UI is not updated. Remember that in Svelte reactivity is triggered with assignments. That...
Vue conditional rendering: editing existing todos - Learn web development
Now when you save and reload, you'll find that the problem is solved -- the checkbox state is now preserved when you switch between todo item templates. Understanding the tangle of events One of the most potentially confusing parts is the tangle of standard and custom events we've used to trigger all the interactivity in our app. To understand this better, it is a good idea to write out a flow
chart, description, or diagram of what events are emitted where, where they are being listened for, and what happens as a result of them firing. For example: App.vue <to-do-form> listens for: todo-added event emitted by the onSubmit() method inside the ToDoForm component when the form is submitted. Result: addToDo() method invoked to add new todo item to the ToDoItems array. <to-do-item> lis...
Handling common accessibility problems - Learn web development
Keyboard shortcut Description NVDA + Q Turn NVDA off again after you've started it. NVDA + up cursor Read the current line. NVDA + down cursor Start reading at the current position. Up cursor and down cursor, or Shift + Tab and Tab Move to previous/next item on page and read it. Left cursor and right cursor Move to previous/next
character in current item and read it. Shift + H and H Move to previous/next heading and read it. Shift + K and K Move to previous/next link and read it. Shift + D and D Move to previous/next document landmark (e.g. <nav>) and read it. Shift + 1-6 and 1-6 Move to previous/next heading (level 1-6) and read it. Shift + F and F Move to previous/...
Introduction to automated testing - Learn web development
g the following to the bottom of your gulpfile.js: gulp.task('watch', function(){ gulp.watch('src/*.html', ['html']); gulp.watch('src/*.css', ['css']); gulp.watch('src/*.js', ['js']); }); Now try entering the gulp watch command into your terminal. Gulp will now watch your directory, and run the appropriate tasks whenever you save a change to an HTML, CSS, or JavaScript file. Note: The *
character is a wildcard
character -- here we're saying "run these tasks when any files of these types are saved. You could also use wildcards in your main tasks, for example gulp.src('src/*.css') would grab all your CSS files and then run piped tasks on them. Note: One problem with our watch command above is that our CSSLint/Autoprefixer combination throws full-blown errors when a CSS error is enco...
Setting up your own test automation environment - Learn web development
chTo().alert(); alert.getText().then(function(text) { console.log('Alert text is \'' + text + '\''); }); alert.accept(); Next, let's try entering some text into one of the form elements. Add the following code and try running your test again: const input = driver.findElement(By.id('name')); input.sendKeys('Filling in my form'); You can submit key presses that can't be represented by normal
characters using properties of the webdriver.Key object. For example, above we used this construct to tab out of the form input before submitting it: driver.sleep(1000).then(function() { driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB); }); Waiting for something to complete There are times where you'll want to make WebDriver wait for something to complete before carrying on. For exam...
Accessibility Features in Firefox
scripts") to any web page to change its behavior. In much the same way that user CSS lets you take control of a web page's style, user scripts let you easily control any aspect of a web page's design or interaction. We expect enterprising script writers will eventually fix annoying accessibility issues in popular web pages, and (hopefully) share their tricks with everyone! Fire Vox extension by
Charles L. Chen is a screen reader extension built just for Firefox which can read MathML Community Contributions The real reason behind Firefox's success is the great community of volunteers and organizations that realize they have something to benefit from a browser open to utilizing their ideas and hard work. Contributions come in many forms. The Mozilla Firefox community welcomes bug reports, i...
Accessibility/LiveRegionDevGuide
t_oldText and IAccessibleText::get_newText are used to acquire the text and offsets. Filtering Events Text Changed Events Certain web page mutation events, such as adding to a list, trigger both an object changed and a text changed event. Both events should not be acted upon or double announcements would result. Instead, all text changed events should be examined for the presence of an embed
character. If one is present, the text changed event should be discarded because an object changed event will follow. Filtering User Actions This paragraph describes object properties and event naming schemes that are used to help an AT determine if an event is an actual live region event or is the result of user action. Filtering for Performance The most significant difference between AT-SPI a...
Software accessibility: Where are we today?
s of disabled users, because accessibility can be fully integrated into the core designs, rather than tacked onto as an afterthought. It also gives disabled programmers a chance to control their own destiny, by giving them the opportunity and the right to directly fix the innaccessible software themselves. Furthermore, any software solution that can enable equality should by all rights be free of
charge - an integral part of society's infrastructure. If no special hardware is required, why should a disabled person pay extra money to use the same software as everyone else? That said, there is still an important role for adaptive technology vendors in creating special services and hardware, or even proprietary software on platforms where that is appropriate. . The ideal situation would be for ad...
Choosing the right memory allocator
ion about how to allocate memory infallibly; that is, how to use memory allocators that will only return valid memory buffers, and never return null. Allocating strings in XPCOM code See "Callee-allocated Parameters" in the XPCOM Strings guide; use ToNewCString() or ToNewUnicode() to allocate strings that will be passed out. These methods convert ns*String to nsIMemory allocated, unowned [PRUni]
char* buffers. Do not use nsCRT::strdup for returning values from an XPCOM object, as that uses a different allocator. NSPR memory allocators You should only use the NSPR allocators within NSPR or the security code located in the /security/ subtree of the source code. Avoid using them elsewhere. PR_Alloc() (do not use, no users and only exists in /security/; use PR_Malloc() instead) PR_Malloc()...
Creating reftest-based unit tests
The second pair of files, spaces3.html and spaces4.html, confirms that two regular spaces do NOT produce the same visual construct as two non-breaking spaces. When we run them, we see: $ ./mach reftest path/to/reftest.txt 2>&1 | grep REFTEST REFTEST PASS: file:///Users/ray/mo/spaces1.html...
Debugging Frame Reflow
/NightlyDebug.app/Contents/MacOS" \ ./obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/firefox-bin > logfile.txt After loading your testcase, the log file will contain the promised information. ...
Eclipse CDT
e menubar, or use Ctrl-H and select the "C/C++" Search tab. To quickly find the definition of an enum, class, method, etc. use Ctrl-shift-t/Cmd-shift-t. To get a list of autocomplete options in an editor tab, start typing the name of an identifier and then type Ctrl-Space. Unfortunately, the autocomplete list cannot (currently) be configured to appear automatically as soon as you start typing a
character that might be the start of an identifier name. To see the callers of a method (and their callers, etc.), select the method and use the context menu to select "Open Call Hierarchy". Note that there are buttons to the right of the "Open Call Hierarchy" tab that open to switch between "Show Callers" and "Show Callees". To see the inheritance tree for a class, select its name in an editor wind...
Gecko Logging
red method to declare a log module. Multiple LazyLogModules with the same name can be declared, all will share the same backing LogModule. This makes it much simpler to share a log module across multiple translation units. LazyLogLodule provides a conversion operator to LogModule* and is suitable for passing into the logging macros detailed below. Note: Log module names can only contain specific
characters. The first
character must be a lowercase or uppercase ASCII
char, underscore, dash, or dot. Subsequent
characters may be any of those, or an ASCII digit. #include "mozilla/Logging.h" static mozilla::LazyLogModule sFooLog("foo"); Logging interface A basic interface is provided in the form of 2 macros and an enum class. Mozilla Logging Macros MOZ_LOG(module, level, message) ...
Listening to events on all tabs
lf should be queried for extended error information (e.g., for HTTP requests see nsIHttpChannel). onStatusChange Notification that the status of a request has changed. The status message is intended to be displayed to the user (e.g., in the status bar of the browser). void onStatusChange( nsIDOMXULElement aBrowser, nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUni
char *aMessage ); Parameters aBrowser The browser that fired the notification. aWebProgress The nsIWebProgress instance that fired the notification. aRequest The nsIRequest that has new status. aStatus This value is not an error code. Instead, it is a numeric value that indicates the current status of the request. This interface does not define the set of possible stat...
mach
ntral/python/mach/bash-completion.sh Frequently Asked Questions Why should I NOT use mach? A real FAQ for a change! Mach is not the best software ever. Say, if you run a rolling release Arch Linux Distro or derivate thereof ("Manjaro"), you have something less tedious: Octopi! Just install Thunderbird from sources out of the AUR repo! Many PKGBUILD options to choose from and most work like a
charm - while "mach" may not necessarily work like a
charm for everyone. Why even bother with a competing build system in Arch when Octopi does what you want and even has a GUI? Those makepkg scripts named PKGBUILD are (typically) simple bash scripts that are easy to maintain and modify. Python based mach tends to involve more complexity and potential for breakage. Another possible reason: mach gives...
Multiple Firefox profiles
fox --new-instance --ProfileManager. macOS Run the Terminal application, which is found in Applications/Utilities. Type or paste in the path to Firefox, followed by .app/Contents/MacOS/firefox. For example, if Firefox is installed in the recommended location, you would enter /Applications/Firefox.app/Contents/MacOS/firefox. If you have the path to your desired profile handy, enter a space
character, followed by -profile followed by another space
character, followed by the full path to the profile folder you wish to launch into. This will launch Firefox immediately. Otherwise, enter a space
character followed by --profilemanager. This will present the Profile Manager window in which you can make your selection. Hit return. Here is a complete example Terminal command from steps 2-3...
Roll your own browser: An embedding how-to
zation must be done to start up event queues and load some string bundles. All of this is somewhat generic and has been isolated into a static library that you can simply call on. If you build mozilla/embedding/base/, a static library (on windows) called baseembed_s.lib is built. Just link this library to your application. There are two functions that are needed: nsresult NS_InitEmbedding(const
char *aPath); nsresult NS_TermEmbedding(); Pretty self-explanatory. The aPath parameter will be passed to NS_InitXPCOM. NS_InitEmbedding() must be called from the main thread of your application, otherwise it won't work. Do you have any simple examples of embedding Mozilla? There are many examples of products already using Gecko for embedding. Here's a partial list. The sections marked 'Mozilla Ex...
Gecko
Gecko FAQ Frequently asked questions about Gecko. Gecko DOM reference Reference to the DOM. Gecko event reference Reference to events used within Gecko and Mozilla applications; for web-standard DOM events, see the DOM event reference. Introduction to Layout in Mozilla Tech Talk on layout. Embedding Mozilla Using Gecko in your own application.
Character sets supported by Gecko A list of the
character sets supported by Gecko. HTML parser threading Description of multithreading in the HTML parser. Gecko Home Page on MozillaWiki Home for the active developers. Roadmaps and more up-to-date resources. View All... Community View Mozilla forums: Mailing list Newsgroup RSS feed ...
How Mozilla determines MIME Types
Mozilla 1.6alpha. HTTP For HTTP URIs Mozilla usually gets a MIME type sent from the server, and uses it. Contrary to Internet Explorer's MIME type guessing, Mozilla will generally not sniff the type of the document. However, starting in Mozilla 1.7alpha, Mozilla does do content sniffing, like this: When the Content-Type sent by the server is one of (case-sensitively) text/plain text/plain;
charset=ISO-8859-1 text/plain;
charset=iso-8859-1 and the server did not send a Content-Encoding header, Mozilla will sniff the first block of data it gets and check for non-text bytes. Text bytes are 9-13, 27, and 31-255. When encountering a non-text byte, the helper app dialog will be shown, showing the MIME type corresponding to the extension of the file. Also, for images loaded via <img src>, ...
How to get a stacktrace with WinDbg
the top and an input box at the bottom. Before debugging can start, several commands must be entered into the one-line input box at the bottom of the Command window. Tip: All commands must be entered exactly as written, one line at a time, into the bottom of the Command box. Copying and pasting each line is the easiest method to avoid mistakes Some commands start with a period (.) or a pipe
character (|), which is required. (The keystroke for a pipe
character on US keyboards is SHIFT+\) Submit the log file on a bug or via the support site, even if nothing seems to happen during the debug process Start debugging Now that Firefox is opened in the debugger, you need to configure your WinDbg to download symbols from the Mozilla symbol server. To load the symbols, enter the three command...
Extending a Protocol
of instances of PEcho children and the parent. And the inverse is also true, as you will soon see: PEcho.idpl will need explicitly state that PWindowGlobal.ipdl is managing it. Includes: this is kinda like "#includes" in C++, except it's not a preprocessor directive. It just includes the defintion and makes it available to PWindowGlobal.ipdl. Constructs: by which we mean, PWindowGlobal is in
charge of contructing the parent/child relationship. Without this, we can't send messages. Anyway, let's put the above into practice by creating our custom protocol: PEcho.ipdl. Custom protocol - PEcho.ipdl This next part requires us to both specify the protocol and actually implement everything in C++. It's quite involved and, unfortunately, all steps need to be done before we can successfully...
IPDL Tutorial
e like public, protected, and private labels in C++. Parameters Message declarations allow any number of parameters. Parameters specify data that are sent with the message. Their values are serialized by the sender and deserialized by the receiver. IPDL supports built-in and custom primitive types, as well as unions and arrays. The built-in simple types include the C++ integer types (bool,
char, int, double) and XPCOM string types (nsString, nsCString). IPDL imports these automatically because they are common, and because the base IPC library knows how to serialize and deserialize these types. See ipc/ipdl/ipdl/builtin.py for the most up-to-date list of automatically imported types. Actors may be passed as parameters. The C++ signature will accept a PProtocolParent* on one side and con...
JavaScript-DOM Prototypes in Mozilla
e class constructor names and class prototype names. What's the difference? Class constructor names are names of real classes, and class prototype names are names of "classes" that are inherited by real classes, but are not real classes. A few examples of class constructor names would be HTMLImageElement, HTMLDocument, Element, NodeList, and two examples of class prototype names would be Node and
CharacterData. This registration is done with the nsScriptNameSpaceManager, which is in
charge of keeping track of what names are registered in the global namespace, and what kinds of names those names are (i.e. class constructor name, class prototype name). When a class constructor name is registered (nsGlobalNameStruct::eTypeClassConstructor), the nsScriptNameSpaceManager is given a DOM class info ...
Http.jsm
postData option. postData can be of 2 different types: a string or an array of parameters. When null/undefined is given, no post data will be attached. If a string is given the data will be appended to the request as is. In case an array of parameters is given, it will be treated as an array of key-value pairs. The elements of the array will be URL-encoded and "application/x-www-form-urlencoded;
charset=utf-8" will be enforced as the content type. Http.jsm only forces the content type if the post data is an Array, and it serializes it automatically. If the provided postdata is a string, the content type isn't touched. In this case, the content type may be set through the headers parameter. Additional XHR configuration It is possible to modify things manually on the XHR object after calling ...
Application Translation with Mercurial
de: Open an input shell, e.g. by pressing the Windows key and R on the keyboard or by calling the "Run..." command from the Windows "Start" button, and then typing cmd and pressing the Enter key. Launch the installed MozillaBuild toolset by launching it with its path, e.g. C:\Mozilla\Coding\Buildtools\MozillaBuild\start-shell-msvc2010.bat You can autocomplete the file path after typing a few
characters and then pressing the Tabulator key. If you launch the start-shell-l10n.bat, compiling features will be disabled. You can create translation patches, but creating language packs for the application, binary repacks of the application (changing the localization of the program), and compiling the application likely won't work. You are now in the Mozilla development environment which emulate...
Index
ahead to Mozilla's SVN repositories. 33 Uplifting a localization from Central to Aurora Guide, Localization, Mozilla Localizers who are working on l10n-central are responsible for getting their work onto the Aurora repository. 34 Web Localizability Internationalization, Localizability, Localization, Web Development Localizability (or l12y for short) is a
characteristic found in an application or content that enables localization. The following list contains links to pages that highlight steps that can be taken to make web content localizable. The documentation is divided into 4 parts: 35 Creating localizable web applications Internationalization, Localizability, Localization, Web Development An important step of developing a web ...
Mozilla Content Localized in Your Language
nglish. Reference material on other languages can be found here. Pluralization What is the appropriate form of expressing pluralization in your language? If yes, list all forms of plural forms and examples if there is more than one. Additional discussions can be found Here. Voice What is the appropriate form of expressing voice in your language? How should emphasis be made in your language?
Character styles How are bold, italics, underlines, etc. used to express certain concepts in your language? If these are not applicable styles, what are some of the corresponding ways to express, emphasis or highlight some of the texts. Address Format What is the format in your language? ex: most Asian countries start from big to small: [Country] [postal code][state/province][city][district][s...
Localizing XLIFF files for iOS
to help you to identify strings that need to be translated. Do not delete the <source> tag sets. <trans-unit id="Add to Bookmarks"> <source>Add to Bookmarks</source> <target>YOUR_TRANSLATION_HERE</target> </trans-unit> Provide translations of the strings in the <source> tag sets by placing their translations in the <target> tag sets beneath them. Keep in mind the following sets of
characters that need to remain untranslated: $(SOME_TEXT_HERE) is a variable format, %1$@ is another variable format. <note> tags contain localizer notes from developers and should not be translated. <trans-unit id="Add to Bookmarks"> <source>Add to Bookmarks</source> <target>Agregar a marcadores</target> <note>No comment provided by engineer.</note> </trans-unit> Sav...
Localizing extension descriptions
rt, as they were always used before Gecko 1.9. Localizing before Gecko 1.9 Before Gecko 1.9, add-on developers must go through a special process to define localized add-on descriptions for add-ons targeting toolkit-based apps (such as Firefox or Thunderbird). If you do not currently have them, create localized properties files. Make sure to use UTF-8 encoding (without BOM) to ensure foreign
characters display correctly. Add the following line to each of your localization properties files (where EXTENSION_ID matches your extension ID (<em:id> from install.rdf) and LOCALIZED_DESCRIPTION is the description of your extension that you want to appear in the given language): extensions.EXTENSION_ID.description=LOCALIZED_DESCRIPTION If you do not currently have one, create a default prefe...
Patching a Localization
d on the L10n Prerequisites wiki page. If you do not have these tools, take a few steps back, grab a cookie (because, let's face it, you deserve it for all of your work), and visit the L10n Prerequisites page. There you'll learn what tools you need, where to find them, and how to install them. Get the source First, you need to get the source for the localization in question using its two or three
character ISO language code. For our example, I'll use gl (Galician). Whenever you see gl in blue text, replace it with the locale code for your language. Next thing you need to know is which localization version you want to patch. All of our localizations work on the Aurora branch. The repository for this version is releases/l10n/mozilla-aurora. For more information about branches see L10n:Branches. ...
Localization technical reviews
iles will be reverted to en-US. Changes will be discussed in productization bugs filed for each locale. Search plugins Similar to the region.properties files, the list.txt file should be reverted to en-US and amended accordingly as the search plugin productization bugs are completed. For this initial review, all XML files should be removed. String lengths in pipnss.properties There are some
character limits in the security/manager/chrome/pipnss/pipnss.properties file that you should be aware of. It is best to look into each of these files to see if the localizer's strings might be too 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 k...
Localization formats
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 who downloaded Firefox during the Download Day campaign. ...
Web Localizability
The following list contains links to pages that highlight steps that can be taken to make web content localizable. The documentation is divided into 4 parts: How to create localizable content. How to choose the right localization format. How to create localizable web applications. How to set up the infrastructure for localization. Why localizability is important There are many reasons why you should start thinking about making your web app localizable as soon as possible. You will make localizer's life easier, for which they will be grateful. You will have quality content, localized and adapted to the needs of the local market. ...
gettext
he same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-09-28 16:18+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain;
charset=
CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" #. L10N: This is a block comment one line directly above the gettext function call. It will be extracted by xgettext. #: file.php:12 msgid "A simple string." msgstr "" #. L10N: This is an inline comment. It will be extracted by xgettext. #: file.php:14 msgctxt "Unique context string" msgid "...
Fonts for Mozilla's MathML engine
ts are generally delivered with TeX distributions such as TeX Live, but you might need to follow specific instructions so that your system is aware of the fonts. As a last resort, install the MathML fonts add-on. Advanced setup Arabic Mathematical Alphabetic Symbols Currently, very few fonts have appropriate glyphs for the Arabic Mathematical Alphabetic Symbols. If you are likely to need these
characters, we recommend to install the XITS or Amiri fonts. Installation without Administrator Privilege If you need to install fonts on a system without adminstrator privilege, the easiest option is to use math font the MathML-fonts add-on. Note that using the add-on is not optimal since it forces your Gecko browser to load a CSS stylesheet on each page you visit as well as Web math fonts on all p...
Mobile
Read about how to develop web sites that look good on mobile devices and take advantage of the new possibilities they offer. ...
Mozilla Port Blocking
Enabling Ports user_pref("network.security.ports.banned.override, "port1,port2"); Disabling Ports user_pref("network.security.ports.banned", "port3,port4"); Blocked Ports Ports blocked by default in Mozilla: Port Service 1 tcpmux 7 echo 9 discard 11 systat 13 daytime 15 netstat 17 qotd 19
chargen 20 ftp data 21 ftp control 22 ssh 23 telnet 25 smtp 37 time 42 name 43 nicname 53 domain 77 priv-rjs 79 finger 87 ttylink 95 supdup 101 hostriame 102 iso-tsap 103 gppitnp 104 acr-nema ...
Mozilla Web Services Security Model
soap SOAP requests without verification headers soapv SOAP requests with verification headers The from attribute The from attribute on the allow element says which calling sites the allow element applies to. If there is no from attribute then the allow element applies to all sites. The from attribute otherwise gives a URL to match, which may contain up to two asterisks (*) that match any
characters in the URL. The match is done against a URL from which the directory and file have been removed, so trying to match a specific page will cause the entire match to fail. (Is this correct?) web-scripts-access.xml Examples These examples are untested! Somebody should test them to make sure they do what is claimed. Allow all services on a site to be accessed from any Web page Note that this...
mozilla::CondVar
Wait() nsresult Wait( in PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT ); Wait on this CondVar until it is Notifyed. Notify() nsresult Notify(void); Notify one thread waiting on this CondVar. ...
mozilla::Mutex
Lock() Lock the mutex. Unlock() Unlock the mutex. AssertCurrentThreadOwns() Assert that the current thread has locked this mutex. Does not incur a runtime penalty in optimized builds. ...
Automated performance testing and sheriffing
We also generate some metrics as part of the build process (like installer size) that are interesting to track over time. Currently we aggregate this information in the Perfherder web application where performance sheriffs watch for significant regressions, filing bugs as appropriate. ...
BloatView
ld | 412 412| 1 1| 308 |PImageBridgeChild | 416 416| 1 1| The first line tells you the pid of the leaking process, along with the type of process. Here's how you interpret the columns. The first, numerical column is the index of the leaking class. Class - The name of the class in question (truncated to 20
characters). Bytes Per-Inst - The number of bytes returned if you were to write sizeof(Class). Note that this number does not reflect any memory held onto by the class, such as internal buffers, etc. (E.g. for nsString you'll see the size of the header struct, not the size of the string contents!) Bytes Leaked - The number of bytes per instance times the number of objects leaked: (Bytes Per-Inst) x ...
Investigating leaks using DMD heap scan mode
LOAT_LOG=1 MOZ_CC_LOG_SHUTDOWN=1 MOZ_DISABLE_CONTENT_SANDBOX=t MOZ_CC_LOG_DIRECTORY=$logdir MOZ_CC_LOG_PROCESS=content MOZ_CC_LOG_THREAD=main MOZ_DMD_SHUTDOWN_LOG=$logdir MOZ_DMD_LOG_PROCESS=tab ./mach run --dmd --mode=scan Breaking this down: XPCOM_MEM_BLOAT_LOG=1: This reports a list of the counts of every object created and destroyed and tracked by the XPCOM leak tracking system. From this
chart, you can see how many objects of a particular type were leaked through shutdown. This can come in handy during the manual analysis phase later, to get evidence to support your hunches. For instance, if you think that an nsFoo object might be holding your leaking object alive, you can use this to easily see if we leaked an nsFoo object. MOZ_CC_LOG_SHUTDOWN=1: This generates a cycle collector log...
DMD
me/njn/moz/mi5/memory/mozalloc/mozalloc.cpp:84) #04: nsCycleCollectingAutoRefCnt::incr(void*, nsCycleCollectionParticipant*) (/home/njn/moz/mi5/go64dmd/dom/xul/../../dist/include/nsISupportsImpl.h:250) #05: nsXULElement::Create(nsXULPrototypeElement*, nsIDocument*, bool, bool,mozilla::dom::Element**) (/home/njn/moz/mi5/dom/xul/nsXULElement.cpp:287) #06: nsXBLContentSink::CreateElement(
char16_t const**, unsigned int, mozilla::dom::NodeInfo*, unsigned int, nsIContent**, bool*, mozilla::dom::FromParser) (/home/njn/moz/mi5/dom/xbl/nsXBLContentSink.cpp:874) #07: nsCOMPtr<nsIContent>::StartAssignment() (/home/njn/moz/mi5/go64dmd/dom/xml/../../dist/include/nsCOMPtr.h:753) #08: nsXMLContentSink::HandleStartElement(
char16_t const*,
char16_t const**, unsigned int, unsigned int, bool)...
Memory reporting
hey provide more information to DMD, which is a tool that helps keep about:memory's "heap-unclassified" number low. See below for more details. Sometimes counter-based reporters are unavoidable, particularly when writing memory reporters for third-party code that cannot be modified. A Simple Example Imagine a simple string class with the following data fields: class MyString { private:
char *mBuffer; // heap-allocated size_t mLen; // ... methods ... } Here are what the measurement functions (yes, functions) should look like for this class. size_t MyString::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(mBuffer); } size_t MyString::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeO...
Power profiling overview
ivalent to Joules per second. Although power is an instantaneous concept, in practice measurements of it are determined in a non-instantaneous fashion, i.e. by dividing an energy amount by a non-infinitesimal time period. Strictly speaking, such a computation gives the average power but this is often referred to as just the power when context makes it clear. In the context of computing, a fully-
charged mobile device battery (as found in a laptop or smartphone) holds a certain amount of energy, and the speed at which that stored energy is depleted depends on the power consumption of the mobile device. That in turn depends on the software running on the device. Web browsers are popular applications and can be power-intensive, and therefore can significantly affect battery life. As a result, it...
tools/power/rapl
+ 1.67) + 3.44 W #08 5.17 W = 1.76 ( 0.07 + 0.08 + 1.60) + 3.41 W #09 5.17 W = 1.76 ( 0.09 + 0.08 + 1.58) + 3.42 W #10 8.13 W = 4.40 ( 1.55 + 0.11 + 2.74) + 3.73 W Things to note include the following. All measurements are in Watts. The first line indicates the meaning of each column. The underscores in _pkg_, _gpu_ and _ram_ are present so that each column's name has five
characters. The total power is the sum of the package power and the RAM power. The package estimate is divided into three parts: cores, GPU, and "other". "Other" is computed as the package power minus the cores power and GPU power. If the processor does not support GPU or RAM estimates then " n/a " will be printed in the relevant column instead of a number, and it will contribute zero to the total.
Performance
LogAlloc is a tool that dumps a log of memory allocations in Gecko. That log can then be replayed against Firefox's default memory allocator independently or through another replace-malloc library, allowing the testing of other allocators under the exact same workload. Memory Profiler The memory profiler samples allocation events and provides different views to analyze the allocation
characteristic. See also the documentation on Leak-hunting strategies and tips. Profiling and performance tools Profiling with the Developer Tools Profiler The profiler built into the developer tools has a high-level waterfall, detailed call tree, allocations and GC profiling, and flame graphs. It is available on all platforms and release channels, and also suppor...
Firefox Sync
ur Firefox Accounts password and has access to your email for the verification required during the initial login). Documentation This document serves as an index for all technical documentation related to Sync. It is not designed for use by end-users, but instead for people who wish to understand the details of how Sync is implemented or wish to interact with it. General The always prolific Ri
chard Newman has written a couple of notes about bookmark syncing (first, second) and has a blog where he talks about the various challenges syncing this kind of data. Servers Documentation for the various servers, including information on how to host your own. Android Searchfox has links to the main sync code and the storage layer. There are also some notes in a google document (that we really mu...
Optimizing Applications For NSPR
local threads. In the combined (MxN) model, which includes NT, IRIX (sprocs), and pthreads-user, the primordial thread is always a local thread. Therefore, if you call a blocking system call from the primordial thread, it is going to block more than just the primordial thread and the system may not function correctly. On NT, this problem is especially obvious because the idle thread, which is in
charge of driving the asynch io completion port, is also blocked. Do not call blocking system calls from the primordial thread. Create a global thread and call the system call in that thread, and have the primordial thread join that thread. NSPR uses timer signals to implement thread preemption for local threads on some platforms. If all the software linked into the application is not ported to the N...
Floating Point Number to String Conversion
These conversion functions were originally written by David M. Gay of AT&T. They use IEEE double-precision (not IEEE double-extended) arithmetic. The header file prdtoa.h declares these functions. The functions are: PR_strtod PR_dtoa PR_cnvtf References Gay's implementation is inspired by these two papers. [1] William D. Clinger, "How to Read Floating Point Numbers Accurately," Proc. ACM SIGPLAN '90, pp. 92-101. [2] Guy L. Steele, Jr. and Jon L. ...
I/O Functions
t on File Descriptors Directory I/O Functions Socket Manipulation Functions Converting Between Host and Network Addresses Memory-Mapped I/O Functions Anonymous Pipe Function Polling Functions Pollable Events Manipulating Layers Functions that Operate on Pathnames A file or directory in a file system is specified by its pathname. NSPR uses Unix-style pathnames, which are null-terminated
character strings. Only the ASCII
character set is supported. The forward slash (/) separates the directories in a pathname. NSPR converts the slashes in a pathname to the directory separator of the native OS--for example, backslash (\) on Windows and colon (:) on Mac OS--before passing it to the native system calls. Some file systems also differentiate drives or volumes. PR_Open PR_Delete PR_Ge...
PLHashComparator
tor)( const void *v1, const void *v2); Description PLHashComparator is a function type that compares two values of an unspecified type. It returns a nonzero value if the two values are equal, and 0 if the two values are not equal. PLHashComparator defines the meaning of equality for the unspecified type. For convenience, two comparator functions are provided. PL_CompareStrings compare two
character strings using strcmp. PL_CompareValues compares the values of the arguments v1 and v2 numerically. Remark The return value of PLHashComparator functions should be of type PRBool. See Also PL_CompareStrings, PL_CompareValues ...
PL_CompareStrings
If the two strings are equal, it returns 1. If the two strings are not equal, it returns 0. PL_CompareStrings can be used as the comparator function for string-valued key or entry value. ...
PL_HashString
A general-purpose hash function for
character strings. Syntax #include <plhash.h> PLHashNumber PL_HashString(const void *key); Parameter The function has the following parameter: key A pointer to a
character string. Returns The hash number for the specified key. Description PL_HashString can be used as the key hash function for a hash table if the key is a
character string. ...
PL_strcpy
On output, the buffer contains a copy of the string passed in src. src Pointer to the string to be copied. Returns The function returns a pointer to the buffer specified by the dest parameter. ...
PL_strdup
Returns The function returns one of these values: If successful, a pointer to a copy of the specified string. If the memory allocation fails, NULL. Description To accommodate the terminator, the size of the allocated memory is one greater than the length of the string being copied. ...
PL_strfree
Frees memory allocated by PL_strdup. Syntax void PL_strfree(
char *s); Parameter The function has these parameter: s Pointer to the string to be freed. ...
PL_strlen
Returns If successful, the function returns length of the specified string. ...
PRHostEnt
A structure that defines a list of network addresses. This structure is output from PR_GetHostByName and PR_GetHostByAddr and passed to PR_EnumerateHostEnt. Clients should avoid directly accessing any of the structure's fields. Syntax #include <prnetdb.h> typedef struct PRHostEnt {
char *h_name;
char **h_aliases; #if defined(_WIN32) PRInt16 h_addrtype; PRInt16 h_length; #else PRInt32 h_addrtype; PRInt32 h_length; #endif
char **h_addr_list; } PRHostEnt; Fields The structure has the following fields: h_name Pointer to the official name of host. h_aliases Pointer to a pointer to list of aliases. The list is terminated with a NULL entry. h_addrtype Host address type. For valid NSPR usage, this field must have a value indicating either an IPv4 or an IPv6 address. h_len...
PR_StringToNetAddr
Converts a
character string to a network address. Syntax #include <prnetdb.h> PRStatus PR_StringToNetAddr( const
char *string, PRNetAddr *addr); Parameters The function has the following parameters: string The string to be converted. addr On output, the equivalent network address. Returns The function returns one of the following values: If successful, PR_SUCCESS. If unsuccessful, PR_FAILURE. You can retrieve the reason for the failure by calling PR_GetError. Description For IPv4 addresses, the input string represents numbers in the Internet standard "." notation. IPv6 addresses are indicated as strings using ":"
characters separating octets, with numerous caveats for shortcutting (see RFC #1884). If the NSPR library and the host are configured to support IPv6, both ...
PR_VersionCheck
Returns The function returns one of the following values: If the version of the shared library is compatible with that expected by the caller, PR_TRUE. If the versions are not compatible, PR_FALSE. ...
PR_Writev
he buffer lengths (on success) or -1 (on failure). Note that if PR_Writev returns -1, part of the data may have been written before an error occurred. If the timeout parameter is not PR_INTERVAL_NO_TIMEOUT and all the data cannot be written in the specified interval, PR_Writev returns -1 with the error code PR_IO_TIMEOUT_ERROR. This is the type definition for PRIOVec: typedef struct PRIOVec {
char *iov_base; int iov_len; } PRIOVec; The PRIOVec structure has the following fields: iov_base A pointer to the beginning of the buffer. iov_len The size of the buffer. ...
PR_cnvtf
bufsz The size of the buffer provided to hold the result. prcsn The number of digits of precision to which to generate the floating point value. fval The double-precision floating point number to be converted. Description PR_cnvtf is a simpler interface to convert a floating point number to a string. It conforms to the ECMA standard of Javascript (ECMAScript). ...
PR_dtoa
mode The type of conversion to employ. ndigits The number of digits desired in the output string. decpt A pointer to a memory location where the runtime will store the offset, relative to the beginning of the output string, of the conversion's decimal point. ...
Process Initialization
and Versioning Initialization and Cleanup Module Initialization Identity and Versioning Name and Version Constants PR_NAME PR_VERSION PR_VersionCheck Initialization and Cleanup NSPR detects whether the library has been initialized and performs implicit initialization if it hasn't. Implicit initialization should suffice unless a program has specific sequencing requirements or needs to
characterize the primordial thread. Explicit initialization is rarely necessary. Implicit initialization assumes that the initiator is the primordial thread and that the thread is a user thread of normal priority. PR_Init PR_Initialize PR_Initialized PR_Cleanup PR_DisableClockInterrupts PR_BlockClockInterrupts PR_UnblockClockInterrupts PR_SetConcurrency PR_ProcessExit PR_Abort Module In...
An overview of NSS Internals
eroperability between software and devices that perform cryptographic operations, NSS conforms to a standard called PKCS#11. (Note that it's important to look at the number 11, as there are other PKCS standards with different numbers that define quite different topics.) A software or hardware module conforming to the PKCS#11 standard implements an interface of C calls, which allow querying the
characteristics and offered services of the module. Multiple elements of NSS's own modules have been implemented with this interface, and NSS makes use of this interface when talking to those modules. This strategy allows NSS to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and soft...
NSS_3.12.1_release_notes.html
le AIA cert fetching Bug 408847: pkix_OcspChecker_Check does not support specified responder (and given signercert) Bug 414003: Crash [[@ CERT_DecodeCertPackage] sometimes with this testcase Bug 415167: Memory leak in certutil Bug 417399: Arena Allocation results are not checked in pkix_pl_InfoAccess_ParseLocation Bug 420644: Improve SSL tracing of key derivation Bug 426886: Use const
char* in PK11_ImportCertForKey Bug 428103: CERT_EncodeSubjectKeyID is not defined in any public header file Bug 429716: debug builds of libPKIX unconditionally dump socket traffic to stdout Bug 430368: vfychain -t option is undocumented Bug 430369: vfychain -o succeeds even if -pp is not specified Bug 430399: vfychain -pp crashes Bug 430405: Error log is not produced by CERT_PKIXVerifyCert...
NSS 3.12.5 release_notes
nfigurePKCS11(). See the following struct in nss.h for details: NSSInitParametersStr Other new functions In secmod.h: SECMOD_GetSkipFirstFlag SECMOD_GetDefaultModDBFlag In prlink.h NSS_SecureMemcmp PORT_LoadLibraryFromOrigin Modified functions SGN_Update (see cryptohi.h) The parameter "input" of this function is changed from unsigned
char * to const unsigned
char *. PK11_ConfigurePKCS11 (see nss.h) The name of some parameters have been slightly changed ("des" became "desc"). Deprecated headers The header file key.h is deprecated. Please use keyhi.h instead. Additional documentation In pk11pub.h: The caller of PK11_DEREncodePublicKey should free the returned SECItem with a SECITEM_FreeItem(...,...
NSS 3.16.2 release notes
existing certificates: --dump-ext-val OID --extGeneric OID:critical-flag:filename[,OID:critical-flag:filename]... The certutil command has three new certificate usage specifiers: L: certificateUsageSSLCA A: certificateUsageAnyCA Y: certificateUsageVerifyCA The pp command has a new command-line option -u, which means "use UTF-8". The default is to show a non-ASCII
character as ".". On Linux, NSS is built with the -ffunction-sections -fdata-sections compiler flags and the --gc-sections linker flag to allow unused functions to be discarded. Bugs fixed in NSS 3.16.2 This Bugzilla query returns all the bugs fixed in NSS 3.16.2: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.
NSS 3.16 release notes
. Previously, they had to be referred to with their names in SSL 3.0, with the SSL_ prefix. Notable Changes in NSS 3.16 ECC is enabled by default. It is no longer necessary to set the environment variable NSS_ENABLE_ECC=1 when building NSS. To disable ECC, set the environment variable NSS_DISABLE_ECC=1 when building NSS. Bug 903885: (CVE-2014-1492) In a wildcard certificate, the wildcard
character should not be embedded within the U-label of an internationalized domain name. See the last bullet point in RFC 6125, Section 7.2. Bug 962760: libpkix should not include the common name of CA as DNS names when evaluating name constraints. Bug 981170: AESKeyWrap_Decrypt should not return SECSuccess for invalid keys. Bug 974693: Fix a memory corruption in sec_pkcs12_new_asafe. Bug 956082: ...
NSS 3.46 release notes
dd Wycheproof test vectors for AES-KW Bug 1571316 - curve25519_32.c:280: undefined reference to `PR_Assert' when building NSS 3.45 on armhf-linux Bug 1516593 - Client to generate new random during renegotiation Bug 1563258 - fips.sh fails due to non-existent "resp" directories Bug 1561598 - Remove -Wmaybe-uninitialized warning in pqg.c Bug 1560806 - Increase softoken password max size to 500
characters Bug 1568776 - Output paths relative to repository in NSS coverity Bug 1453408 - modutil -changepw fails in FIPS mode if password is an empty string Bug 1564727 - Use a PSS SPKI when possible for delegated credentials Bug 1493916 - fix ppc64 inline assembler for clang Bug 1561588 - Remove -Wmaybe-uninitialized warning in p7env.c Bug 1561548 - Remove -Wmaybe-uninitialized warning in pki...
NSS Tools sslstrength
tion is made. If you want to test out a particular cipher, there are two ways to affect which ciphers are available. Firstly, you can set policy to be either domestic or export. This restricts the available ciphers to the same set used by Communicator. In addition to this, the ciphers command can be used to further restrict the ciphers available. The argument to the ciphers command is a string of
characters, where each single
character represents a cipher. You can obtain this list of
character->cipher mappings by doing 'sslstrength ciphers'. For example, ciphers=bfi will turn on these cipher preferences and turn off all others. policy=export or policy=domestic will set your policies appropriately. policy will default to domestic if not specified. Step-up Step up is a mode where ...
PKCS11 FAQ
rtificate must have some label associated with it. The label for a token certificate is presented to the user as follows:token label :certificate label . This implies that eachtoken label should be unique and meaningful to the user, and that eachcertificate label should be unique to the token. NSS gets the value of the CKA_LABEL attribute from the token. Labels should not have any trailing blank
characters. Will NSS use the random number generation features of PKCS #11? Only if you identify your token as the default random number generator. If you do, your token must be able to generate random numbers even when it is not logged in. NSS uses installed random number generators if PKCS11_MECH_RANDOM_FLAG is set in the installer script. For information on how to do this, see Using the JAR Insta...
PKCS11 module installation
nstalling PKCS #11 modules. Using the Firefox preferences to install PKCS #11 modules Save the PKCS #11 module to a permanent location on your local computer Open the Firefox preferences dialog. Choose "Advanced" > "Encryption" > "Security Devices" Choose "Load" Enter a name for the security module, such as "My Client Database". NOTE: there is currently a bug in Firefox where international
characters may cause problems. Choose "Browse..." to find the location of the PKCS #11 module on your local computer, and choose "OK" when done. Provisioning PKCS #11 modules using the pkcs11 API Starting with Firefox 58, extensions can use the pkcs11 browser extension API to enumerate PKCS #11 modules and make them accessible to the browser as sources of keys and certificates. ...
FC_GetInfo
Description FC_GetInfo returns general information about the PKCS #11 library. On return, the CK_INFO structure that pInfo points to has the following information: cryptokiVersion: PKCS #11 interface version number implemented by the PKCS #11 library. The version is 2.20 (major=0x02, minor=0x14). manufacturerID: the PKCS #11 library manufacturer, "Mozilla Foundation", padded with spaces to 32
characters and not null-terminated. flags: should be 0. libraryDescription: description of the library, "NSS Internal Crypto Services", padded with spaces to 32
characters and not null-terminated. libraryVersion: PKCS #11 library version number, for example, 3.11 (major=0x03, minor=0x0b). A user may call FC_GetInfo without logging into the token (to assume the NSS User role). Return value FC_Ge...
FC_GetTokenInfo
escription FC_GetTokenInfo returns information about the token in the specified slot. On return, the CK_TOKEN_INFO structure that pInfo points to has the following information: label: the label of the token, assigned during token initialization, padded with spaces to 32 bytes and not null-terminated. manufacturerID: ID of the device manufacturer, "Mozilla Foundation", padded with spaces to 32
characters and not null-terminated. model: model of the device, "NSS 3", padded with spaces to 16
characters and not null-terminated. serialNumber: the device's serial number as a string, "0000000000000000", 16
characters and not null-terminated. flags: bit flags indicating capabilities and status of the device. CKF_RNG (0x00000001): this device has a random number generator CKF_WRITE_PROTECTED (...
FC_InitToken
Name FC_InitToken() - initialize or re-initialize a token. Syntax CK_RV FC_InitToken( CK_SLOT_ID slotID, CK_
CHAR_PTR pPin, CK_ULONG ulPinLen, CK_
CHAR_PTR pLabel ); Parameters FC_InitToken() has the following parameters: slotID the ID of the token's slot pPin the password of the security officer (SO) ulPinLen the length in bytes of the SO password pLabel points to the label of the token, which must be padded with spaces to 32 bytes and not be null-terminated Description FC_InitToken() initializes a brand new token or re-initializes a token that was initialized before. Specifically, FC_InitToken() initializes or clears the key database, removes the password, and then marks all the user certs in the certificate database as non-user certs. (User certs are the certific...
FC_Login
The Security Officer (CKU_SO) only logs in to initialize the normal user's PIN. 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. ...
FC_SetPIN
ulOldLen [Input] the length in bytes of the old PIN. pNewPin [Input] points to the new PIN. ulNewLen [Input] the length in bytes of the new PIN. Description FC_SetPIN modifies the PIN of the user. ...
NSC_InitToken
Name NSC_InitToken() - initialize or re-initialize a token. Syntax CK_RV NSC_InitToken( CK_SLOT_ID slotID, CK_
CHAR_PTR pPin, CK_ULONG ulPinLen, CK_
CHAR_PTR pLabel ); Parameters NSC_InitToken() has the following parameters: slotID the ID of the token's slot pPin the password of the security officer (SO) ulPinLen the length in bytes of the SO password pLabel points to the label of the token, which must be padded with spaces to 32 bytes and not be null-terminated Description NSC_InitToken() initializes a brand new token or re-initializes a token that was initialized before. Specifically, NSC_InitToken() initializes or clears the key database, removes the password, and then marks all the user certs in the certificate database as non-user certs. (User certs are the cer...
NSC_Login
The Security Officer (CKU_SO) only logs in to initialize the normal user's PIN. The SO PIN is the empty string. ...
NSS tools : pk12util
e being accessed (either -d for a directory or -h for a token). pk12util -i p12File [-h tokenname] [-v] [-d [sql:]directory] [-P dbprefix] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword] For example: # pk12util -i /tmp/cert-files/users.p12 -d sql:/home/my/sharednssdb Enter a password which will be used to encrypt your keys. The password should be at least 8
characters long, and should contain at least one non-alphabetic
character. Enter new password: Re-enter password: Enter password for PKCS12 file: pk12util: PKCS12 IMPORT SUCCESSFUL Exporting Keys and Certificates Using the pk12util command to export certificates and keys requires both the name of the certificate to extract from the database (-n) and the PKCS#12-formatted output file to write ...
NSS tools : ssltab
is an SSL-aware command-line proxy. It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII
characters. The two parts are separated by a vertical bar. Nonprinting
characters are replaced by dots. -f Turn on fancy printing. Output is printed in colored HTML. Data sent from the client to the server is in blue; the server's reply is in red. When used with looping mode, the different connections are separated with horizontal lines. You can use this option to upload the output into a browser. -s ...
NSS tools : ssltap
is an SSL-aware command-line proxy. It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII
characters. The two parts are separated by a vertical bar. Nonprinting
characters are replaced by dots. -f Turn on fancy printing. Output is printed in colored HTML. Data sent from the client to the server is in blue; the server's reply is in red. When used with looping mode, the different connections are separated with horizontal lines. You can use this option to upload the output into a browser. -s ...
ssltyp.html
To free a structure pointed to by a SECItem, and, if desired, the SECItem structure itself, use one the functions SECItem_FreeItem or SECItem_ZfreeItem. SECKEYPrivateKey An opaque, generic key structure. Syntax #include <keyt.h> typedef struct SECKEYPrivateKeyStr ...
NSS_3.12.3_release_notes.html
rtutil didn't accept certificate request to sign. Bug 464406: Fix signtool regressions Bug 465270: uninitialised value in devutil.c::create_object() Bug 465273: dead assignment in devutil.c::nssSlotArray_Clone() Bug 465926: During import of PKCS #12 files Bug 466180: SSL_ConfigMPServerSIDCache with default parameters fails on {Net Bug 466194: CERT_DecodeTrustString should take a const
char * input trusts string. Bug 466736: Incorrect use of NSS_USE_64 in lib/libpkix/pkix_pl_nss/system/pkix_pl_object.c Bug 466745: random number generator fails on windows ce Bug 467298: SQL DB code uses local cache on local file system Bug 468279: softoken crash importing email cert into newly upgraded DB Bug 468532: Trusted CA trust flags not being honored in CERT_VerifyCert Bug 469583: ...
NSS Tools sslstrength
tion is made. If you want to test out a particular cipher, there are two ways to affect which ciphers are available. Firstly, you can set policy to be either domestic or export. This restricts the available ciphers to the same set used by Communicator. In addition to this, the ciphers command can be used to further restrict the ciphers available. The argument to the ciphers command is a string of
characters, where each single
character represents a cipher. You can obtain this list of
character->cipher mappings by doing 'sslstrength ciphers'. For example, ciphers=bfi will turn on these cipher preferences and turn off all others. policy=export or policy=domestic will set your policies appropriately. policy will default to domestic if not specified. Step-up Step up is a mode where...
NSS Tools ssltap
e command does not require any options other than hostname:port, but you normally use them to control the connection interception and output. The options for the command are the following: -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII
characters. The two parts are separated by a vertical bar. Nonprinting
characters are replaced by dots. -f Turn on fancy printing. Output is printed in colored HTML. Data sent from the client to the server is in blue; the server's reply is in red. When used with looping mode, the different connections are separated with horizontal lines. You can use this option to upload the output into a browser. ...
NSS tools : pk12util
ng accessed (either -d for a directory or -h for a token). pk12util -i p12File [-h tokenname] [-v] [-d [sql:]directory] [-P dbprefix] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword] For example: # pk12util -i /tmp/cert-files/users.p12 -d sql:/home/my/sharednssdb Enter a password which will be used to encrypt your keys. The password should be at least 8
characters long, and should contain at least one non-alphabetic
character. Enter new password: Re-enter password: Enter password for PKCS12 file: pk12util: PKCS12 IMPORT SUCCESSFUL Exporting Keys and Certificates Using the pk12util command to export certificates and keys requires both the name of the certificate to extract from the database (-n) and the PKCS#12-formatted output fil...
NSS tools : ssltap
ions and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII
characters. The two parts are separated by a vertical bar. Nonprinting
characters are replaced by dots. -f Turn on fancy printing. Output is printed in colored HTML. Data sent from the client to the server is in blue; the server's reply is in red. When used with looping mode, the different connections are separated with horizontal ...
Pork
This information allows C++ to be automatically rewritten in a precise way. The inputs driving the rewriting would normally be provided by a program-analysis system outside of Pork. (See Dehydra, Treehydra). Pork has been tested mostly on Linux, but in theory it should be possible to make it work on other systems. Note: Pork is not presently used at Mozilla. Please refer to the oink link below for a more up-to-date toolchain. ...
Rhino JavaScript compiler
table filename. -d outputDirectory Writes the class file to outputDirectory. -opt optLevel Optimizes at level optLevel, which must be an integer between -1 and 9. See Optimization for more details. If optLevel is greater than zero, -debug may not be specified. -package packageName Specifies the package to generate the class into. The string packageName must be composed of valid identifier
characters optionally separated by periods. -version versionNumber Specifies the language version to compile with. The string versionNumber must be one of 100, 110, 120, 130, 140, 150, 160, or 170. See JavaScript Language Versions for more information on language versions. Examples $ cat test.js java.lang.System.out.println("hi, mom!"); $ java org.mozilla.javascript.tools.jsc.Main test.js $ ls *...
Rhino overview
e ECMA conformant version is used (an array is constructed with no elements but with length property equal to i). String.prototype.substring For version 1.2 only, the two arguments are not swapped if the first argument is less than the second one. All other versions are ECMA compliant. String.prototype.split For version 1.2 only, split performs the Perl4 special case when given a single space
character as an argument (skips leading whitespace, and splits on whitespace). All other versions split on the space
character proper as specified by ECMA. Security The security features in Rhino provide the ability to track the origin of a piece of code (and any pieces of code that it may in turn generate). These features allow for the implementation of a traditional URL-based security policy for J...
The JavaScript Runtime
type Undefined A singleton object defined by Context.getUndefinedType() Null null Boolean java.lang.Boolean Number java.lang.Number, that is, any of java.lang.Byte, java.lang.Short, java.lang.Integer, java.lang.Float, or java.lang.Double. Not java.lang.Long, since a double representation of a long may lose precision. String java.lang.
CharSequence (java.lang.String or org.mozilla.javascript.ConsString) Object org.mozilla.javascript.Scriptable In addition, ECMA refers to objects that implement [[Call]] as functions. These object types are represented by implementing the Function interface. Since JavaScript is a dynamically typed language, the static Java type of a JavaScript value is java.lang.Object. The behavi...
Scripting Java
following call: js> a = java.lang.reflect.Array.newInstance(java.lang.String, 5); [Ljava.lang.String;@7ffe01 To create an array of primitive types, we must use the special TYPE field defined in the associated object class in the java.lang package. For example, to create an array of bytes, we must use the special field java.lang.Byte.TYPE: js> a = java.lang.reflect.Array.newInstance(java.lang.
Character.TYPE, 2); [C@7a84e4 The resulting value can then be used anywhere a Java array of that type is allowed. js> a[0] = 104 104 js> a[1] = 105 105 js> new java.lang.String(a) hi Java Strings and JavaScript Strings It's important to keep in mind that Java strings and JavaScript strings are not the same. Java strings are instances of the type java.lang.String and have all the methods defined ...
GCIntegration - SpiderMonkey Redirect 1
ill alive, but it moved, then we can update the pointer. For wrapper caches, we may add a new class hook that is invoked if the object moves. Objects with wrapper caches could implement that hook to find their corresponding C++ object and update the wrapper field to point to the new location. Undoubtedly there will be more esoteric cases. We will need to handle pointers to array slots and string
characters specially, since those may actually be pointers into the middle of GC things (inline slots or inline
chars). We will need to explore how these situations occur in the browser now, and how best to handle them. Write barriers Generational GC needs its own write barrier. The goal is to keep a list, called the remembered set, of all pointers from the tenured generation into the nursery. So ev...
Exact Stack Rooting
ce the GC may move GCThings, it very important that SpiderMonkey know about each and every GCPointer in the system. The method you should use to keep the GC up-to-date with this information will vary depending on where the GCPointer is being stored. GCPointers can be stored as a property of a GCThing, on the CHeap, or in the CStack. These three storage regions have different lifetime and overhead
characteristics and thus require different management strategies for efficient space and CPU utilization. Since C++ does not reliably distinguish between storage classes, we have to put this burden on the user. Storing a GCPointer in a GCThing Storing your GCPointer inside of a GCThing that is already in the LiveSet is the easiest way to keep a GCThing to the LiveSet. GCPointers that reside in GCTh...
JS::CallArgs
ax JS::CallArgs JS::CallArgsFromVp(unsigned argc, JS::Value *vp); Name Type Description args unsigned Number of argument. (2nd argument of JSNative) vp JS::Value * A pointer to the argument value array. (3nd argument of JSNative) Methods Methods of JS::CallArgs Method Description bool requireAtLeast(JSContext *cx, const
char *fnname, unsigned required) Returns true if there are at least required arguments passed in. If false, it reports an error message on the context. Methods inherited from JS::CallArgsBase Method Description unsigned length() const Returns the number of arguments.. JS::MutableHandleValue operator[](unsigned i) const Returns the i-th zero-indexed argume...
JS::GetDeflatedUTF8StringLength
This article covers features introduced in SpiderMonkey 38 Returns the length of the
char buffer required to encode given string as UTF8. Syntax size_t GetDeflatedUTF8StringLength(JSFlatString* s); Name Type Description s JSFlatString * The pointer to the string to calculate the length. Description JS::GetDeflatedUTF8StringLength returns the length of the
char buffer required to encode s as UTF8. The returned length does not include the null-terminator. See Also JS::DeflateStringToUTF8Buffer bug 1034627 ...
JS::GetSelfHostedFunction
This article covers features introduced in SpiderMonkey 31 Create a new JavaScript function that is implemented in self-hosted JavaScript. Syntax JSFunction* JS::GetSelfHostedFunction(JSContext* cx, const
char* selfHostedName, JS::Handle<jsid> id, unsigned nargs); Name Type Description cx JSContext* The context from which to get the function. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. selfHostedName const
char* Function name in the self-hosted JavaScript. id JS::Handle<jsid> A pointer to jsid of the name to assign to the new function. nargs unsigned Number of arguments the function expects. Description JS::...
JS::PersistentRooted
ue. JS::RootedValue val(cx, persistentVal.ref()); // or // JS::RootedValue val(cx, *persistentVal); // [SpiderMonkey 38] // JS::RootedValue val(cx, persistentVal); args.rval().set(val); return true; } static const JSFunctionSpec functions[] = { JS_FN("getPersistent", GetPersistent, 1, 0), JS_FN("setPersistent", SetPersistent, 0, 0), JS_FS_END }; int main(int argc, const
char* argv[]) { // Initialize runtime // ... // Initialize here persistentVal.construct(rt, JS::NullValue()); // or // persistentVal = new JS::PersistentRootedValue(rt, JS::NullValue()); // [SpiderMonkey 38] // persistentVal.init(rt, JS::NullValue()); // Initialize context and global // ... if (!JS_DefineFunctions(cx, glob, functions)) return 1; // Use those functio...
JS::PropertySpecNameIsSymbol
This article covers features introduced in SpiderMonkey 38 Determine if the given JSPropertySpec::name or JSFunctionSpec::name value is actually a symbol code and not a string. Syntax bool JS::PropertySpecNameIsSymbol(const
char *name); Name Type Description name const
char * The pointer of the name, actually the uintptr_t type, and not a pointer to any string. Description JS::PropertySpecNameIsSymbol determines if the given JSPropertySpec::name or JSFunctionSpec::name value is actually a symbol code and not a string, and returns true if so. See Also MXR ID Search for JS::PropertySpecNameIsSymbol JS::PropertySpecNameEqualsId JS::PropertySpecNameToPermanentId JSPropertySpec JSFunctionSpec bug 1082672 ...
JS::Value
These confusing semantics led to this method being removed from th...
JSConstDoubleSpec
This article covers features introduced in SpiderMonkey 17 Describes a double and integer value and assigns it a name. Syntax template<typename T> struct JSConstScalarSpec { const
char *name; T val; /* uint8_t flags; // Obsolete from JSAPI 35 uint8_t spare[3]; // Obsolete from JSAPI 35 */ }; typedef JSConstScalarSpec<double> JSConstDoubleSpec; typedef JSConstScalarSpec<int32_t> JSConstIntegerSpec; // Added in SpiderMonkey 38 Name Type Description val double or int32_t Value for the double or integer. name const
char * Name to assign the double. flags uint8_t Property attributes for the double. Obsolete since JSAPI 35 Currently these can be 0 or more of the following values OR'd: ...
JSPrincipals
Obsolete since JSAPI 13 getPrincipalArray void * (*)(JSContext *, JSPrincipals *) Pointer to the function that returns an array of principal definitions. ...
JSStringFinalizer
This article covers features introduced in SpiderMonkey 17 Finalize external strings created by JS_NewExternalString. Syntax struct JSStringFinalizer { void (*finalize)(const JSStringFinalizer *fin,
char16_t *
chars); }; Name Type Description fin JSStringFinalizer The finalizer itself.
chars
char16_t * Buffer of the external string to be finalized. Description JSStringFinalizer::finalize finalizes external strings created by JS_NewExternalString. See Also MXR ID Search for JSStringFinalizer JS_NewExternalString bug 724810 ...
JSVAL_IS_STRING
Obsolete since JSAPI 32This 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. Determines if a given jsval is a string. Syntax JSVAL_IS_STRING(v) Description JSVAL_IS_STRING(v) is true if v is a string. To access the content of a string jsval, use JSVAL_TO_STRING, JS_GetString
Chars, and JS_GetStringLength. Example The following code snippet illustrates how a JavaScript variable, MyItem, is conditionally tested in an if statement to see if it is a string. if (JSVAL_IS_STRING(MyItem)) { ... } See Also bug 952650 ...
JSVAL_TO_STRING
L_IS_STRING(v) must be true. This function is not type-safe: if v is not a string, the behavior is undefined. To coerce any value to a string, use the JS_ValueToString function instead. (The difference is that the latter will convert an object, array, number, or other value to a string in a type-safe way, creating a new string if needed.) To convert the return type of this macro (JSString *) to a
char pointer, use JS_GetStringBytes. See Also bug 952650 ...
JS_AliasElement
Obsolete since JSAPI 8This 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 an aliased index entry for an existing numeric property of a native object. Syntax JSBool JS_AliasElement(JSContext *cx, JSObject *obj, const
char *name, jsint alias); Name Type Description cx JSContext * The context in which to create the alias. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The object for which to create the alias. name const
char * Name of the element for which to create an alias. This name corresponds to a string representation of the element's curren...
JS_AliasProperty
Obsolete since JSAPI 8This 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 an alias for a native property. Syntax JSBool JS_AliasProperty(JSContext *cx, JSObject *obj, const
char *name, const
char *alias); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object for which to create the alias. name const
char * Name of the property for which to create an alias. alias const
char * Alias name to assign to the property. Description JS_Alia...
JS_BufferIsCompilableUnit
Determine whether a buffer is compilable unit. Syntax bool JS_BufferIsCompilableUnit(JSContext *cx, JS::Handle<JSObject*> obj, const
char *utf8, size_t length); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject The global object, or NULL. utf8 const
char * String containing the script to compile. length size_t The length of utf8 in
characters. Description Given a buffer, return false if the buffer might become a valid JavaScript statement with the addition of more lines. Otherwise return true. The intent is ...
JS_CompareStrings
ged. This function imposes a total order on all JavaScript strings, the same order imposed by the JavaScript string comparison operators (<, <=, >, >=), as described in ECMA 262-3 ? 11.8.5. As the standard says: The comparison of strings uses a simple lexicographic ordering on sequences of code point value values. There is no attempt to use the more complex, semantically oriented definitions of
character or string equality and collating order defined in the Unicode specification. Therefore strings that are canonically equal according to the Unicode standard could test as unequal. See Also MXR ID Search for JS_CompareStrings JS_ConvertValue JS_GetString
Chars JS_GetStringLength JS_ValueToString ...
JS_CompileFileHandleForPrincipals
This article covers features introduced in SpiderMonkey 1.8.5 Please provide a description of this function. Syntax JSObject * JS_CompileFileHandleForPrincipals(JSContext *cx, JSObject *obj, const
char *filename, FILE *fh, JSPrincipals *principals); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * filename const
char fh FILE * principals JSPrincipals * Description Please provide a description. See Also JS_CompileFileHandleForPrincipalsVersion ...
JS_CompileFileHandleForPrincipalsVersion
This article covers features introduced in SpiderMonkey 1.8.5 Please provide a description for this function. Syntax JSObject * JS_CompileFileHandleForPrincipalsVersion(JSContext *cx, JSObject *obj, const
char *filename, FILE *fh, JSPrincipals *principals, JSVersion version); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * filename const
char fh FILE * principals JSPrincipals * version JSVersion Description Please provide a description. See also JS_CompileFileHandleForPrincipals ...
JS_CompileUTF8File
Obsolete since JSAPI 19This 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. Compile a script, reading the source code from a file. Syntax JSObject * JS_CompileUTF8File(JSContext *cx, JSObject *obj, const
char *filename); Name Type Description cx JSContext * The context in which to compile the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * Object with which the script is associated. filename const
char * Name of file containing the script to compile. Description JS_CompileUTF8File compiles the text of script in an external file location for execut...
JS_DecompileScriptObject
This article covers features introduced in SpiderMonkey 1.8.5 FIXME: Please provide a description for this function. Syntax JSString * JS_DecompileScriptObject(JSContext *cx, JSObject *scriptObj, const
char *name, unsigned int indent); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. scriptObj JSObject * name const
char * indent unsigned int Description FIXME: Please provide a description. See also FIXME: ...
JS_DefineObject
Create an object that is a property of another object. Syntax JSObject * JS_DefineObject(JSContext *cx, JS::HandleObject obj, const
char *name, const JSClass *clasp = nullptr, unsigned attrs = 0); Name Type Description cx JSContext * The context in which to create the new object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object to which this new object belongs as a property. name const
char * Name of the property being defined in obj to hold the new object. clasp const JSClass * Class to use for the new object. proto JS::HandleObject Prototype object to use for the new object, or NULL. Obsolete since JSAPI 38 ...
JS_EncodeStringToBuffer
This article covers features introduced in SpiderMonkey 1.8.5 Convert a JavaScript string to a C string. Syntax size_t JS_EncodeStringToBuffer(JSContext *cx, JSString *str,
char *buffer, size_t length); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * A string to encode. buffer
char * A
character buffer to receive encoded string. length size_t The size of buffer in bytes. Description JS_EncodeStringToBuffer converts the specified JavaScript str to a C string (an array of 8-bit
chars) and fills the specified buffer with up to length bytes of the string. It returns the length of the whole stri...
JS_FileEscapedString
This article covers features introduced in SpiderMonkey 1.8.5 Write string into file with escaping. Syntax bool JS_FileEscapedString(FILE *fp, JSString *str,
char quote); Name Type Description fp FILE * A file pointer to write into. str JSString * A string to write into the file. quote
char One of 0, single quote, and double quote. Description JS_FileEscapedString writes str into file fp escaping any non-printable or non-ASCII
character. If quote is not 0, it must be a single or double quote
character that will quote the output. If successful, JS_FileEscapedString returns true, otherwise false. See Also MXR ID Search for JS_FileEscapedString bug 609440 ...
JS_GetFunctionName
Description JS_GetFunctionName retrieves the function name associated with a function pointer, fun. The return value is either the name of a function, or the string "anonymous", which indicates that the function was not assigned a name when created. ...
JS_GetImplementationVersion
Get the version number of the JS engine. Syntax const
char * JS_GetImplementationVersion(void); Description JS_GetImplementationVersion returns a hard-coded, English language string that specifies the version number of the JS engine currently in use, and its release date. See Also MXR ID Search for JS_GetImplementationVersion JS_GetVersion JS_SetVersionForCompartment ...
JS_GetLocaleCallbacks
JSLocaleToLowerCase Implementation of String.prototype.toLocaleLowerCase() function. JSLocaleCompare Implementation of String.prototype.localeCompare() function. If EXPOSE_INTL_API is defined, Intl API is used in...
JS_GetPropertyDescriptor
Finds a specified property of an object and gets a detailed description of that property. Syntax bool JS_GetPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const
char *name, JS::MutableHandle<JSPropertyDescriptor> desc); // Added in SpiderMonkey 31 bool JS_GetPropertyDescriptorById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject The object to search for the property. id const
char * or JS::HandleId The name of the property to look up. ...
JS_GetStringLength
t code units, of a JavaScript string. Syntax size_t JS_GetStringLength(JSString *str); Name Type Description str JSString * The string to examine. Description JS_GetStringLength reports the length, in 16-bit code units, of the string str. This is the same as the length property of the string. This is the same as the length of the array returned by JS_GetString
Chars, in
char16_ts (not bytes). Because some Unicode
characters are represented using two 16-bit code units, the result is not necessarily the same as the number of Unicode
characters in the string. See Also MXR ID Search for JS_GetStringLength JS_CompareStrings JS_ConvertValue JS_GetEmptyStringValue JS_GetStringBytes JS_InternString JS_NewStringCopyN JS_NewStringCopyZ JS_ValueToString ...
JS_GetTypeName
Obsolete since JSAPI 34This 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. Returns a pointer to the string literal description of a specified JS data type. Syntax const
char * JS_GetTypeName(JSContext *cx, JSType type); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. type JSType One of JSTYPE_VOID, JSTYPE_OBJECT, JSTYPE_FUNCTION, JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_BOOLEAN. Description JS_GetTypeName returns a pointer to a string literal description of a specified JS data type, type. The following table lists JSTypes and the string literals reported by JS_GetTypeName: ...
JS_HasOwnProperty
This article covers features introduced in SpiderMonkey 45 Determine whether a JavaScript object has a specified own property. Syntax bool JS_HasOwnProperty(JSContext* cx, HandleObject obj, const
char* name, bool* foundp) bool JS_HasOwnPropertyById(JSContext* cx, HandleObject obj, HandleId id, bool* foundp) Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject Object to search on for the property. name or id const
char * or JS::HandleId Name of the property to look up. foundp bool * Non-null pointer to a variable of type bool. On success, JS_HasOwnProperty s...
JS_MapGCRoots
object in a JSRuntime's GC root set. Syntax uint32 JS_MapGCRoots(JSRuntime *rt, JSGCRootMapFun map, void *data); Callback syntax #define JS_MAP_GCROOT_NEXT 0 /* continue mapping entries */ #define JS_MAP_GCROOT_STOP 1 /* stop mapping entries */ #define JS_MAP_GCROOT_REMOVE 2 /* remove and free the current entry */ typedef int (*JSGCRootMapFun)(void *rp, const
char *name, void *data); Description Call JS_MapGCRoots to map the GC's roots table using map(rp, name, data). The root is pointed at by rp; if the root is unnamed, name is null; data is supplied from the third parameter to JS_MapGCRoots. The map function should return JS_MAP_GCROOT_REMOVE to cause the currently enumerated root to be removed. To stop enumeration, return JS_MAP_GCROOT_STOP. To cont...
JS_NewStringCopyZ
Create a new JavaScript string based on a null-terminated C string. Syntax JSString * JS_NewStringCopyZ(JSContext *cx, const
char *s); JSString * JS_NewUCStringCopyZ(JSContext *cx, const
char16_t *s); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. s const
char * or const
char16_t * Pointer to the
character array containing the text for the JS string to create; or NULL. Description JS_NewStringCopyZ allocates space for a new JavaScript string and its underlying storage, and then copies the contents of a null-terminated
character array, s, into the new string. On success, JS_NewStringCopyZ re...
JS_ReportError
Create a formatted error or warning message to pass to a user-defined error reporting function. This function can also raise a JavaScript exception which a currently executing script can catch. Syntax void JS_ReportError(JSContext *cx, const
char *format, ...); bool JS_ReportWarning(JSContext *cx, const
char *format, ...); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. format const
char * Format string to convert into an error message using JS_vsmprintf. ... ... Error message variables to insert into the format string. Description JS_ReportError is the simplest JSAPI function...
JS_ReportOutOfMemory
allocate memory and allocation fails, it reports an error as though by calling this function. Call JS_ReportAllocationOverflow if an operation fails because it tries to use more memory (or more of some other resource) than the application is designed to handle. When a script tries to grow an array beyond 230-1 elements, for example, or concatenate strings such that the result is more than 229-1
characters long, the JavaScript engine reports an error as though by calling this function. See JS_ReportError and JS_SetErrorReporter for more information about error handling in the JSAPI. See Also MXR ID Search for JS_ReportOutOfMemory MXR ID Search for JS_ReportAllocationOverflow bug 422348 ...
JS_SetCompartmentNameCallback
Callback callback); Name Type Description cx JSRuntime * The runtime to set the callback function. callback JSCompartmentNameCallback Callback function which will be called to name each compartment (see below). Callback function typedef void (* JSCompartmentNameCallback)(JSRuntime *rt, JSCompartment *compartment,
char *buf, size_t bufsize); Name Type Description cx JSRuntime * The runtime of the compartments. compartmentCallback JSCompartment * The pointer to the compartment to be named. buf
char * The buffer to store the name of the compartment. bufsize size_t The maximum size of the buffer. Description JS_SetCompartmentNameC...
JS_StringEqualsAscii
This article covers features introduced in SpiderMonkey 1.8.5 Compare flat string and ASCII string. Syntax bool JS_StringEqualsAscii(JSContext *cx, JSString *str, const
char *asciiBytes, bool *match); bool JS_FlatStringEqualsAscii(JSFlatString *str, const
char *asciiBytes); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSFlatString * String to compare. asciiBytes const
char * ASCII string to compare with. match bool * (JS_StringEqualsAscii only) Out parameter. Received the comparison result. Description JS_StringEqualsAscii and JS_FlatStringEqualsAscii compare string str and ASCII string asciiBytes...
JS_VersionToString
Returns a string representation of a JSVersion value. Syntax const
char * JS_VersionToString(JSVersion version); Name Type Description version JSVersion Version value to convert. Description JS_VersionToString attempts to convert the version to a const
char * string representation. JS_VersionToString may return any of the following values: Enumeration String JSVERSION_1_0 "1.0" Obsolete since JSAPI 24 JSVERSION_1_1 "1.1" Obsolete since JSAPI 24 JSVERSION_1_2 "1.2" Obsolete since JSAPI 24 JSVERSION_1_3 "1.3" Obsolete since JSAPI 24 JSVERSION_1_4 "1.4" Obsolete since JSAPI 24 JSVERSION_ECMA_3 "ECMAv3" JSVERSION_1_5 "1.5" Obsolete since JSAPI 24 JSVERSIO...
JS_malloc
Allocate and free memory that is not managed by the garbage collector. Syntax void * JS_malloc(JSContext *cx, size_t nbytes); void * JS_realloc(JSContext *cx, void *p, size_t oldBytes, size_t newBytes);
char * JS_strdup(JSContext *cx, const
char *s); void JS_free(JSContext *cx, void *p); Name Type Description cx JSContext * Pointer to a JS context. If allocation fails, an error is reported in this context. p void * (JS_realloc and JS_free only) Pointer to a previously allocated region of memory to resize or deallocate. nbytes size_t (JS_malloc and JS_realloc only) Amount of space, in bytes, to allocate. s const
char * (JS_strdup only) Pointer to a null-terminated string. s must not be NULL. Description JS_m...
SpiderMonkey 1.8
mmended for populating JSFunctionSpec arrays. JS_NewObjectWithGivenProto is exactly like JS_NewObject except that it doesn't use a default prototype object if you pass NULL. Instead the object is created with no prototype. JS_AlreadyHasOwnProperty and friends are new functions for examining an object without triggering resolve hooks. It was possible to configure SpiderMonkey 1.7 to treat C/C++
char strings as UTF-8 by compiling with a non-default compiler option. In SpiderMonkey 1.8, it is no longer necessary to make a special build to get this behavior. Applications can turn on UTF-8 at run time by calling JS_SetCStringsAreUTF8. JS_EncodeString is a new variation on JS_GetStringBytes that returns a newly allocated, writable buffer which the application must JS_free. JS_ReportAllocationOv...
SpiderMonkey 45
JS_GetCompartmentStats JS_SetICUMemoryFunctions JS_IsGCMarkingTracer JS_IsMarkingGray JS_IdArrayLength JS_IdArrayGet JS_DestroyIdArray JS_DefaultValue JS_GetParent JS_SetParent JS::ParsePropertyDescriptorObject JS_DeleteProperty2 JS_DeletePropertyById2 JS_DeleteUCProperty2 JS_DeleteElement2 JS_NewFunctionById JS_BindCallable JS_DecompileFunctionBody JS_GetLatin1InternedString
Chars JS_GetTwoByteInternedString
Chars JS_NewDateObjectMsec JS_ClearDateCaches Changed APIs JS_Init has moved from jsapi.h to js/Initialization.h JS_ShutDown has moved from jsapi.h to js/Initialization.h JS_InitReflect is now implicit JS_AddWeakPointerCallback is replaced with JS_AddWeakPointerZoneGroupCallback and JS_AddWeakPointerCompartmentCallback JS_RemoveWeakPointerCallback is replac...
Mozilla Projects
hic operations on behalf of a client application. These operations include setting up an SSL connection, object signing and signature verification, certificate management (including issuance and revocation), and other common PKI functions. Pork Pork is a C++ parsing and rewriting tool chain. The core of Pork is a C++ parser that provides exact
character positions for the start and end of every AST node, as well as the set of macro expansions that contain any location. This information allows C++ to be automatically rewritten in a precise way. The inputs driving the rewriting would normally be provided by a program-analysis system outside of Pork. (See Dehydra, Treehydra). Rhino ...
Handling Mozilla Security Bugs
rability 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 arrangements 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 Mozilla contributors and others can participate in addressing security vulnerabilities in Mozilla. T...
Frecency algorithm
The latter two later ported all of the code from C++ to JavaScript. ...
History Service Design
management: provides basic and advanced APIs to store and modify visits and page details. Relevance calculation: maintain and expire frecency values for pages. History expiration: expire old visits and invalid informations from the database. Queries creation: allows the creation for complex queries. Queries results maintenance: allows easy access to queries results.
Charset for pages: allows setting and reading
charset for each page. Database maintenance At startup the service creates an exclusive Storage connection to places.sqlite, the exclusive locking is needed for both a perf gain and data-safety. In case the database is missing a new one is created, if instead the database exists but the connection to it fails due to database corruption, the corrupt da...
Using the Places annotation service
ld only use it from the main thread. Naming your annotations For your annotation name, you should use the format <namespace>/<name>. For example, "my_extension/page_state". The annotation service does not currently enforce the annotation name format, but this may change in the future. Also, we may add functions to get all of "your" annotations matching a given namespace. You should not use any
characters in your annotation names that are not valid as part of an HTML path. This includes colons, spaces, most punctuation, and non-ASCII
characters. You should try to have relatively few annotation names. The service stores these names in a separate table, and the fewer names there are, the more efficient retrieving names will be. You should not design your service so that you require hundreds o...
Aggregating the In-Memory Datasource
troduction You can use XPCOM aggregation1 with the in-memory datasource. Why would you want to do this? Say you were writing a datasource2, and the way you chose to implement it was to "wrap" the in-memory datasource; i.e., MyClass : public nsIMyInterface, public nsIRDFDataSource { private: nsCOMPtr<nsIRDFDataSource> mInner; public: // nsIRDFDataSource methods NS_IMETHOD Init(const
char* aURI) { return mInner->Init(aURI); } NS_IMETHOD GetURI(
char* *aURI) { return mInner->GetURI(aURI); } // etc., for each method in nsIRDFDataSource! }; Very painful, prone to errors, and fragile as the interfaces are still in flux (a wee bit). Aggregation to the rescue! Here are the gory details on how. When It Won't Work Although this magic is terribly conven...
Setting up the Gecko SDK
ile for the Gecko SDK MODULE = MozShim # Change this to point at your Gecko SDK directory. GECKO_SDK_PATH ?= $(HOME)/tmp/xr XPIDL ?= $(GECKO_SDK_PATH)/bin/xpidl CXX ?= c++ XPIDLSRCS = \ InterfaceA.idl \ InterfaceB.idl \ $(NULL) CPPSRCS = \ SourceA.cpp \ SourceB.cpp \ $(NULL) CPPFLAGS += -fno-rtti \ -fno-exceptions \ -fshort-w
char \ -fPIC \ $(NULL) # GCC only define which allows us to not have to #include mozilla-config # in every .cpp file. If your not using GCC remove this line and add # #include "mozilla-config.h" to each of your .cpp files. GECKO_CONFIG_INCLUDE = -include mozilla-config.h GECKO_DEFINES = -DMOZILLA_STRICT_API GECKO_INCLUDES = -I$(GECKO_SDK_PATH) \ -I$(GECK...
Detailed XPCOM hashtable guide
the various nsBaseHashtable classes as well, as needed. Hash Functions All of the above hashtables need a Hash Function. This function converts the key into a semi-unique integer. The mozilla codebase already contains hash functions for most key types, including narrow and wide strings, pointers, and most binary data: void* (or nsISupports*) cast using NS_PTR_TO_INT32
char* string nsCRT::HashCode() PRUni
char* string nsAString HashString() nsACString nsID& nsIDHashKey::HashKey() Writing a good hash function is well beyond the scope of this document, and has been discussed extensively in computer-science circles for many years. There are many different types of hash functions. Mozilla has tuned a good general-purpos...
XPCOM guide
ions for how to update your code.XPCOM hashtable guideA hashtable is a data construct that stores a set of items. Each item has a key that identifies the item. Items are found, added, and removed from the hashtable by using the key. Hashtables may seem like arrays, but there are important differences:XPCOM Stream GuideIn Mozilla code, a stream is an object which represents access to a sequence of
characters. It is not that sequence of
characters, though: the
characters may not all be available when you read from the stream. ...
How to build a binary XPCOM component using Visual Studio
ld of XPCOM. Ok then, on with the basic, oversimplified example. Your XPCOM component is made up of 3 parts: Component interface described using IDL. The interface defines the methods, including arguments and return types, of the component. Component implementation using C++. The implementation is where the methods actually do the work. Component factory module, also in C++. The factory is in
charge of creating instances of the implementations. Let's specify a simple interface: #include "nsISupports.idl" [scriptable, uuid(263ed1ba-5cc1-11db-9673-00e08161165f)] interface ISpecialThing : nsISupports { attribute AString name; long add(in long a, in long b); }; Remember to generate your own GUID. The next step is to compile the IDL into a type-library (*.XPT) and a C++ header file (*.
NS_NewLocalFile
NS_NewLocalFile. Remarks On UNIX systems, the prefix "~/" is supported as a shorthand for the user's home directory. Example Code // Create a local file that references c:\foo.txt nsresult rv; nsCOMPtr<nsILocalFile> file; rv = NS_NewLocalFile(nsEmbedString(L"c:\\foo.txt"), PR_FALSE, getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; Note: GCC requires the -fshort-w
char option to compile this example since PRUni
char is an unsigned short. This example should compile by default under MSVC. nsEmbedString is used to convert the UCS-2
character array to an object that can be passed as a const nsAString& parameter. History This function was finalized for Mozilla 1.0. See bug 129279 for details. See Also nsILocalFile, nsIFile ...
Append
<< XPCOM API Reference Summary The Append family of functions appends a value to the end of a string's internal buffer. void Append( const self_type& aString ); Parameters aString [in] A nsACString to append to this string. void Append( const
char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters aData [in] A raw
character array to append to 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. void Append(
char_type a
Char ); Parameters a
Char [in] A
character to append to this string. Remarks If insufficient memory is available to perform the assignment, then the string's internal buffer will point to...
Assign
<< XPCOM API Reference Summary The Assign family of functions sets the value of a string's internal buffer. void Assign( const self_type& aString ); Parameters aString [in] A nsACString to copy into this string. void Assign( const
char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters 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. void Assign(
char_type a
Char ); Parameters a
Char [in] The
character to copy into this string. Remarks If insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static ...
operator=
<< XPCOM API Reference Summary This operator is a shortcut for the Assign family of functions. self_type& operator=( const self_type& aString ); Parameters aString [in] A nsACString to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const
char_type* aData ); Parameters aData [in] A raw
character array to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=(
char_type a
Char ); Parameters a
Char [in] A
character to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. See Also ...
operator+=
<< XPCOM API Reference Summary This operator+= is a shortcut for the Append family of functions. self_type& operator+=( const self_type& aString ); Parameters aString [in] A nsACString to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( const
char_type* aData ); Parameters aData [in] A raw
character array to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=(
char_type a
Char ); Parameters a
Char [in] A
character to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. Se...
Append
<< XPCOM API Reference Summary The Append family of functions appends a value to the end of a string's internal buffer. void Append( const self_type& aString ); Parameters aString [in] A nsAString to append to this string. void Append( const
char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters aData [in] A raw
character array to append to 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. void Append(
char_type a
Char ); Parameters a
Char [in] A
character to append to this string. Remarks If insufficient memory is available to perform the assignment, then the string's internal buffer will point to ...
Assign
<< XPCOM API Reference Summary The Assign family of functions sets the value of a string's internal buffer. void Assign( const self_type& aString ); Parameters aString [in] A nsAString to copy into this string. void Assign( const
char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters 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. void Assign(
char_type a
Char ); Parameters a
Char [in] The
character to copy into this string. Remarks If insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static e...
operator=
<< XPCOM API Reference Summary This operator= is a shortcut for the Append family of functions. self_type& operator+=( const self_type& aString ); Parameters aString [in] A nsAString to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const
char_type* aData ); Parameters aData [in] A raw
character array to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=(
char_type a
Char ); Parameters a
Char [in] A
character to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. See Also...
operator+=
<< XPCOM API Reference Summary This operator+= is a shortcut for the Append family of functions. self_type& operator+=( const self_type& aString ); Parameters aString [in] A nsAString to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( const
char_type* aData ); Parameters aData [in] A raw
character array to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=(
char_type a
Char ); Parameters a
Char [in] A
character to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. ...
get
<< XPCOM API Reference Summary The get function returns a const pointer to the string's null-terminated, internal buffer. ...
nsEmbedCString
Parameters aString [in] A nsEmbedCString to copy into this string. nsEmbedCString( const abstract_string_type& aAbstractString ); Parameters aAbstractString [in] A nsACString to copy into this string. explicit nsEmbedCString( const abstract_string_type& aAbstractString ); Parameters aAbstractString [in] A nsACString to copy into this string. explicit nsEmbedCString( const
char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters 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. Remarks The default constructor sets the string's internal buffer to point to a stat...
operator=
this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const abstract_string_type& aString ); Parameters aString [in] A nsACString to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const
char_type* aData ); Parameters aData [in] A raw
character array to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=(
char_type a
Char ); Parameters a
Char [in] A
character to append to this string. Return Values This operator returns a reference back to the object being modified to allow...
get
<< XPCOM API Reference Summary The get function returns a const pointer to the string's null-terminated, internal buffer. const
char_type* get() const; Example Code void GetBar(nsAString &result); void Func() { nsEmbedString str; GetBar(str); const PRUni
char *data = str.get(); ... } ...
nsEmbedString
); Parameters aString [in] A nsEmbedString to copy into this string. nsEmbedString( const abstract_string_type& aAbstractString ); Parameters aAbstractString [in] A nsAString to copy into this string. explicit nsEmbedString( const abstract_string_type& aAbstractString ); Parameters aAbstractString [in] A nsAString to copy into this string. explicit nsEmbedString( const
char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters 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. Remarks The default constructor sets the string's internal buffer to point to a stat...
operator=
this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const abstract_string_type& aString ); Parameters aString [in] A nsAString to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const
char_type* aData ); Parameters aData [in] A raw
character array to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=(
char_type a
Char ); Parameters a
Char [in] A
character to append to this string. Return Values This operator returns a reference back to the object being modified to allow...
IAccessibleEditableText
ed in conjunction with the IAccessibleText interface and complements that interface with the additional capability of clipboard operations. Note that even a read only text object can support the copy capability so this interface is not limited to editable objects. The substrings used with this interface are specified as follows: If startOffset is less than endOffset, the substring starts with the
character at startOffset and ends with the
character just before endOffset. If endOffset is lower than startOffset, the result is the same as a call with the two arguments exchanged. The whole text can be defined by passing the indices zero and IAccessibleText.n
Characters(). If both indices have the same value, an empty string is defined. Refer to the @ref _specialOffsets "Special Offsets for use in t...
imgIDecoder
operation. You should always pass null as the first two parameters of the notification APIs. writeFrom() Writes data into the stream from an input stream. Implementer's note: This method is defined by this interface in order to let the output stream efficiently copy the data from the input stream into its internal buffer (if any). If this method was provided as an external facility, a separate
char * buffer would need to be used in order to call the output stream's other write() method. unsigned long writeFrom( in nsIInputStream inStr, in unsigned long count ); Parameters inStr The stream from which to read the encoded image data. count The maximum number of bytes to write to the image. Return value The number of bytes actually written to the image, or undefined if an...
mozIStorageConnection
you if you erroneously attempt to execute it synchronously. createTable() This method creates a table with the given table name and schema. void createTable( in string aTableName, in string aTableSchema ); Parameters aTableName The name of the table to create; table names may consist of the letters A-Z in either upper or lower case, the underscore, and the digits 0-9. The first
character must be a letter. aTableSchema The table's schema. This should be specified using the same syntax the CREATE TABLE statement uses. For example: "foo INTEGER, bar STRING". Exceptions thrown NS_ERROR_FAILURE Table already exists or the requested table couldn't be created. executeAsync() Asynchronously executes an array of queries created with this connection, using any currently bou...
nsIAccessibleHyperLink
wn NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. endIndex long The end offset of the hyperlink accessible within the parent accessible. The returned value is related to the nsIAccessibleHyperLink interface of the object that owns this hyperlink. Read only. Note: The link itself is represented by one embedded
character within the parent text, so the endIndex should be startIndex + 1. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. selected boolean Determines whether the element currently has the focus, for example after returning from the destination page. Read only. Note: ARIA links can only be ...
nsIAutoCompleteInput
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. selectTextRange() Selects a range of text in the autocomplete text field. void selectTextRange( 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. ...
nsICommandLineHandler
ribute Type Description helpInfo AUTF8String When the application is launched with the -help argument, this attribute is retrieved and displayed to the user (on stdout). The text should have embedded newlines which wrap at 76 columns, and should include a newline at the end. By convention, the right column which contains flag descriptions begins at the 24th
character. Read only. Methods handle() Processes a command line. If this handler finds arguments that it understands, it should perform the appropriate actions (such as opening a window), and remove the arguments from the command-line array. void handle( in nsICommandLine aCommandLine ); Parameters aCommandLine Command line to process. See also nsICommandLine Chrome: C...
nsIConsoleService
use real URL. You may pass null if it's not applicable. aSourceLine -- the line #aLineNumber from aSourceName file. You are responsible for providing this line. You may pass null if you are lazy; this will prevent the source line showing in the Error Console. aLineNumber and aColumnNumber -- specify the exact location of an error. aColumnNumber is used to draw the arrow pointing to the problem
character. aFlags -- one of flags declared in nsIScriptError. At the time of writing, possible values are: nsIScriptError.errorFlag = 0 nsIScriptError.warningFlag = 1 nsIScriptError.exceptionFlag = 2 and nsIScriptError.strictFlag = 4. aCategory -- a string indicating what kind of code caused the error message. There are quite a few category strings and they do not currently seem ...
nsIDOMXULLabeledControlElement
dom/interfaces/xul/nsIDOMXULLabeledControlEl.idlScriptable This interface is used as a basis for labeled control elements in XUL. Inherits from: nsIDOMXULControlElement Last changed in Gecko 1.7 Attributes Attribute Type Description accessKey DOMString 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 for the element. When the user presses the appropriate modifier and the access key, the element will be focused and/or activated from anywhere in the window. On non-Macintosh platforms, the
character on the element's label matching the access key is underlined. Note: The access key is copied to any associated label element. command DOMString This property reflects the element's command attribute.
nsIDownload
ownload and a public one might have identical ids. Can only be safely used for direct database manipulation in the database that contains this download. Use the guid property instead for safe, database-agnostic searching and manipulation. Read only. Deprecated since Gecko 19.0 guid AString The guid of the download that is stored in the database. Has the form of twelve alphanumeric
characters. Read only. MIMEInfo nsIMIMEInfo Provides the targets relevant MIME information, including its MIME type, helper application, and whether or not the helper should be executed automatically once the download is complete. Read only. Optional percentComplete long The percentage of the file transfer that has been completed, or -1 if the file's size is unknown. Re...
nsIFeedTextConstruct
aining the text and markup. plainText() Returns the text as plain text with all markup stripped and all entities decoded. AString plainText(); Parameters None. Return value The plain text version of the text construct's contents. If the type attribute is "text", this method returns the value of the text attribute unchanged. Remarks If the document type is either "html" or "xhtml", a "<"
character represents markup. To display that
character, an escape such as "<" must be used. If the type is "text", the "<"
character represents itself. See also nsIDOMElement nsIDocumentFragment Interwiki link ...
nsIHttpChannel
e code (For example 200). Read only. Exceptions thrown NS_ERROR_NOT_AVAILABLE If called before the response has been received (before onStartRequest()). responseStatusText ACString Get the HTTP response status text (For example "OK"). Note: This returns the raw (possibly 8-bit) text from the server. There are no assumptions made about the
charset of the returned text. You have been warned! Read only. Exceptions thrown NS_ERROR_NOT_AVAILABLE If called before the response has been received (before onStartRequest()). referrerPolicy Read only unsigned long The referrer policy in use for this channel, indicated by one of the constants listed above Methods getOriginalResponseHe...
nsIIDNService
urns true if the specified string is ACE encoded; otherwise, returns false. normalize() Performs the Unicode normalization needed for hostnames in IDN. This is useful if you need to normalize a hostname separately from converting it to display format. AUTF8String normalize( in AUTF8String input ); Parameters input The hostname to normalize. Return value The normalized hostname. See also IDN
Charter IDN site IDNA specification ...
nsILocale
rview AString getCategory(in AString category); Methods getCategory() Retrieves a string with the current locale name. AString getCategory( in AString category ); Parameters category A string representing the category to retrieve the locale for. Valid strings are stored in nsILocale.idl. Currently those are: NSILOCALE_COLLATE - Collation order. How strings are sorted. NSILOCALE_CTYPE -
Character classification and case conversion. NSILOCALE_MONETARY - Monetary formatting. NSILOCALE_NUMERIC - Numeric, non-monetary formatting. NSILOCALE_TIME - Date and time formats. NSILOCALE_MESSAGES - Related to fonts,
character encodings and so on. Return value The locale code to be used for the given category. A locale code is of the form language[-COUNTRY[-region]], where "language" is an ISO ...
nsIMemoryReporter
Thunderbird 7.0 / SeaMonkey 2.4), and its type was long long. description AUTF8String A human-readable description of this memory usage report. Read only. kind PRInt32 The memory kind, one of the Memory reporter kind constants below. Read only. path AUTF8String The path that this memory usage should be reported under. Paths are delimited with '/'
characters to allow a hierarchy of memory to be displayed in about:memory. As of Gecko 6.0, the path should start with "explicit/" if the memory report accounts for all memory reported under sub-paths. Read only. process ACString The name of the process containing this reporter. Each reporter starts with an empty string for this value, indicating that it applies to the current process; ...
nsIMsgDBHdr
lue here will have been decoded by the mime converter service. mime2DecodedSubject AString Readonly: Indicates the subject of this message. The value here will have been decoded by the mime converter service. mime2DecodedRecipients AString Readonly: Indicates the recipients of this message. The value here will have been decoded by the mime converter service.
Charset string Indicates the
character set of this message. This value is extracted from the Content-Type header. label nsMsgLabelValue Indicates one of the old 5 label values used by old versions. New code should use keywords instead. accountKey string Indicates the account that was originally used to fetch the message. May be blank if the message has not been move...
nsIMsgWindow
ane. You should not store this in a global variable. notificationCallbacks nsIInterfaceRequestor These are currently used to set notification callbacks on protocol channels to handle things like bad cert exceptions. promptDialog nsIPrompt Readonly: This is the equivalent of calling GetInterface on the rootDocShell object. mail
CharacterSet ACString This is used to track the
character set of the currently displayed message. If set to an alias, the actual
character set is returned.
charsetOverride boolean Remember the message's
charset was overridden, so it can be inherited (e.g for quoting). stopped boolean Check if a running url been stopped. If you are che...
nsIParserUtils
s sanitized. Methods convertToPlainText() Converts HTML to plain text. AString convertToPlainText( in AString src, in unsigned long flags, in unsigned long wrapCol ); Parameters src The HTML source to parse (C++ callers are allowed but not required to use the same string for the return value.) flags Conversion option flags defined in nsIDocumentEncoder. wrapCol Number of
characters per line; 0 for no auto-wrapping. Return value The plain text conversion of the HTML specified in src. parseFragment() Parses markup into a sanitized document fragment. nsIDOMDocumentFragment parseFragment( in AString fragment, in unsigned long flags, in boolean isXML, in nsIURI baseURI, in nsIDOMElement element ); Parameters fragment The input markup. flags Sanitiza...
nsIPrefLocalizedString
data wstring Provides access to string data stored in this property. Methods setDataWithLength() Used to set the contents of this object. void setDataWithLength( in unsigned long length, [size_is(length)] in wstring data ); Parameters length The length of the string. This value should not include space for the null terminator, nor should it account for the size of a
character. It should only be the number of
characters for which there is space in the string. data The string data to be stored. toString() Used to retrieve the contents of this object into a wide string. Note: This makes a copy of the string argument passed in. wstring toString(); Parameters None. Return value Returns wstring - The string containing the data stored within this object. ...
nsIProcess2
s runAsync() Asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running. void runAsync( [array, size_is(count)] in string args, in unsigned long count, in nsIObserver observer, Optional in boolean holdWeak Optional ); Parameters args An array of arguments to pass into the process, using the native
character set. This array must have count entries. count The number of arguments passed in the args array. observer Optional An observer that will be notified when the process exits. The observer will receive this nsIProcess2 instance as the subject and "process-finished" or "process-failed" as the topic. The observer will be notified on the main thread. holdWeak Opt...
nsIPromptService
ts/windowwatcher/public/nsIPromptService.idlScriptable This interface can be used to display simple dialogs. Its methods should be used in privileged code instead of DOM window.alert, window.confirm, and other similar functions. Inherits from: nsISupports Last changed in Gecko 1.7.5 You can define access keys (or keyboard shortcuts) for buttons by including an ampersand ("&") in front of the
character that should be the access key for that button. If you need to include an ampersand in the button's text, use two of them, like this: "&&". Note: Some of these interface methods use out and inout parameters. In C++, out parameters are pointers. For JavaScript, they are extra work, as you can't use an out parameter directly. You need to wrap them in a temporary object, which can be either em...
nsIScriptError2
e. sourceLine The line number in the source file on which the error occurred. You are responsible for providing that line. You may pass null if you are lazy; that will prevent showing the source line in JavaScript Console. lineNumber The number of the line where the error occurred. columnNumber The column number where the error occurred. This is used to draw an arrow pointing to the problem
character. flags One of the script error flag constants. category A string indicating what kind of code caused the message. There are quite a few category strings and they don't seem to be listed in a single place. See Categories for a partial list. innerWindowID The ID of the inner window associated with the error. Prior to Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6), this was th...
nsISelection
tend()" } "move" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed() selection. "extend()" leaves the start of the selection unchanged, and applies movement direction/granularity to the end of the selection. direction Can be one of { "forward", "backward", "left", "right" } granularity Can be one of { "
character", "word", "line", "lineboundary" } removeAllRanges() Removes all nsIDOMRanges from the current selection. void removeAllRanges(); Parameters None removeRange() Removes a range from the current selection. void removeRange( in nsIDOMRange range ); Parameters range selectAllChildren() Adds all children of the specified node to the selection. void selectAllChildren( in nsIDOMNode pa...
nsISelection3
e one of { "move", "extend" } "move" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed selection. "extend" leaves the start of the selection unchanged, and applies movement direction/granularity to the end of the selection. direction Can be one of { "forward", "backward", "left", "right" } granularity Can be one of { "
character", "word", "line", "lineboundary" } See also nsISelection ...
nsISmsService
the message. timestamp A Date object with the timestamp of the message. read A Boolean indicating whether a message is marked as read or unread. Return value A SmsMessage getNumberOfMessagesForText() unsigned short getNumberOfMessagesForText( in DOMString text ); Parameters text A DOMString text to check. Return value The number of multi-part SMS needed for a given text (160
characters for one SMS). hasSupport() Checks if the current platform has SMS support. boolean hasSupport(); Return value Boolean. send() void send( in DOMString number, in DOMString message, in long requestId, in unsigned long long processId Optional ); Parameters number A DOMString with a telephone number to send to. message A DOMString with the text message. requestId Missi...
nsISound
e that allows the user to enter data, such as an authentication dialog) is opened. EVENT_SELECT_DIALOG_OPEN 4 A select dialog (one that contains a list box) is opened. EVENT_MENU_EXECUTE 5 A menu item is executed. EVENT_MENU_POPUP 6 A popup menu is shown. EVENT_EDITOR_MAX_LEN 7 More
characters than the maximum allowed are typed into a text field. Methods beep() Plays a beep sound. void beep(); Parameters None. init() Not strictly necessary, but avoids a delay before the first sound. Other methods will call Init if they need to. void init(); Parameters None. play() Plays a sound specified by URL. void play( in nsIURL aURL ); Parameters aURL The URL of...
nsIStringBundleService
ly used to format a message received by a nsIProgressEventSink's onStatus method. wstring formatStatusMessage( in nsresult aStatus, in wstring aStatusArg ); Parameters aStatus The status code. This is mapped into a string ID and and used in the string lookup process (see nsIErrorService). aStatusArg The status message argument(s). Multiple arguments can be separated by newline ('\n')
characters. Return value The formatted message. See also Code snippets : Miscellaneous : Using string bundles from JavaScript How to localize html pages, xul files, and js/jsm files from bootstrapped add-ons. The localizing js/jsm files uses the nsIStringBundleService: Bootstrapped Extensions :: Localization (L10n) nsIStringBundle ...
nsISupportsCString
Inherits from: nsISupportsPrimitive Last changed in Gecko 1.2 Method overview string toString(); Attributes Attribute Type Description data ACString Provides access to the native type represented by the object. Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. Remarks This interface was frozen for Gecko 1.2. ...
nsISupportsString
Inherits from: nsISupportsPrimitive Last changed in Gecko 1.2 Method overview string toString(); Attributes Attribute Type Description data AString Provides access to the native type represented by the object. Methods toString() This methods returns a string valued representation of the object. string toString(); Parameters None. Return value A string valued representation of the object. ...
nsIURIFixup
ookup service to complete the URI. The fixup object implementer should honour this flag and only perform any lengthy keyword (or search) operation if it is set. FIXUP_FLAGS_MAKE_ALTERNATE_URI 2 Tell the fixup to make an alternate URI from the input URI, for example to turn foo into www.foo.com. FIXUP_FLAG_USE_UTF8 4 Use UTF-8 to encode the URI instead of the platform
character set. FIXUP_FLAG_FIX_SCHEME_TYPOS 8 Fix common scheme typos. Methods createExposableURI() Converts an internal URI (for example a WYSIWYG URI) into one which we can expose to the user, for example on the URL bar. nsIURI createExposableURI( in nsIURI aURI ); Parameters aURI The URI to be converted. Return value The converted, exposable URI, as an nsIURI. E...
nsIURLFormatter
toolkit/components/urlformatter/public/nsIURLFormatter.idlScriptable This interface exposes methods to substitute variables in URL formats. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Variable names can contain 'A-Z' letters and '_'
characters. Mozilla applications linking to Mozilla websites are strongly encouraged to use URLs of the following format: http[s]://%SERVICE%.mozilla.[com|org]/%LOCALE%/ Method overview AString formatURL(in AString aFormat); AString formatURLPref(in AString aPref); Methods formatURL() Formats a string URL. The set of known variables is predefined. If a variable is unknown, it is left unchanged and a non-fatal error is report...
nsIWebBrowserPersist
if neither is specified, the platform default format is used. ENCODE_FLAGS_NOSCRIPT_CONTENT 2048 For plain text output. Output the content of noscript elements. ENCODE_FLAGS_NOFRAMES_CONTENT 4096 For plain text output. Output the content of noframes elements. ENCODE_FLAGS_ENCODE_BASIC_ENTITIES 8192 Encode basic entities, for example output instead of
character code 0xa0. The basic set is just & < > " for interoperability with older products that don't support ? and friends. ENCODE_FLAGS_ENCODE_LATIN1_ENTITIES 16384 Encode Latin1 entities. This includes the basic set and accented letters between 128 and 255. ENCODE_FLAGS_ENCODE_HTML_ENTITIES 32768 Encode HTML4 entities. This includes the basic set, accented letters, ...
nsIWebProgressListener
g) { let win = aWebProgress.DOMWindow; let outerWindowID = win.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils) .outerWindowID; sendAsyncMessage("MyAddonMessage", { name: "onLocationChange", outerWindowID: outerWindowID, uri: aURI.spec,
charSet: aURI.
charSet, flag: aFlag, }); }, // For definitions of the remaining functions see related documentation onProgressChange: function(aWebProgress, aRequest, curSelf, maxSelf, curTot, maxTot) {}, onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {}, onSecurityChange: function(aWebProgress, aRequest, aState) {} } let filter = Cc["@moz...
nsIWifiAccessPoint
) Attributes Attribute Type Description mac ACString The WiFi access point's MAC address. This string is in the format "XX-XX-XX-XX-XX-XX". Read only. rawSSID ACString The public name of the wireless network, as an ASCII string. This string is null if not available. Read only. Note: This string consists of the bytes as received from the network and may contain nulls and other unprintable
characters; if you need to display the SSID, use the ssid attribute instead. signal long The current signal strength in dBm. Read only. ssid AString The access point's public wireless network name, as an ASCII string. This string is null if not available. Read only. Note: This is a conversion of the SSID into a "displayable" string. For comparisons, you should instead use the rawSSID attribute. ...
nsIWindowWatcher
rn nsISupports objects which can be nsISupports.QueryInterface() (QueryInterfaced) to an nsIDOMWindow. openWindow() Creates a new window. It will automatically be added to our list. Note: This method may examine the Javascript context stack for purposes of determining the security context to use for the search for a given window named aName. Note: This method will try to set the default
charset for the new window to the default
charset of aParent. This is not guaranteed, however. Note: This method may dispatch a "toplevel-window-ready" notification via nsIObserverService if the window did not already exist. Note: Supported nsISupportsPrimitive objects will be reflected into window.arguments as the base type, however ID, void and 64-bit primitive types are not currently supp...
nsIXPConnect
t when a scripted caller whose filename starts with filenamePrefix accesses a wrapped native that is not flagged as "system", the wrapped native will be automatically wrapped with an XPCNativeWrapper. void flagSystemFilenamePrefix( in string aFilenamePrefix, in PRBool aWantNativeWrappers ); Parameters aFilenamePrefix The UTF-8 filename prefix to match, which should end with a slash (/)
character. aWantNativeWrappers Whether XPConnect should produce native wrappers for scripts whose paths begin with this prefix. Exceptions thrown Missing Exception Missing Description GarbageCollect() Trigger a JS garbage collection. void GarbageCollect(); Parameters None. Exceptions thrown Missing Exception Missing Description getCaller() Return the caller object of the current...
nsIXULAppInfo
ad only. ID ACString The XUL application's UUID. Can be an empty string, if id is not set. Has to be defined for advanced application features such as the extension manager and update service. This has traditionally been in the form "{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}" but for new applications a more readable form is encouraged: "appname@vendor.tld". Only the following
characters are allowed: a-z A-Z 0-9 - . @ _ { } * Read only. name ACString The name of the application. This must be ASCII, and is normally mixed-case, for example "Firefox", "Thunderbird" or "SeaMonkey". Must not be null or an empty string. Read only. platformBuildID ACString The build ID/date of Gecko and the XULRunner platform. Read only. platformVersion AC...
nsMsgSearchValue
+ typedef struct nsMsgSearchValue { nsMsgSearchAttribValue attribute; union { nsMsgPriorityValue priority; PRTime date; PRUint32 msgStatus; /* see MSG_FLAG in msgcom.h */ PRUint32 size; nsMsgKey key; PRInt32 age; /* in days */ nsIMsgFolder *folder; nsMsgLabelValue label; PRUint32 junkStatus; PRUint32 junkPercent; } u;
char *string; } nsMsgSearchValue; ...
XPCOM primitive
RUint64;1 [scriptable, uuid(e13567c0-4a1c-11d3-9890-006008962422)] interface nsISupportsPRUint64 : nsISupportsPrimitive { attribute PRUint64 data; string toString(); }; PRTime nsISupportsPRTime @mozilla.org/supports-PRTime;1 [scriptable, uuid(e2563630-4a1c-11d3-9890-006008962422)] interface nsISupportsPRTime : nsISupportsPrimitive { attribute PRTime data; string toString(); };
char nsISupports
Char @mozilla.org/supports-
char;1 [scriptable, uuid(e2b05e40-4a1c-11d3-9890-006008962422)] interface nsISupports
Char : nsISupportsPrimitive { attribute
char data; string toString(); }; PRInt16 nsISupportsPRInt16 @mozilla.org/supports-PRInt16;1 [scriptable, uuid(e30d94b0-4a1c-11d3-9890-006008962422)] interface nsISupportsPRInt16 : nsISupportsPrimitive { attribute PRInt16 d...
XPCOM Interface Reference by grouping
eedProgressListener nsIFeedResult nsIFeedResultListener nsIFeedTextConstruct script mozIJSSubScriptLoader storage mozIStorageVacuumParticipant Util nsIEffectiveTLDService Worker nsIAbstractWorker Data nsIArray nsICategoryManager nsICollection nsIDictionary nsIMutableArray nsISimpleEnumerator nsISupports
Char nsISupportsDouble nsISupportsFloat nsISupportsID nsISupportsInterfacePointer nsISupportsPRBool nsISupportsPrimitive nsISupportsPRInt16 nsISupportsPRInt32 nsISupportsPRInt64 nsISupportsPriority nsISupportsPRTime nsISupportsPRUint16 nsISupportsPRUint32 nsISupportsPRUint64 nsISupportsPRUint8 nsISupportsString nsISupportsVoid nsI...
NS_CStringCloneData
Return Values The NS_CStringCutData function returns a pointer to a null-terminated, heap allocated buffer on success. On failure it returns nsnull. ...
NS_CStringCutData
rn 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_CStringSetDataRange . 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 239123 for details. See Also NS_CStringSetDataRange , nsACString ...
NS_StringCloneData
Return Values The NS_StringCutData function returns a pointer to a null-terminated, heap allocated buffer on success. On failure it returns nsnull. ...
NS_UTF16ToCString
encoding and stores the result in a nsACString instance. #include "nsStringAPI.h" nsresult NS_UTF16ToCString( const nsAString& aSrc, nsCStringEncoding aDestEncoding, nsACString& aDest ); Parameters aSrc [in] A nsAString instance containing the source UTF-16 string to be converted. The source string should be encoded using the host byte order. aDestEncoding [in] The
character encoding of the destination string. See nsCStringEncoding for the set of values that can be passed for this parameter. aDest [out] A nsACString instance that will contain the result of the conversion. Return Values The NS_UTF16ToCString function returns NS_OK if successful. Otherwise, it returns an error code. The set of possible error codes is currently unspecified. Example Code ...
nsStaticModuleInfo
Summary This data structure is used by NS_InitXPCOM3 to specify static XPCOM modules. #include "nsXPCOM.h" struct nsStaticModuleInfo { const
char* name; nsGetModuleProc getModule; }; Members name This member provides the name of the module as a null-terminated, ASCII-valued
character array. getModule This member provides a function pointer of type nsGetModuleProc that returns a nsIModule instance. ...
Using the clipboard
nicode string. Then, the function setTransferData is called which copies the data from the string into the transferable. This function takes three parameters. The first is the flavor we are setting, the second is the object holding the string, and the third is the length of the data, in bytes. Here, the length is multiplied by two because we are using a Unicode string which requires two bytes per
character. You can repeat the last two lines and call addDataFlavor and setTransferData for multiple flavors. That way, you could have a text version and an HTML version of the content. The Transferable object will hold its own copy of the data. When you've added all the flavors you want, you can put it all on the clipboard at once. The transferable object will hold all of the data that you want unti...
Xptcall Porting Status
d this code was given the OK. I consider it "done". This code lives in the files where the name includes 'alpha' in the win32 directory. <font color="white">Done</font> Linux ARM Stefan Hanske<sh990154@mail.uni-greifswald.de> <font color="red">?</font> Matthew Wilcox <willy@bofh.ai> Stefan's code is checked in and he says it is working. <font color="white">Done</font> Linux Sparc Anton Blan
chard <anton@progsoc.uts.edu.au>, Roger Lawrence <rogerl@netscape.com>, Brandon Ehle <ehle.3@osu.edu> Anton contributed patches to Roger's Sparc code. Anton says it works and passes the tests! (24-Aug-1999) Brandon writes: I've finished testing XPTCALL Sparc Linux on 12 different Sparc machines and it checks out good. <font color="white">Done</font> Linux PPC Patrick Beard <beard@netscape.com> ...
Address book sync client design
Pizzarro <rhp@netscape.com> Contents Overview Client Side Sync Logic Public Interfaces Overview There is an component available in the mozilla tree for performing synchronization operations against a server based address book. ...
Autoconfiguration in Thunderbird
this ip! DocumentRoot /var/www/autoconfig/ ServerName autoconfig.hoster.com <Directory /var/www/autoconfig> Order allow,deny allow from all </Directory> </VirtualHost> Place the configuration file at the URL /mail/config-v1.1.xml on that host. All config files must be served as Content-Type: text/xml (or application/xml), otherwise the file will be ignored. Also, they must use
charset UTF-8 (esp. if there are any non-ASCII-
characters). If you like to use name-based virtual hosts you probably don't want to setup the autoconfig subdomain for every domain of your customers. You can add a Rewriterule in the default virtual host (on debian /etc/apache2/sites-enabled/000-default) to match all autoconfig.* subdomains: <VirtualHost *:80> #Must be the first Virtual host ServerA...
Filelink Providers
r a provider are saved using the Preferences API. Saving the preferences is handled automatically by the dialog code. Providers need only provide an extraArgs function in the IFrame content which returns an object specifying the name, type, and value to save. The format for the returned object is: { FIELD_NAME: {type: FIELD_TYPE, value: FIELD_VALUE} } Where FIELD_TYPE is "int", "bool", or "
char". For example, the Hightail implementation provides the following function: function extraArgs() { var usernameValue = document.getElementById("username").value; return { "username": {type: "
char", value: usernameValue}, }; } In this example, the username value is read from the input, and then the specially-crafted object is returned. Once this is done, the field is accessible from...
MailNews fakeserver
s response or nothing Called when in multi-line mode. postCommand Server object none Called after every command. The server is smart about the responses and will normalize all occurrences of '\n' (but not '\r') to '\r\n' for you, as well as append the '\r\n' to the response if not present. It will also properly queue all messages sent in pipelining mode and will present lines without any EOL
characters. In addition, it uses UTF-8 as the transmission medium. The server presents the following API to the handler: <caption> Server API </caption> Name Arguments Returns Description closeSocket none nothing Closes the socket and stops the test. setMultiline the new value of multiline nothing The value is a boolean, with true invoking multiline mode. It is off by default. Extending a ha...
The libmime module
Pizzarro <rhp@netscape.com> This module, libmime, implements a general-purpose MIME parser. One of the methods provided by this parser is the ability to emit an HTML representation of the data stream. The parser is object-oriented. There is a class for each MIME type, and each class is responsible for parsing itself, and/or handing the input data off to one of its child objects. The definition of these classes is somewhat idiosyncratic and consists of an internally defined object system, instead of C++. ...
Thunderbird Configuration Files
ext editor, such as Notepad on Windows and gedit or kate on Linux. Locate your profile folder Before the configuration files are presented, you should know how to find your profile folder, which is where Thunderbird saves all your settings on your hard drive. On Windows Vista/XP/2000, the path is usually %AppData%\Thunderbird\Profiles\xxxxxxxx.default\, where xxxxxxxx is a random string of 8
characters. Just browse to C:\Documents and Settings\[User Name]\Application Data\Thunderbird\Profiles\ on Windows XP/2000 or C:\users\[User Name]\AppData\Roaming\Thunderbird\Profiles\ on Windows Vista, and the rest should be obvious. On Windows 95/98/Me, the path is usually C:\WINDOWS\Application Data\Thunderbird\Profiles\xxxxxxxx.default\ On Linux, the path is usually ~/.thunderbird/xxxxxxxx.defau...
Get Thunderbird version
for < 3.0b4 For versions prior to 3.0b3pre, you can use something like this: var version; if ( "@mozilla.org/xre/app-info;1" in Components.classes ) version = Components.classes["@mozilla.org/xre/app-info; 1"].getService(Components.interfaces.nsIXULAppInfo).version; else version = Components.classes["@mozilla.org/preferences-service; 1"].getService(Components.interfaces.nsIPrefBranch).get
CharPref ("app.version"); var versionChecker = Components.classes["@mozilla.org/xpcom/version- comparator;1"].getService(Components.interfaces.nsIVersionComparator); if ( versionChecker.compare( version, "3.0b3" ) >= 0 ) // code for >= 3.0b3 else // code for < 3.0b3 ...
Toolkit version format
ormats below for description of the older version format used in Firefox/Thunderbird 1.0. Version format A version string consists of one or more version parts, separated with dots. Each version part is itself parsed as a sequence of four parts: <number-a><string-b><number-c><string-d>. Each of the parts is optional. Numbers are integers base 10 (may be negative), strings are non-numeric ASCII
characters. A few examples of valid version parts: 0 (as in 1.0): <number-a>=0 5a (as in 1.5a): <number-a>=5, <string-b>=a 5pre4 (as in 3.5pre4): <number-a>=5, <string-b>=pre, <number-c>=4 * (as in 1.0.*): <string-b>=* A few special parsing rules are applied for backwards compatibility and readability: if the version part is a single asterisk, it is interpreted as an infinitely-large numbe...
Using the Mozilla symbol server
mbol path of your debugging tool. In the examples below, a local cache directory is used to avoid repeatedly fetching the PDB from the server. Replace C:\Users\bsmedberg\symbols with an appropriate cache directory on your machine. Using the symbol server in Microsoft Visual C++ Using the symbol server in Windbg The Windbg symbol path is configured with a string value delimited with asterisk
characters. To use only the Mozilla symbol server, add the following entry to your symbol path (note: you can replace c:\symcache\ with any writable directory on your computer, if you'd prefer a different location for downloaded symbols): SRV*c:\symcache\*https://symbols.mozilla.org/ Set this string as _NT_SYMBOL_PATH in the environment, using the Windbg menus, or by typing the .sympath command. If...
WebIDL bindings
ose is the responsibility of the caller. For example, this WebIDL: dictionary Dict { long foo = 5; DOMString bar; }; interface Test { void initSomething(optional Dict arg = {}); }; will correspond to this C++ function declaration: void InitSomething(const Dict& arg); and the Dict struct will look like this: struct Dict { bool Init(JSContext* aCx, JS::Handle<JS::Value> aVal, const
char* aSourceDescription = "value"); Optional<nsString> mBar; int32_t mFoo; } Note that the dictionary members are sorted in the struct in alphabetical order. API for working with dictionaries There are a few useful methods found on dictionaries and dictionary members that you can use to quickly determine useful things. member.WasPassed() - as the name suggests, was a particular member pas...
Declaring and Calling Functions
eclare("clock", ctypes.default_abi, ctypes.unsigned_long); console.log("Clocks since startup: " + clock()); The clock() function requires no input parameters; it simply returns an unsigned long. Example: Multiple input parameters This example declares the libc asctime() function, which converts a time structure into a string. const asctime = lib.declare("asctime", ctypes.default_abi, ctypes.
char.ptr, struct_tm.ptr); For a more complete version of this example (including the implementation of the struct_tm type), see the structures example. Returned values If the return type can fit into a JavaScript number without loss (that is, it's a number 32 bits or smaller, or is a double or float), then the function just return a JavaScript number. For everything else it returns a ctypes object ...
StructType
ure, 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': ctypes.int}, {'userName': ctypes.
char.ptr} ] Properties Property Type Description fields CType[] A sealed array of field descriptors. Read only. Properties inherited from CType These properties are available on all CType objects. Property Type Description name String The type's name. Read only. For primitive types, this is just the name of the correspon...
Drawing and Event Handling - Plugins
ndowless, use NPN_SetValue with NPPVpluginWindowBool as the value of variable and false as the value of value. The plug-in makes this call from its NPP_New method. If a plug-in does not make this call, it is considered a windowed plug-in. Plug-ins on Mac OS X are always windowless. NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
char *argn[],
char *argv[], NPSavedData *saved) { ... NPError result = NPN_SetValue(instance, NPPVpluginWindowBool, (void*)false); } Invalidating the Drawing Area Before it can repaint or refresh part of its drawing area, a windowless plug-in must first invalidate the area with either of these browser methods: NPN_InvalidateRect or NPN_InvalidateRegion. Both methods perform the ...
Source map errors - Firefox Developer Tools
owing sections. Source map missing or inaccessible The source map resource can be missing or inaccessible. The fix here is to make sure the file is being served and is accessible to the browser Invalid source map The source map data can be invalid -- either simply not a JSON file at all, or with an incorrect structure. Typical error messages here are: SyntaxError: JSON.parse: unexpected
character at line 1 column 1 of the JSON data Error: "version" is a required argument Original source missing An original source may be missing. You may encounter this when trying to open one of the original sources in the debugger. The message looks a little different in this case: In this case, the error will also be displayed in the source tab in the debugger: NetworkError when attempt...
Debugger.Object - Firefox Developer Tools
t a function that is debuggee code, return undefined. call(this,argument, ...) If the referent is callable, call it with the giventhis value andargument values, and return a completion value describing how the call completed.This should be a debuggee value, or { asConstructor: true } to invoke the referent as a constructor, in which case SpiderMonkey provides an appropriate this value itself. Ea
chargument must be a debuggee value. All extant handler methods, breakpoints, and so on remain active during the call. If the referent is not callable, throw a TypeError. This function follows the invocation function conventions. apply(this,arguments) If the referent is callable, call it with the giventhis value and the argument values inarguments, and return a completion value describing how the ca...
Debugger - Firefox Developer Tools
bing the error, with the following properties: message The fully formatted error message. file If present, the source file name, URL, etc. (If this property is present, theline property will be too, and vice versa.) line If present, the source line number at which the error occurred. lineText If present, this is the source code of the offending line. offset The index of the
character within lineText at which the error occurred. warning Present and true if this is a warning; absent otherwise. strict Present and true if this error or warning is due to the strict option (not to be confused with ES strict mode) exception Present and true if an exception will be thrown; absent otherwise. arguments An array of strings, representing the arguments substituted int...
Debugger-API - Firefox Developer Tools
iented API that protects the debugger from accidentally invoking getters, setters, proxy traps, and so on. A Debugger.Script represents a block of JavaScript code--either a function body or a top-level script. Given a Debugger.Script, one can set breakpoints, translate between source positions and bytecode offsets (a deviation from the "source level" design principle), and find other static
characteristics of the code. A Debugger.Frame represents a running stack frame. You can use these to walk the stack and find each frame's script and environment. You can also set onStep and onPop handlers on frames. A Debugger.Environment represents an environment, associating variable names with storage locations. Environments may belong to a running stack frame, captured by a function cl...
Debugger.Object - Firefox Developer Tools
function that is debuggee code, return undefined. call(this,argument, ...) If the referent is callable, call it with the giventhis value andargument values, and return a completion value describing how the call completed.This should be a debuggee value, or { asConstructor: true } to invoke the referent as a constructor, in which case SpiderMonkey provides an appropriate this value itself. Ea
chargument must be a debuggee value. All extant handler methods, breakpoints, watchpoints, and so on remain active during the call. If the referent is not callable, throw a TypeError. This function follows the invocation function conventions. apply(this,arguments) If the referent is callable, call it with the giventhis value and the argument values inarguments, and return a completion value desc...
Dominators view - Firefox Developer Tools
de the objects are being allocated. This option is called "Allocation Stack" in Firefox 46. To enable this, you must check the box labeled "Record call stacks" before you run the code that allocates the objects. Then take a snapshot, then select "Call Stack" in the "Label by" drop-down. Now the node's name will contain the name of the function that allocated it, and the file, line number and
character position of the exact spot where the function allocated it. Clicking the file name will take you to that spot in the Debugger. Sometimes you'll see "(no stack available)" here. In particular, allocation stacks are currently only recorded for objects, not for arrays, strings, or internal structures. Retaining Paths panel The Retaining Paths panel is new in Firefox 47. The Retaining Pa...
Performance Analysis - Firefox Developer Tools
t a stopwatch icon in the main window.) The Network Monitor then loads the site twice: once with an empty browser cache, and once with a primed browser cache. This simulates the first time a user visits your site, and subsequent visits. It displays the results for each run side by side, or vertically if the browser window is narrow: The results for each run are summarised in a table and a pie
chart. The tables group resources by type, and show the total size of each resource and the total time it took to load them. The accompanying pie
chart shows the relative size of each resource type. To get back to the Network Monitor's list of network requests click the "Back" button on the left. Clicking on a slice of the pie takes you to the Network Monitor for that run, with a filter automaticall...
Throttling - Firefox Developer Tools
itor allows you to throttle your network speed to emulate various connection speeds so you can see how your app will behave under different connection types. Throttling The toolbar includes a Throttling dropdown, which allows you to throttle your network speed to emulate various different network speed conditions. Simply choose an option from the menu, and it will persist across reloads. The
characteristics emulated are: Download speed Upload speed Minimum latency The table below lists the numbers associated with each network type, but please do not rely on this feature for exact performance measurements; it's intended to give an approximate idea of the user experience in different conditions. The speeds are expressed in multiples of bits per second. Selection Download...
Call Tree - Firefox Developer Tools
a simple program as an example. If you want to get the program to experiment with your profile, you can find it here. You can find the specific profile we discuss here - just import it to the performance tool to follow along. There's a short page describing the structure of this program here. Note that we use the same program - the same profile, in fact - in the documentation page for the Flame
Chart. The screenshot below shows the output of a program that compares three sorting algorithms - bubble sort, selection sort, and quicksort. To do this, it generates some arrays filled with random integers and sorts them using each algorithm in turn. We've zoomed into the part of the recording that shows a long JavaScript marker: The Call Tree presents the results in a table. Each row represen...
Sorting algorithms comparison - Firefox Developer Tools
This program compares the performance of three different sorting algorithms: bubble sort selection sort quicksort It consists of the following functions: sortAll() Top-level function. Iteratively (200 iterations) generates a randomized array and calls sort(). sort() Calls each of bubbleSort(), selectionSort(), quickSort() in turn and logs the result. bubbleSort() Implements a bubble sort, returning the sorted array. ...
Frame rate - Firefox Developer Tools
rate are correlated with orange 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 that point: The offending function is called doPointlessComputations(), and it's defined in "main.js". To fix it, we might consider splitting it into pieces and running the pieces inside requestAnimationFrame, or even running the entire function in a worker. The Intensive JavaScript article shows how you can use strategies like this to fix responsiveness problems caus...
How to - Firefox Developer Tools
ileEnd(). Save a profile To save a profile, click the link labeled "Save" in the Recordings pane: Load a profile To load a profile, click "Import..." and choose the file: Clear all loaded profiles To clear all loaded profiles, click "Clear". ...
Intensive JavaScript - Firefox Developer Tools
f 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, when we pressed the button, the browser ran a JavaScript function, or series of functions, that blocked the main thread for 71.73ms, or more than four times our frame budget. Which function, though? By switching to the Flame
Chart view we can find out: This shows us the JS call stack at this point in the execution. At the top of the stack is a function called calculatePrimes(), and we can see its filename and line number. Here's the code, together with its immediate caller: const iterations = 50; const multiplier = 1000000000; function calculatePrimes(iterations, multiplier) { var primes = []; for (var i = 0; i <...
Responsive Design Mode - Firefox Developer Tools
view the properties of existing devices by hovering over the name in the device modal, where they display in a tooltip. Network throttling If you do all your development and testing using a very fast network connection, users may experience problems with your site if they are using a slower connection. In Responsive Design Mode, you can instruct the browser to emulate, very approximately, the
characteristics of various different types of networks. The
characteristics emulated are: Download speed Upload speed Minimum latency The table below lists the numbers associated with each network type, but please do not rely on this feature for exact performance measurements; it's intended to give an approximate idea of the user experience in different conditions. Selection Downl...
View Source - Firefox Developer Tools
t HTML is valid, you should use an HTML validator, such as the one offered by W3C. Not all parse errors are reported Even though all the reported errors are parse errors according to the HTML specification, not all parse errors are reported by View Source. Among the errors that don't get reported: Bytes that are illegal according to the document's encoding aren't marked as errors. Forbidden
characters aren't reported as errors. Errors related to the end-of-file aren't reported. Tree builder errors relating to text (as opposed to tags, comments, or doctypes) aren't reported. Parse errors related to xmlns attributes aren't reported. XML syntax highlighting View Source uses the HTML tokenizer when highlighting XML source. While the tokenizer has support for processing instructions whe...
The JavaScript input interpreter - Firefox Developer Tools
cd(frame); You can pass a CSS selector that matches the iframe: cd("#frame1"); You can pass the iframe's global window object: var frame = document.getElementById("frame1"); cd(frame.contentWindow); To switch the context back to the top-level window, call cd() with no arguments: cd(); For example, suppose we have a document that embeds an iframe: <!DOCTYPE html> <html> <head> <meta
charset="UTF-8"> </head> <body> <iframe id="frame1" src="static/frame/my-frame1.html"></iframe> </body> </html> The iframe defines a new function: <!DOCTYPE html> <html> <head> <meta
charset="UTF-8"> <script> function whoAreYou() { return "I'm frame1"; } </script> </head> <body> </body> </html> You can switch context to the iframe like this: cd("#fr...
AbstractRange.collapsed - Web APIs
The collapsed read-only property of the AbstractRange 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 AbstractRange 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 AbstractRange 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.startOffset - Web APIs
The read-only startOffset property of the AbstractRange 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. ...
AddressErrors.organization - Web APIs
tions for how to correct it. Syntax var organizationError = AddressErrors.organization; Value If the value specified in the PaymentAddress object's organization property could not be validated, this property contains a DOMString offering a human-readable explanation of the validation error and offers suggestions for correcting it. For example, if validation simply ensures that only permitted
characters are included in the organization's name, this might return a string such as "The organization name may only contain the letters A-Z, digits, spaces, and commas." If the organization value was validated successfully, this property is not included in the AddressErrors object. Specifications Specification Status Comment Payment Request APIThe definition of 'AddressEr...
AudioListener.dopplerFactor - Web APIs
by default. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.forwardX - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.forwardY - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.forwardZ - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.positionX - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.positionY - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.positionZ - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.setOrientation() - Web APIs
turns Void. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.setPosition() - Web APIs
turns Void. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.speedOfSound - Web APIs
e A double. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.upX - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.upY - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener.upZ - Web APIs
ve 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AudioListener - Web APIs
ectively. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
AuthenticatorAssertionResponse.authenticatorData - Web APIs
length) - The credential that was created. This is only present during a navigator.credentials.create() call. This is a sequence of bytes with the following format: AAGUID (16 bytes) - Authenticator Attestation Globally Unique Identifier, a unique number that identifies the model of the authenticator (not the specific instance of the authenticator) so that a relying party can understand the
characteristics of the authenticator by looking up its metadata statement. credentialIdLength (2 bytes) - The length of the credential ID that immediately follows these bytes. credentialId (variable length) - A unique identifier for this credential so that it can be requested for future authentications. The credential is "credentialIdLength" bytes long. credentialPublicKey (variable length) -...
AuthenticatorResponse.clientDataJSON - Web APIs
support token binding but did not negotiate with the relying party or "present" when token binding was used already id: A DOMString which is the base64url encoding of the token binding ID which was used for the communication. Should this property be absent, it would indicate that the client does not support token binding. ...
BaseAudioContext.createPanner() - Web APIs
PannerNode. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
BatteryManager.level - Web APIs
Indicates the current battery
charge level as a value between 0.0 and 1.0. Syntax var level = battery.level On return, level is a number representing the system's battery
charge level scaled to a value between 0.0 and 1.0. A value of 0 means the battery, which is a BatteryManager object, is empty and the system is about to be suspended. A value of 1.0 means the battery is full. A value of 1.0 is also returned if the implementation isn't able to determine the battery
charge level or if the system is not battery-powered. Example HTML Content <div id="level">(battery level unknown)</div> JavaScript Content navigator.getBattery().then(function(battery) { var level = battery.level; document.querySelector('#level').textContent = level; }); Specifications Specifi...
Blob() - Web APIs
s, or a mix of any of such objects, that will be put inside the Blob. USVString objects are encoded as UTF-8. options Optional An optional object of type BlobPropertyBag which may specify any of the following properties: type Optional The MIME type of the data that will be stored into the blob. The default value is the empty string, (""). endings Optional How to interpret newline
characters (\n) within the contents, if the data is text. The default value, transparent, copies newline
characters into the blob without changing them. To convert newlines to the host system's native convention, specify the value native. Return value A new Blob object containing the specified data. Example var aFileParts = ['<a id="a"><b id="b">hey!</b></a>']; // an array consisting of a sin...
Blob - Web APIs
= new Blob([JSON.stringify(obj, null, 2)], {type : 'application/json'}); Creating a URL representing the contents of a typed array The following code creates a JavaScript typed array and creates a new Blob containing the typed array's data. It then calls URL.createObjectURL() to convert the blob into a URL. HTML <p>This example creates a typed array containing the ASCII codes for the space
character through the letter Z, then converts it to an object URL. A link to open that object URL is created. Click the link to see the decoded object URL.</p> JavaScript The main piece of this code for example purposes is the typedArrayToURL() function, which creates a Blob from the given typed array and returns an object URL for it. Having converted the data into an object URL, it can be use...
Bluetooth - Web APIs
Bluetooth.referringDevice Read only Returns a reference to the device, if any, from which the user opened the current page. For example, an Eddystone beacon might advertise a URL, which the user agent allows the user to open. A BluetoothDevice representing the beaco...
BluetoothAdvertisingData - Web APIs
a particular Bluetooth device. Interface interface BluetoothAdvertisingData { readonly attribute unsigned short? appearance; readonly attribute byte? txPower; readonly attribute byte? rssi; readonly attribute Map manufacturerData; readonly attribute Map serviceData; }; Properties BluetoothAdvertisingData.appearance Read only Returns one of the values defined by the org.bluetooth.
characteristic.gap.appearance
characteristic. BluetoothAdvertisingData.txPower Read only Returns the transmission power at which the device is broadcasting, measured in dBm. This is used to compute the path loss as this.txPower - this.rssi. BluetoothAdvertisingData.rssi Read only Returns the power at which the device's packets are being received, measured in dBm. This is used to compute the path...
productID - Web APIs
Syntax var productID = instanceOfBluetoothDevice.productID Returns The 16-bit Product ID field. ...
productVersion - Web APIs
Syntax var productVersion = instanceOfBluetoothDevice.productVersion Returns The 16-bit Product Version field. ...
vendorID - Web APIs
Syntax var vendorID = instanceOfBluetoothDevice.vendorID Returns The the 16-bit Vendor ID field. ...
vendorIDSource - Web APIs
Syntax var vendorIDSource = instanceOfBluetoothDevice.vendorIDSource Returns The Vendor ID Source field. ...
uuid - Web APIs
Syntax var uuid = BluetoothRemoteGATTDescriptor.uuid Returns A UUID. Specifications Specification Status Comment Web BluetoothThe definition of 'uuid' in that specification. 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. ...
value - Web APIs
Specifications Specification Status Comment Web BluetoothThe definition of 'value' in that specification. Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
CDATASection - Web APIs
eight="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/
CharacterData" target="_top"><rect x="266" y="1" width="130" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="331" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">
CharacterData</text></a><polyline points="396,25 406,20 406,30 396,25" stroke="#D4DDE4" fill="none"/><line x1="406" y1="25"...
CSS Object Model (CSSOM) - Web APIs
The CSS Object Model is a set of APIs allowing the manipulation of CSS from JavaScript. It is much like the DOM, but for the CSS rather than the HTML. It allows users to read and modify CSS style dynamically. ...
CanvasRenderingContext2D.fillText() - Web APIs
The CanvasRenderingContext2D method fillText(), part of the Canvas 2D API, draws a text string at the specified coordinates, filling the string's
characters with the current fillStyle. An optional parameter allows specifying a maximum width for the rendered text, which the user agent will achieve by condensing the text or by using a lower font size. This method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. The text is rendered using the font and text layout configuration as defined by the font, textAlign, textBaseline, and direction properties. To draw the outlines of the
characters in a string, call the context's strokeText() method. Syntax CanvasRenderingContext2D.fillText(text, x, y [, maxWidth]...
CanvasRenderingContext2D.strokeText() - Web APIs
The CanvasRenderingContext2D method strokeText(), part of the Canvas 2D API, strokes -- that is, draws the outlines of -- the
characters of a text string at the specified coordinates. An optional parameter allows specifying a maximum width for the rendered text, which the user agent will achieve by condensing the text or by using a lower font size. This method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. Use the fillText() method to fill the text
characters rather than having just their outlines drawn. Syntax CanvasRenderingContext2D.strokeText(text, x, y [, maxWidth]); Parameters text A DOMString specifying the text string to render into the context. The text is rendered using the settings s...
CanvasRenderingContext2D.textBaseline - Web APIs
"top" The text baseline is the top of the em square. "hanging" The text baseline is the hanging baseline. (Used by Tibetan and other Indic scripts.) "middle" The text baseline is the middle of the em square. "alphabetic" The text baseline is the normal alphabetic baseline. Default value. "ideographic" The text baseline is the ideographic baseline; this is the bottom of the body of the
characters, if the main body of
characters protrudes beneath the alphabetic baseline. (Used by Chinese, Japanese, and Korean scripts.) "bottom" The text baseline is the bottom of the bounding box. This differs from the ideographic baseline in that the ideographic baseline doesn't consider descenders. The default value is "alphabetic". Examples Comparison of property values This example demonstr...
Drawing shapes with canvas - Web APIs
(x,y). In other words, the current pen position is automatically reset to the default coordinates. Making combinations So far, each example on this page has used only one type of path function per shape. However, there's no limitation to the number or types of paths you can use to create a shape. So in this final example, let's combine all of the path functions to make a set of very famous game
characters. <html> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></canvas> </body> </html> function draw() { var canvas = document.getElementById('canvas'); if (canvas.getContext) { var ctx = canvas.getContext('2d'); roundedRect(ctx, 12, 12, 150, 150, 15); roundedRect(ctx, 19, 19, 150, 150, 9); roundedRect(ctx, 53, 53, 49, 33, 10); roundedRect(...
CaretPosition - Web APIs
ition interface represents the caret position, an indicator for the text insertion point. You can get a CaretPosition using the document.caretPositionFromPoint method. Properties This interface doesn't inherit any properties. CaretPosition.offsetNode Read only Returns a Node containing the found node at the caret's position. CaretPosition.offset Read only Returns a long representing the
character offset in the caret position node. Methods CaretPosition.getClientRect Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'CaretPosition' in that specification. Working Draft ...
ChildNode.after() - Web APIs
ray.prototype.slice.call(arguments), docFrag = document.createDocumentFragment(); argArr.forEach(function (argItem) { var isNode = argItem instanceof Node; docFrag.appendChild(isNode ? ...
CompositionEvent.CompositionEvent() - Web APIs
or creates a new CompositionEvent object instance. Syntax const myEvent = new CompositionEvent(typeArg [, CompositionEventInit]) Values typeArg Is a DOMString representing the name of the event. CompositionEventInit Optional A CompositionEventInit dictionary object, which can contain the following members: data Initializes the data attribute of the CompositionEvent object to the
characters generated by the IME composition. Note: The CompositionEventInit dictionary inherits from the UIEventInit dictionary, so can also accept members defined on there. Specifications Specification Status Comment Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'CompositionEvent()' in that specification. Obsolete Initial defi...
FileSystemEntry - Web APIs
onError); Properties This interface provides the following properties. filesystem Read only A FileSystem object representing the file system in which the entry is located. fullPath Read only A USVString object which provides the full, absolute path from the file system's root to the entry; it can also be thought of as a path which is relative to the root directory, prepended with a "/"
character. isDirectory Read only A Boolean which is true if the entry represents a directory; otherwise, it's false. isFile Read only A Boolean which is true if the entry represents a file. If it's not a file, this value is false. name Read only A USVString containing the name of the entry (the final part of the path, after the last "/"
character). Methods This interface defines the follow...
FontFaceSet.check() - Web APIs
ll 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 Module Level 3The definition of 'chec...
FontFaceSet.load() - Web APIs
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 Font Loading Module Level 3The defin...
Using the Frame Timing API - Web APIs
ch provides timestamps for each frame including the average frame rate and the minimum and maximum rates (for a specific recording session). This data, along with the waterfall data, gives an indication of where a site might be having frame related performance problems (for example, by correlating the recording's minimum rates with their respective waterfall events). The performance tool's flame
chart and call tree tabs provide data to help analyze the site's JavaScript usage. The call tree shows where the application is spending most of its time, whereas the flame
chart shows the state of the JavaScript stack for the code at every millisecond during the performance profile. This provides a way to know exactly which function was executing at any point during the recording, how long it ran, an...
HTMLAreaElement - Web APIs
ize="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLAreaElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement, and implements those from HTMLHyperlinkElementUtils. Element.accessKey Is a DOMString containing a single
character that switches input focus to the control. HTMLAreaElement.alt Is a DOMString that reflects the alt HTML attribute, containing alternative text for the element. HTMLAreaElement.coords Is a DOMString that reflects the coords HTML attribute, containing coordinates to define the hot-spot region. HTMLAreaElement.download Is a DOMString indicating that the linked resource is intended to be...
HTMLButtonElement - Web APIs
th="2px" /><text x="406" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLButtonElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement. HTMLButtonElement.accessKey Is a DOMString indicating the single-
character keyboard key to give access to the button. HTMLButtonElement.autofocus Is a Boolean indicating whether or not the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified. HTMLButtonElement.disabled Is a Boolean indicating whether or not...
HTMLCollection - Web APIs
ment supports the name attribute. Returns null if no node exists by the given name. An alternative to accessing collection[name] (which instead returns undefined when name does not exist). This is mostly useful for non-JavaScript DOM implementations. Usage in JavaScript HTMLCollection also exposes its members directly as properties by both name and index. HTML IDs may contain : and . as valid
characters, which would necessitate using bracket notation for property access. Currently HTMLCollections does not recognize purely numeric IDs, which would cause conflict with the array-style access, though HTML5 does permit these. For example, assuming there is one <form> element in the document and its id is myForm: var elem1, elem2; // document.forms is an HTMLCollection elem1 = document.forms...
HTMLElement.dir - Web APIs
pical 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 arranged 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 the contextual menu of input fields while Internet Explorer and Edge use the key combinations Ctrl + Left Shift and Ctrl + Right Shift. Firefox uses Ctrl/Cm...
HTMLImageElement.longDesc - Web APIs
tional added details beyond the short description provided in the title attribute. Syntax descURL = htmlImageElement.longDesc; htmlImageElement.longDesc = descURL; Value A DOMString which may be either an empty string (indicating that no long description is available) or the URL of a file containing a long form description of the image's contents. For example, if the image is a PNG of a flow
chart. The longDesc property could be used to provide an explanation of the flow of control represented by the
chart, using only text. This can be used by readers both as an explanation, but also as a substitute for visually-impaired users. Usage notes This property is obsolete and should no longer be used. Instead of using longDesc to provide a link to a detailed description of an image, encapsulat...
HTMLImageElement.sizes - Web APIs
ferent media conditions. Each condition is specified using the same conditional format used by media queries. Syntax let sizes = htmlImageElement.sizes; htmlImageElement.sizes = sizes; Value A USVString containing a comma-separated list of source size descriptors followed by an optional fallback size. Each source size descriptor is comprised of a media condition, then at least one whitespace
character, then the source size value to use for the image when the media condition evaluates to true. Media conditions Each source size descriptor consists of a media condition as defined by the media queries standard. Because a source size descriptor is used to specify the width to use for the image during layout of the page, the media condition is typically (but not necessarily) based entirely on...
HTMLImageElement.srcset - Web APIs
Strings; let srcset = htmlImageElement.srcset; Value A USVString containing a comma-separated list of one or more image candidate strings to be used when determining which image resource to present inside the <img> element represented by the HTMLImageElement. Each image candidate string must begin with a valid URL referencing a non-interactive graphic resource. This is followed by a comma (,)
character and then a condition descriptor that indicates the circumstances in which the indicated image should be used. Space
characters, other than the whitespace separating the URL and the corresponding condition descriptor, are ignored; this includes both leading and trailing space, as well as space before or after each comma. If the condition descriptor is not provided (in other words, the image ...
HTMLInputElement.setRangeText() - Web APIs
The HTMLInputElement.setRangeText() method replaces a range of text in an <input> or <textarea> element with a new string. Syntax element.setRangeText(replacement); element.setRangeText(replacement, start, end [, selectMode]); Parameters replacement The string to insert. 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. Possible values: "select" selects the newly inserted text. "start"moves the se...
HTMLLegendElement - Web APIs
ts properties from its parent, HTMLElement. HTMLLegendElement.form Read only Is a HTMLFormElement representing the form that this legend belongs to. If the legend has a fieldset element as its parent, then this attribute returns the same value as the form attribute on the parent fieldset element. Otherwise, it returns null. HTMLLegendElement.accessKey Is a DOMString representing a single-
character access key to give access to the element. HTMLLegendElement.align Is a DOMString representing the alignment relative to the form set Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLLegendElement' in that specification. Living Standard ...
HTMLScriptElement - Web APIs
its parent, HTMLElement. HTMLScriptElement.type Is a DOMString representing the MIME type of the script. It reflects the type attribute. HTMLScriptElement.src Is a DOMString representing the URL of an external script. It reflects the src attribute. HTMLScriptElement.event Is a DOMString; an obsolete way of registering event handlers on elements in an HTML document. HTMLScriptElement.
charset Is a DOMString representing the
character encoding of an external script. It reflects the
charset attribute. HTMLScriptElement.async HTMLScriptElement.defer The async and defer attributes are Boolean attributes that control how the script should be executed. The defer and async attributes must not be specified if the src attribute is absent. There are three possible execution modes:...
HTMLTableColElement - Web APIs
anchor="middle" alignment-baseline="middle">HTMLTableColElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement. HTMLTableColElement.align Is a DOMString that indicates the horizontal alignment of the cell data in the column. HTMLTableColElement.ch Is a DOMString representing the alignment
character for cell data. HTMLTableColElement.chOff Is a DOMString representing the offset for the alignment
character. HTMLTableColElement.span Is an unsigned long that reflects the span HTML attribute, indicating the number of columns to apply this object's attributes to. Must be a positive integer. HTMLTableColElement.vAlign Is a DOMString that indicates the vertical alignment of the ce...
Headers() - Web APIs
o this using Headers.append: myHeaders.append('Content-Type', 'image/jpeg'); myHeaders.get('Content-Type'); // Returns 'image/jpeg' Or you can add the headers you want as the Headers object is created. ...
History.pushState() - Web APIs
ry entry created by pushState(). Whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object. The state object can be anything that can be serialized. Because Firefox saves state objects to the user's disk so they can be restored after the user restarts the browser, we impose a size limit of 640k
characters on the serialized representation of a state object. If you pass a state object whose serialized representation is larger than this to pushState(), the method will throw an exception. If you need more space than this, you're encouraged to use sessionStorage and/or localStorage. title Most browsers currently ignore this parameter, although they may use it in the future. Passing the empty st...
Ajax navigation example - Web APIs
d between all ajax pages.</p> include/before_content.php: <p> [ <a class="ajax-nav" href="first_page.php">First example</a> | <a class="ajax-nav" href="second_page.php">Second example</a> | <a class="ajax-nav" href="third_page.php">Third example</a> | <a class="ajax-nav" href="unexisting.php">Unexisting page</a> ] </p> include/header.php: <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" /> <script type="text/javascript" src="js/ajax_nav.js"></script> <link rel="stylesheet" href="css/style.css" /> js/ajax_nav.js: "use strict"; const ajaxRequest = new (function () { function closeReq () { oLoadingBox.parentNode && document.body.removeChild(oLoadingBox); bIsLoading = false; } function abortReq () { if (!bIsLoading) { return; } ...
Working with the History API - Web APIs
ry entry created by pushState(). Whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object. The state object can be anything that can be serialized. Because Firefox saves state objects to the user's disk so they can be restored after the user restarts the browser, we impose a size limit of 640k
characters on the serialized representation of a state object. If you pass a state object whose serialized representation is larger than this to pushState(), the method will throw an exception. If you need more space than this, you're encouraged to use sessionStorage and/or localStorage. title All browsers but Safari currently ignore this parameter, although they may use it in the future. Passing...
InputEvent() - Web APIs
ntax event = new InputEvent(typeArg, inputEventInit); Values typeArg Is a DOMString representing the name of the event. inputEventInitOptional Is a InputEventInit dictionary, having the following fields: inputType: (Optional) A string specifying the type of change for editible content such as, for example, inserting, deleting, or formatting text. data: (Optional) A string containing
characters to insert. This may be an empty string if the change doesn't insert text (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 c...
InputEvent.data - Web APIs
Syntax var aString = inputEvent.data; Value A DOMString. Examples In the following simple example we've set up an event listener on the input event so that when any change is made to the contents of the <input> element (either by typing or pasting), the text that was added is retrieved via the InputEvent.data property and reported in the paragraph below the input. ...
InputEvent - Web APIs
aco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">InputEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor InputEvent() Creates an InputEvent object. Properties This interface inherits properties from its parents, UIEvent and Event. InputEvent.dataRead only Returns a DOMString with the inserted
characters. This may be an empty string if the change doesn't insert text (such as when deleting
characters, for example). InputEvent.dataTransferRead only Returns a DataTransfer object containing information about richtext or plaintext data being added to or removed from editable content. InputEvent.inputTypeRead only Returns the type of change for editable content such as, for example, inserti...
KeyboardEvent() - Web APIs
f type Boolean, that sets the value of KeyboardEvent.altKey. "metaKey", optional and defaulting to false, of type Boolean, that sets the value of KeyboardEvent.metaKey. "repeat", optional and defaulting to false, of type Boolean, that sets the value of KeyboardEvent.repeat. "isComposing", optional and defaulting to false, of type Boolean, that sets the value of KeyboardEvent.isComposing. "
charCode", optional and defaulting to 0, of type unsigned long, that sets the value of the deprecated KeyboardEvent.
charCode. "keyCode", optional and defaulting to 0, of type unsigned long, that sets the value of the deprecated KeyboardEvent.keyCode. "which", optional and defaulting to 0, of type unsigned long, that sets the value of the deprecated KeyboardEvent.which. The KeyboardEventInit ...
KeyboardEvent.altKey - Web APIs
The KeyboardEvent.altKey read-only property is a Boolean that indicates if the alt key (Option or ? on OS X) was pressed (true) or not (false) when the event occured. Syntax var altKeyPressed = instanceOfKeyboardEvent.altKey Return value Boolean Examples <html> <head> <title>altKey example</title> <script type="text/javascript"> function show
Char(e){ alert( "Key KeyDown: " + String.from
CharCode(e.
charCode) + "\n" + "
charCode: " + e.
charCode + "\n" + "ALT key KeyDown: " + e.altKey + "\n" ); } </script> </head> <body onkeydown="show
Char(event);"> <p> Press any
character key, with or without holding down the ALT key.<br /> You can also use the SHIFT key together with the ALT key. </p> </body> </html> Specifications Specification Status Comment ...
KeyboardEvent.initKeyboardEvent() - Web APIs
t. This method was introduced in draft of DOM Level 3 Events, but deprecated in newer draft. Gecko won't support this feature since implementing this method as experimental broke existing web apps (see bug 999645). Web applications should use constructor instead of this if it's available. Syntax kbdEvent.initKeyboardEvent(typeArg, canBubbleArg, cancelableArg, viewArg,
charArg, keyArg, locationArg, modifiersListArg, repeat) Parameters typeArg The type of keyboard event; this will be one of keydown, keypress, or keyup. canBubbleArg Whether or not the event can bubble. cancelableArg Whether or not the event can be canceled. viewArg The WindowProxy it is associated to.
charArg The value of the
char attribute. keyArg The value ...
KeyboardEvent.keyCode - Web APIs
key can't be identified, this value is 0. You should avoid using this if possible; it's been deprecated for some time. Instead, you should use KeyboardEvent.code, if it's implemented. Unfortunately, some browsers still don't have it, so you'll have to be careful to make sure you use one which is supported on all target browsers. Web developers shouldn't use the keyCode attribute for printable
characters when handling keydown and keyup events. As described above, the keyCode attribute is not useful for printable
characters, especially those input with the Shift or Alt key pressed. When implementing a shortcut key handler, the keypress event is usually better (at least when Gecko is the runtime in use). See Gecko Keypress Event for details. Example window.addEventListener("keydown", funct...
LockManager - Web APIs
The LockManager interface of the the Web Locks API provides methods for requesting a new Lock object and querying for an existing Lock object. To get an instance of LockManager, call navigator.locks. Methods LockManager.request() Requests a Lock object with parameters specifying its name and
characteristics. LockManager.query() Returns a Promise that resolves with a LockManagerSnapshot which contains information about held and pending locks. Specifications Specification Status Comment Web Locks APIThe definition of 'LockManager' in that specification. Draft Initial definition. ...
MediaStream.id - Web APIs
Syntax var id = mediaStream.id; Example var p = navigator.mediaDevices.getUserMedia({ audio: true, video: true }); p.then(function(stream) { console.log(stream.id); }) Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaStream.id' in that specification. Candidate Recommendation Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. ...
MediaStream - Web APIs
is active, or false otherwise. MediaStream.ended Read only A Boolean value set to true if the end of the stream has been reached. This has been removed from the specification; you should instead check the value of MediaStreamTrack.readyState to see if its value is ended for the track or tracks you want to ensure have finished playing. MediaStream.id Read only A DOMString containing 36
characters denoting a universally unique identifier (UUID) for the object. Event handlers MediaStream.onaddtrack An EventHandler containing the action to perform when an addtrack event is fired when a new MediaStreamTrack object is added. MediaStream.onremovetrack An EventHandler containing the action to perform when a removetrack event is fired when a MediaStreamTrack object is removed from i...
MediaStreamTrack.enabled - Web APIs
This example demonstrates a click event handler for a pause button. pauseButton.onclick = function(evt) { const newState = !myAudioTrack.enabled; pauseButton.innerHTML = newState ? "▶️" : "⏸️"; myAudioTrack.enabled = newState; } This creates a variable, newState, which is the opposite of the current value of enabled, then uses that to select either the Emoji
character for the "play" icon or the
character for the "pause" icon as the new innerHTML of the pause button's element. Finally, the new value of enabled is saved, making the change take effect. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'enabled' in that specification. Candidate Recommendation Initial specification. ...
MediaStreamTrack.onunmute - Web APIs
called, the track's muted flag is false. Syntax track.onunmute = unmuteHandler; Value unmuteHandler is a function which is called when the MediaStreamTrack receives the unmute event. The event handler receives as input a single parameter: an Event whose kind is "unmute". Example This example creates an unmute event handler which changes the state of a visual indicator to display the Emoji
character representing a "speaker" icon. myTrack.onunmute = function(evt) { playStateIcon.innerHTML = "🔈"; }; Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaStreamTrack.onunmute' in that specification. Candidate Recommendation Initial specification. ...
Media Capabilities API - Web APIs
bilitiesInfo 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() and MediaCapabilities.decodingInfo() methods. It is inherited by the MediaDecodingConfiguration and MediaEncodingConfigurati...
Capabilities, constraints, and settings - Web APIs
ck = null; videoElement.srcObject = null; }); This simply stops the active tracks, sets the videoTrack and audioTrack variables to null so we know they're gone, and removes the stream from the <video> element by setting HTMLMediaElement.srcObject to null. Simple tab support in the editor This code adds simple support for tabs to the <textarea> elements by making the tab key insert two space
characters when either constraint edit box is focused. function keyDownHandler(event) { if (event.key == "Tab") { let elem = event.target; let str = elem.value; let position = elem.selectionStart; let newStr = str.substring(0, position) + " " + str.substring(position, str.length); elem.value = newStr; elem.selectionStart = elem.selectionEnd = position + 2; ...
msPlayToSource - Web APIs
msPlayToSource is the source associated with the media element. Example <video id="videoplayer" src="http://www.contoso.com/clip.mp4" controls autoplay /> <script type="text/javascript"> // Step 1: Obtain PlayToManager object for app's current view. var ptm = Windows.Media.PlayTo.PlayToManager.getForCurrentView(); // Step 2: Register for the sourcerequested event (user swipes Devices
charm). ptm.addEventListener("sourcerequested", function(e) { // Step 3: Specify the media to be streamed (to filter devices). e.sourceRequest.setSource(document.getElementById("videoplayer").msPlayToSource); // The media will then be streamed to the device chosen by the user in the UI. }); ...
MutationEvent - Web APIs
) "mutation name events", i.e. DOMElementNameChanged and DOMAttributeNameChanged are not supported in Firefox (as of version 11), and probably in other browsers as well. ... Dottoro documents browser support for mutation events. Mutation events list The following is a list of all mutation events, as defined in DOM Level 3 Events specification: DOMAttrModified DOMAttributeNameChanged DOM
CharacterDataModified DOMElementNameChanged DOMNodeInserted DOMNodeInsertedIntoDocument DOMNodeRemoved DOMNodeRemovedFromDocument DOMSubtreeModified Usage You can register a listener for mutation events using EventTarget.addEventListener() as follows: element.addEventListener("DOMNodeInserted", function (event) { // ... }, false); The event object is passed to the listener in a MutationE...
MutationObserver.observe() - Web APIs
it object providing options that describe which DOM mutations should be reported to mutationObserver's callback. Return value undefined. Exceptions TypeError Thrown in any of the following circumstances: The options are configured such that nothing will actually be monitored. (For example, if MutationObserverInit.childList, MutationObserverInit.attributes, and MutationObserverInit.
characterData are all false.) The value of options.attributes is false (indicating that attribute changes are not to be monitored), but attributeOldValue is true and/or attributeFilter is present. The
characterDataOldValue option is true but MutationObserverInit.
characterData is false (indicating that
character changes are not to be monitored). Usage notes Reusing MutationObservers You can...
Web-based protocol handlers - Web APIs
= ""; if ( isset ( $_GET["value"] ) ) { $value = $_GET["value"]; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <title>Web Protocol Handler Sample</title> </head> <body> <h1>Web Protocol Handler Sample - Handler</h1> <p>This web page is called when handling a <code>web+burger:</code> protocol action. The data sent:</p> <textarea> <?php echo(htmlspecial
chars($value, ENT_QUOTES, 'UTF-8')); ?> </textarea> </body> </html> References http://www.w3.org/TR/2011/WD-html5-20110525/timers.html#custom-handlers See also window.navigator.registerContentHandler nsIProtocolHandler (XUL only) RegisterProtocolHandler Enhancing the Federated Web at Mozilla Webdev Register a custom protocolHandler at Google Developers. ...
Navigator - Web APIs
rID.appName Read only Returns a DOMString with the official name of the browser. Do not rely on this property to return the correct value. NavigatorID.appVersion Read only Returns the version of the browser as a DOMString. Do not rely on this property to return the correct value. Navigator.battery Read only Returns a BatteryManager object you can use to get information about the battery
charging status. Navigator.connection Read only Provides a NetworkInformation object containing information about the network connection of a device. Navigator.cookieEnabled Read only Returns false if setting a cookie will be ignored and true otherwise. Navigator.geolocation Read only Returns a Geolocation object allowing accessing the location of the device. NavigatorConcurrentHardware.har...
Node.isEqualNode() - Web APIs
The specific set of data points that must match varies depending on the types of the nodes. Syntax var isEqualNode = node.isEqualNode(otherNode); otherNode: The Node to compare equality with. Example In this example, we create three <div> blocks. The first and third have the same contents and attributes, while the second is different. ...
Node - Web APIs
based, thus letting those object types to be used similarly and often interchangeably. As an abstract class, there is no such thing as a plain Node object. All objects that implement Node functionality are based on one of its subclasses. Most notable are Document, Element, and DocumentFragment. In addition, every kind of DOM node is represented by an interface based on Node. These include Attr,
CharacterData (which Text, Comment, and CDATASection are all based on), ProcessingInstruction, DocumentType, Notation, Entity, and EntityReference. In some cases, a particular feature of the base Node interface may not apply to one of its child interfaces; in that case, the inheriting node may return null or throw an exception, depending on circumstances. For example, attempting to add children to a ...
NonDocumentTypeChildNode.previousElementSibling - Web APIs
ibling')) { return; } Object.defineProperty(item, 'previousElementSibling', { configurable: true, enumerable: true, get: function () { let el = this; while (el = el.previousSibling) { if (el.nodeType === 1) { return el; } } return null; }, set: undefined }); }); })([Element.prototype,
CharacterData.prototype]); Specifications Specification Status Comment DOMThe definition of 'NonDocumentTypeChildNode.previousElementSibling' in that specification. Living Standard Splitted the ElementTraversal interface in ChildNode, ParentNode, and NonDocumentTypeChildNode. This method is now defined on the former. The Element and
CharacterData interfaces implemen...
PannerNode.distanceModel - Web APIs
ceModelType. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
PannerNode.maxDistance - Web APIs
pted 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 or both of these as the application is used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
PannerNode.panningModel - Web APIs
ngModelType. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
PannerNode.setOrientation() - Web APIs
turns Void. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
PannerNode.setPosition() - Web APIs
turns Void. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
PannerNode.setVelocity() - Web APIs
turns Void. 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
PannerNode - Web APIs
ification. Examples 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 used. You might be moving a
character around inside a game world for example, and wanting delivery of audio to change realistically as your
character moves closer to or further away from a music player such as a stereo. In the example you can see this being controlled by the functions moveRight(), moveLeft(), etc., which set new values for the panner position via the PositionPanner() function. To see a complete implementation, ...
ParentNode.querySelector() - Web APIs
Parameters selectors A DOMString containing one or more selectors to match against. This string must be a valid compound selector list supported by the browser; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas. Note:
Characters which are not part of standard CSS syntax must be escaped using a backslash
character. Since JavaScript also uses backspace escaping, special care must be taken when writing string literals using these
characters. See Escaping special
characters for more information. Return value The first Element that matches at least one of the specified selectors or null if no such element is found. ...
ParentNode.querySelectorAll() - Web APIs
uerySelectorAll(selectors); Parameters selectors A DOMString containing one or more selectors to match against. This string must be a valid CSS selector string; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas. Note:
Characters which are not part of standard CSS syntax must be escaped using a backslash
character. Since JavaScript also uses backslash escaping, special care must be taken when writing string literals using these
characters. See Escaping special
characters for more information. Return value A non-live NodeList containing one Element object for each descendant node that matches at least one of the s...
PayerErrors.email - Web APIs
rs object. Example function validatePayment(response) { const correctionPromises let paymentErrors = {}; let payerErrors = {}; // Check payer details if (!validEmail(response.payerEmail)) { payerErrors.email = "Please make sure you enter a valid email address." } if (!validName(response.payerName)) { payerErrors.email = "Please enter a valid name, using only <appropriate
characters>." } if (!validPhone(response.payerPhone)) { payerErrors.phone = "Please enter a valid phone number in the form ###-###-####." } // Check everything else too... // } Specifications Specification Status Comment Payment Request APIThe definition of 'PayerErrors.email' in that specification. Candidate Recommendation Initial definition. ...
PayerErrors.name - Web APIs
rs object. Example function validatePayment(response) { const correctionPromises let paymentErrors = {}; let payerErrors = {}; // Check payer details if (!validEmail(response.payerEmail)) { payerErrors.email = "Please make sure you enter a valid email address." } if (!validName(response.payerName)) { payerErrors.email = "Please enter a valid name, using only <appropriate
characters>." } if (!validPhone(response.payerPhone)) { payerErrors.phone = "Please enter a valid phone number in the form ###-###-####." } // Check everything else too... // } Specifications Specification Status Comment Payment Request APIThe definition of 'PayerErrors.name' in that specification. Candidate Recommendation Initial definition. ...
PayerErrors.phone - Web APIs
rs object. Example function validatePayment(response) { const correctionPromises let paymentErrors = {}; let payerErrors = {}; // Check payer details if (!validEmail(response.payerEmail)) { payerErrors.email = "Please make sure you enter a valid email address." } if (!validName(response.payerName)) { payerErrors.email = "Please enter a valid name, using only <appropriate
characters>." } if (!validPhone(response.payerPhone)) { payerErrors.phone = "Please enter a valid phone number in the form ###-###-####." } // Check everything else too... // } Specifications Specification Status Comment Payment Request APIThe definition of 'PayerErrors.phone' in that specification. Candidate Recommendation Initial definition. ...
PaymentAddress.regionCode - Web APIs
rom the ISO 3166-2 standard, which defines codes for identifying the subdivisions (e.g., states, provinces, autonomous regions, etc.) of all countries in the world. If the browser can't determine the region code, or the country doesn't use regions for postal addresses, it returns an empty string. Syntax var regionCode = paymentAddress.regionCode; Value A DOMString indicating the one to three
character alphanumeric code representing the region portion of the address. This should correspond to region, but should be the ISO 3166--2 standard's region code. The string is empty if the region code couldn't be determined, isn't needed for the address's country, or was not provided. ...
PaymentCurrencyAmount.value - Web APIs
nt. This must be a valid decimal number, with an optional leading minus sign ("-"), then one or more decimal digits 0 through 9, optionally with a decimal point (".") with at least one digit following it to represent fractional units. There must not be any leading or trailing whitespace in the string. For uniformity and consistency, the value is always given using the period (".") as the decimal
character, regardless of the user's locale. You need to convert the value to this format before submitting the payment. See the example Verifying a properly formatted price below for a simple regular expression that can be used to validate the value string prior to submission. Examples Representing prices This example represents the price of $42.95 in US dollars: let itemPrice = { currency: "US...
PaymentDetailsUpdate - Web APIs
which the user may choose. total Optional A PaymentItem providing an updated total for the payment. Make sure this equals the sum of all of the items in displayItems. This is not calculated automatically. You must update this value yourself anytime the total amount due changes. This lets you have flexibility for how to handle things like tax, discounts, and other adjustments to the total price
charged. Specifications Specification Status Comment Payment Request APIThe definition of 'PaymentDetailsUpdate' in that specification. Candidate Recommendation Initial definition. ...
PaymentRequest.PaymentRequest() - Web APIs
address. The default shipping option may be indicated in this sequence. modifiers Modifiers for specific payment methods; for example, adjusting the total amount based on the payment method. This parameter contains the following fields: additionalDisplayItems An array of items to be appended to the details.displayItems property. This property is commonly used to add a discount or sur
charge line item indicating the different amount in details.modifiers.total. data A JSON-serializable object that provides optional information that might be needed by the supported payment methods. This has to conform to the structure defined in the BasicCardRequest dictionary. total A total amount for the payment request that overrides value in details.total. This is typically used when ...
PaymentRequest: shippingoptionchange event - Web APIs
ilable options. The string identifying the currently-selected shipping option can be found in the shippingOption property. Bubbles No Cancelable No Interface PaymentRequestUpdateEvent Event handler property onshippingoptionchange Examples This code snippet sets up a handler for the shippingoptionchange event. The code recalculates the total
charge for the payment based on the selected shipping option. For example, if there are three options (such as "Free ground shipping", "2-day air", and "Next day"), each time the user chooses one of those options, this event handler is called to recalculate the total based on the changed shipping option. paymentRequest.addEventListener("shippingoptionchange", event => { const value = calculateNewTo...
PaymentRequestUpdateEvent.updateWith() - Web APIs
which the user may choose. total Optional A PaymentItem providing an updated total for the payment. Make sure this equals the sum of all of the items in displayItems. This is not calculated automatically. You must update this value yourself anytime the total amount due changes. This lets you have flexibility for how to handle things like tax, discounts, and other adjustments to the total price
charged. Return value undefined. Specifications Specification Status Comment Payment Request APIThe definition of 'PaymentRequestUpdateEvent.updateWith()' in that specification. Candidate Recommendation Initial definition. ...
ProcessingInstruction - Web APIs
eight="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/
CharacterData" target="_top"><rect x="266" y="1" width="130" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="331" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">
CharacterData</text></a><polyline points="396,25 406,20 406,30 396,25" stroke="#D4DDE4" fill="none"/><line x1="406" y1="25"...
RTCDTMFToneChangeEvent.tone - Web APIs
if all queued tones have finished playing (that is, RTCDTMFSender.toneBuffer is empty). Syntax var tone = dtmfToneChangeEvent.tone; Example This example establishes a handler for the tonechange event which updates an element to display the currently playing tone in its content, or, if all tones have played, the string "<none>". ...
RTCIceCandidate.candidate - Web APIs
looks like this: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the corresponding candidate string's value will be "candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host". The user agent always prefers candidates with the highest priority, all else being equal. In the example above, the priority is 2043278322. The attributes are all separated by a single space
character, and are in a specific order. The complete list of attributes for this example candidate is: foundation = 4234997325 component = "rtp" (the number 1 is encoded to this string; 2 becomes "rtcp") protocol = "udp" priority = 2043278322 ip = "192.168.0.56" port = 44323 type = "host" Example In this example, we see a function which receives as input an SDP string containing an ICE can...
RTCIceCandidateInit.candidate - Web APIs
looks like this: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the corresponding candidate string's value will be "candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host". The user agent always prefers candidates with the highest priority, all else being equal. In the example above, the priority is 2043278322. The attributes are all separated by a single space
character, and are in a specific order. The complete list of attributes for this example candidate is: foundation = 4234997325 component = "rtp" (the number 1 is encoded to this string; 2 becomes "rtcp") protocol = "udp" priority = 2043278322 ip = "192.168.0.56" port = 44323 type = "host" Example When a new ICE candidate is received by your signaling code from the remote peer, you need to ...
RTCIceCandidateInit - Web APIs
within the SDP of the media description with which the candidate is associated, or null if no such associated exists. The default is null. usernameFragment Optional A DOMString containing a string which uniquely identifies the remote peer. This string is generated by WebRTC at the beginning of the session, and at least 24 bits worth of the string contain random data. The string may be up to 256
characters long. This property has no default value and is not present unless set explicitly. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidateInit' in that specification. Candidate Recommendation Initial definition. ...
RTCIceCandidateStats.address - Web APIs
le IP addresses. Syntax candidateAddress = rtcIceCandidateStats.address; Value Either an IPv4 or IPv6 address or a fully-qualified domain name, which corresponds to the candidate. If the value of address is comprised entirely of digits from 0-9 with periods as separators, the value is interpreted as an IPv4 address. If the value is entirely comprised of hexadecimal digits and colon (":")
characters, it is interpreted as an IPv6 address. Otherwise, the address is presumed to be a fully-qualified domain name, which is resolved first using an AAAA record (assuming IPv6 is available), then using an A record (if no result is found or the device onlu supports IPv4). If multiple IP addresses are returned in response to the query, the user agent selects one, which is then used for the durati...
RTCIceParameters.usernameFragment - Web APIs
usernameFragment property specifies the username fragment ("ufrag") that uniquely identifies the corresponding ICE session for the duration of the current ICE session. Syntax ufrag = RTCIceParameters.usernameFragment; Value A DOMString containing the username fragment that, in tandem with the password, uniquely identify the ICE session being used by the transport. The string may be up to 256
characters long. See RTCIceCandidate.usernameFragment to learn more about username fragments and their role in a connection. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceParameters.usernameFragment' in that specification. Candidate Recommendation Initial specification. ...
RTCPeerConnection.createDataChannel() - Web APIs
bject with the specified label, configured using the options specified by options if that parameter is included; otherwise, the defaults listed above are established. Exceptions InvalidStateError The RTCPeerConnection is closed. TypeError This can happen in a couple of situations: The label and/or protocol string is too long; these cannot be longer than 65,535 bytes (bytes, rather than
characters). The id is 65535. While this is a valid unsigned 16-bit value, it's not a permitted value for id. SyntaxError Values were specified for both the maxPacketLifeTime and maxRetransmits options. You may only specify a non-null value for one of these. ResourceInUse An id was specified, but another RTCDataChannel is already using the same value. OperationError Either the specified id...
RTCRtpTransceiver.setCodecPreferences() - Web APIs
for all future connections including this transceiver until this method is called again. When preparing to open an RTCPeerConnection, you can change the codec parameters from the user agent's default configuration by calling setCodecParameters() before calling either RTCPeerConnection.createOffer() or createAnswer(). A guide to codecs supported by WebRTC--and each codec's positive and negative
characteristics--can be found in Codecs used by WebRTC. Syntax rtcRtpTransceiver.setCodecPreferences(codecs) Parameters codecs An array of RTCRtpCodecCapability objects, in order of preference, each providing the parameters for one of the transceiver's supported codecs. If codecs is empty, the codec configurations are all returned to the user agent's defaults. Note: Any codecs not included ...
Range.comparePoint() - Web APIs
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. ...
Range.endOffset - Web APIs
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. ...
Range.setEnd() - Web APIs
ts 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 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.createRange(); 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 ran...
Range.startOffset - Web APIs
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. ...
ReadableStream.ReadableStream() - Web APIs
provided to stop the generation if ReadableStream.cancel() is called for any reason. When a button is pressed, the generation is stopped, the stream is closed using ReadableStreamDefaultController.close(), and another function is run, which reads the data back out of the stream. ...
ReadableStream.cancel() - Web APIs
trying to cancel is not a ReadableStream, or it is locked. Examples In Jake Archibald's cancelling a fetch example, a stream is used to fetch the WHATWG HTML spec chunk by chunk; each chunk is searched for the string "service workers". When the search terms is found, cancel() is used to cancel the stream -- the job is finished so it is no longer needed. ...
ReadableStreamDefaultController.close() - Web APIs
provided to stop the generation if ReadableStream.cancel() is called for any reason. When a button is pressed, the generation is stopped, the stream is closed using ReadableStreamDefaultController.close(), and another function is run, which reads the data back out of the stream. ...
ReadableStreamDefaultController.enqueue() - Web APIs
provided to stop the generation if ReadableStream.cancel() is called for any reason. When a button is pressed, the generation is stopped, the stream is closed using ReadableStreamDefaultController.close(), and another function is run, which reads the data back out of the stream. ...
ReadableStreamDefaultController - Web APIs
tController object is provided as the parameter of the start() and pull() functions. When a button is pressed, the generation is stopped, the stream is closed using ReadableStreamDefaultController.close(), and another function is run, which reads the data back out of the stream. ...
SVGPathSeg - Web APIs
Name Type Description pathSegType unsigned short The type of the path segment as specified by one of the constants defined on this interface. pathSegTypeAsLetter DOMString The type of the path segment as specified by the corresponding one
character command name. Methods The SVGPathSeg interface does not provide any specific methods. Browser compatibility Desktop Mobile Chrome Edge Firefox Internet Explorer Opera Saf...
SVGSVGElement - Web APIs
ocument. (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 interface (UI) events in DOM Level 2 indicate the screen positions at which the given UI ev...
SecurityPolicyViolationEvent.sample - Web APIs
The sample read-only property of the SecurityPolicyViolationEvent interface is a DOMString representing a sample of the resource that caused the violation. Syntax let sample = violationEventInstance.sample; Value A DOMString containing a sample of the resource that caused the violation, usually the first 40
characters. This will only be populated if the resource is an inline script, event handler, or style -- external resources causing a violation will not generate a sample. Example document.addEventListener("securitypolicyviolation", (e) => { console.log(e.sample); }); Specifications Specification Status Comment Content Security Policy Level 3The definition of 'sample' in that specification. Working Draft Initial definition ...
SecurityPolicyViolationEvent - Web APIs
olicyRead only A DOMString containing the policy whose enforcement uncovered the violation. SecurityPolicyViolationEvent.referrerRead only A USVString representing the referrer of the resources whose policy was violated. This will be a URL or null. SecurityPolicyViolationEvent.sampleRead only A DOMString representing a sample of the resource that caused the violation, usually the first 40
characters. This will only be populated if the resource is an inline script, event handler, or style -- external resources causing a violation will not generate a sample. SecurityPolicyViolationEvent.sourceFileRead only A USVString representing the URI of the document or worker in which the violation was found. SecurityPolicyViolationEvent.statusCodeRead only A number representing the HTTP statu...
Selection.anchorOffset - Web APIs
The Selection.anchorOffset read-only property returns the number of
characters that the selection's anchor is offset within the Selection.anchorNode. This number is zero-based. If the selection begins with the first
character in the Selection.anchorNode, 0 is returned. Syntax number = sel.anchorOffset Specifications Specification Status Comment Selection APIThe definition of 'Selection.anchorOffset' in that specification. Working Draft Current ...
Selection.focusOffset - Web APIs
The Selection.focusOffset read-only property returns the number of
characters that the selection's focus is offset within the Selection.focusNode. This number is zero-based. If the selection ends with the first
character in the Selection.focusNode, 0 is returned. Syntax offset = sel.focusOffset Specifications Specification Status Comment Selection APIThe definition of 'Selection.focusOffset' in that specification. Working Draft Current ...
ShadowRoot - Web APIs
ected 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, and caret's
character offset within that node. Examples The following snippets are taken from our life-cycle-callbacks example (see it live also), which creates an element that displays a square of a size and color specified in the element's attributes. Inside the <custom-square> element's class definition we include some life cycle callbacks that make a call to an external function, updateStyle(), which actu...
SpeechSynthesisEvent.utterance - Web APIs
The utterance read-only property of the SpeechSynthesisUtterance interface returns the SpeechSynthesisUtterance instance that the event was triggered on. Syntax event.utterance; Value A SpeechSynthesisUtterance object. Examples utterThis.onpause = function(event) { var
char = event.utterance.text.
charAt(event.
charIndex); console.log('Speech paused at
character ' + event.
charIndex + ' of "' + event.utterance.text + '", which is "' +
char + '".'); } Specifications Specification Status Comment Web Speech APIThe definition of 'utterance' in that specification. Draft ...
SpeechSynthesisUtterance.text - Web APIs
may be provided as plain text, or a well-formed SSML document. The SSML tags will be stripped away by devices that don't support SSML. Syntax var myText = speechSynthesisUtteranceInstance.text; speechSynthesisUtteranceInstance.text = 'Hello I am speaking'; Value A DOMString representing the text to the synthesised. The maximum length of the text that can be spoken in each utterance is 32,767
characters. Examples var synth = window.speechSynthesis; var inputForm = document.querySelector('form'); var inputTxt = document.querySelector('input'); var voiceSelect = document.querySelector('select'); var voices = synth.getVoices(); ... inputForm.onsubmit = function(event) { event.preventDefault(); var utterThis = new SpeechSynthesisUtterance(inputTxt.value); var selectedOption = vo...
StaticRange.StaticRange() - Web APIs
is collapsed (that is, empty). Syntax var staticRange = new StaticRange(rangeSpec) Parameters rangeSpec The required rangeSpec parameter is an object adhering to the StaticRangeInit 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 endOffset at which the last
character in the range is located. Return value A new StaticRange object initialized with the values given in the rangeSpec object. Exceptions InvalidNodeTypeError A DOMException fired if either or both of...
StaticRange.collapsed - Web APIs
The collapsed read-only property of the StaticRange interface returns true if the range's start position and end position are the same. Syntax var isCollpased = staticRange.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 StaticRange 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 StaticRange interface returns the offset into the end node of the range's end position. Syntax var endOffset = staticRange.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.startOffset - Web APIs
The read-only startOffset property of the StaticRange interface returns the offset into the start node of the range's start position. Syntax var startOffset = staticRange.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. ...
StaticRange - Web APIs
art and end positions are the same, resulting in a range of length 0. StaticRange.endContainer Read only Returns the DOM Node which contains the ending point of the range. The offset into the node at which the end position is located is indicated by endOffset. StaticRange.endOffset Read only Returns an integer value indicating the offset into the node given by endContainer at which the last
character of the range is found. StaticRange.startContainer Read only Returns the DOM Node which contains the starting point of the range (which is in turn identified by startOffset. StaticRange.startOffset Read only Returns an integer value indicating the offset into the node specified by startContainer at which the first
character of the range is located. Methods StaticRange.toRange() Re...
Storage API - Web APIs
as needed. To change an origin's box mode requires permission to use the "persistent-storage" feature. Data persistence and clearing If the site or app has the "persistent-storage" feature permission, it can use the StorageManager.persist() method to request that its box be made persistent. It's also possible for the user agent to decide to make the site's storage unit persistent due to usage
characteristics or other metrics. The "persistent-storage" feature's permission-related flags, algorithms, and types are all set to the standard defaults for a permission, except that the permission state must be the same across the entire origin, and that if the permission state isn't "granted" (meaning that for whatever reason, access to the persistent storage feature was denied), the origin's site ...
Text.isElementContentWhitespace - Web APIs
e textual content of the Text node into test() should do the same work just like the three example above. The Text.isElementContentWhitespace read-only property returns a Boolean flag indicating whether or not the text node's content consists solely of whitespace. Syntax b = textnode.isElementContentWhitespace; Example In the example below, we create a node with mixed display and whitespace
characters and the attribute is false. var tn = document.createTextNode("Hello world"); tn.isElementContentWhitespace; /* evaluates to false */ For a node that is all whitespace
characters, the isElementContentWhitespace evaluates to true. var ws = document.createTextNode(" \t \r\n ") ws.isElementContentWhitespace; /* evaluates to true */ ...
TextMetrics - Web APIs
It can therefore be useful to use the sum of actualBoundingBoxLeft and actualBoundingBoxRight as a more accurate way to get the absolute text width: const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); const text = 'Abcdefghijklmnop'; ctx.font = 'italic 50px serif'; const textMetrics = ctx.measureText(text); console.log(text...
TextRange - Web APIs
.findText() Searches the specified text in the original range and adjusts the range to include the first match. TextRange.inRange() Returns whether the current range contains the specified range. TextRange.isEqual() Returns whether the current range is equal to the specified range. TextRange.move() Collapses the range and moves the blank range by a specified number of units. Such as, move("
character",-1) means to move one
character to the left. TextRange.moveEnd() Moves the end of the range by a specified number of units. TextRange.moveStart() Moves the start of the range by a specified number of units. TextRange.moveToElementText() Causes the range to contain the text of the specified element. Can only be used on Element objects. TextRange.parentElement() Returns the parent ele...
URL - Web APIs
domain name. pathname A USVString containing an initial '/' followed by the path of the URL. port A USVString containing the port number of the URL. protocol A USVString containing the protocol scheme of the URL, including the final ':'. search A USVString indicating the URL's parameter string; if any parameters are provided, this string includes all of them, beginning with the leading ?
character. searchParams Read only A URLSearchParams object which can be used to access the individual query parameters found in search. username A USVString containing the username specified before the domain name. Methods toString() Returns a USVString containing the whole URL. It is a synonym for URL.href, though it can't be used to modify the value. toJSON() Returns a USVString contain...
USVString - Web APIs
of unicode scalar values. USVString maps to a String when returned in JavaScript; it's generally only used for APIs that perform text processing and need a string of unicode scalar values to operate on. USVString is equivalent to DOMString except for not allowing unpaired surrogate codepoints. Unpaired surrogate codepoints present in USVString are converted by the browser to Unicode 'replacement
character' U+FFFD, (?). Specifications Specification Status Comment Web IDLThe definition of 'USVString' in that specification. Candidate Recommendation Initial definition. ...
ValidityState.patternMismatch - Web APIs
" type="tel" pattern="[0-9]{4}" placeholder="####" aria-label="4-digit number" size="3"/> </label> </p> Here we have 3 sections for a north American phone number with an implicit label encompassing all three components of the phone number, expecting 3-digits, 3-digits and 4-digits respectively, as defined by the pattern attribute set on each. If the values are too long or too short, or contain
characters that aren't digits, patternMismatch will be true. When true, the element matches the :invalid CSS pseudo-classes. input:invalid { border: red solid 3px; } Note, in this case, we get a patternMismatch not a validityState.tooLong or validityState.tooShort if the values are too long or too short because it is the pattern that is dictating the length of the value. Had we used minlength an...
Introduction to WebRTC protocols - Web APIs
metadata describing the content and not the media content itself. Technically, then, SDP is not truly a protocol, but a data format used to describe connection that shares media between devices. Documenting SDP is well outside the scope of this documentation; however, there are a few things worth noting here. Structure SDP consists of one or more lines of UTF-8 text, each beginning with a one-
character type, followed by an equals sign ("="), followed by structured text comprising a value or description, whose format depends on the type. The lines of text that begin with a given letter are generally referred to as "letter-lines". For example, lines providing media descriptions have the type "m", so those lines are referred to as "m-lines." For more information To learn more about SDP, see...
WebSocket.close() - Web APIs
meters code Optional A numeric value indicating the status code explaining why the connection is being closed. If this parameter is not specified, a default value of 1005 is assumed. See the list of status codes of CloseEvent for permitted values. reason Optional A human-readable string explaining why the connection is closing. This string must be no longer than 123 bytes of UTF-8 text (not
characters). Exceptions thrown INVALID_ACCESS_ERR An invalid code was specified. SYNTAX_ERR The reason string is too long or contains unpaired surrogates. Note: In Gecko, this method didn't support any parameters prior to Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5). Specifications Specification Status Comment HTML Living Standard The definition o...
Writing WebSocket servers - Web APIs
it must be 0.) You're done. Reading and Unmasking the Data If the MASK bit was set (and it should be, for client-to-server messages), read the next 4 octets (32 bits); this is the masking key. Once the payload length and masking key is decoded, you can read that number of bytes from the socket. Let's call the data ENCODED, and the key MASK. To get DECODED, loop through the octets (bytes a.k.a.
characters for text data) of ENCODED and XOR the octet with the (i modulo 4)th octet of MASK. In pseudo-code (that happens to be valid JavaScript): var DECODED = ""; for (var i = 0; i < ENCODED.length; i++) { DECODED[i] = ENCODED[i] ^ MASK[i % 4]; } Now you can figure out what DECODED means depending on your application. Message Fragmentation The FIN and opcode fields work together to send a m...
Inputs and input sources - Web APIs
eded or not. Two common uses for the primary squeeze action are to grasp and/or pick up objects in the 3D world and to squeeze a trigger to fire a weapon in a game or simulation. Example This sample code shows a set of squeeze event handlers that implement these events to manage picking up and holding objects from the scene. The code presumes the existence of an avatar object representing the
character, as used in several other eamples on this page, as well as the pickUpObject() and dropObject() functions, which handle transferring an object from the world to a particular hand and releasing an object from the hand and placing it back into the world. Picking up an object: handling squeezestart events xrSession.addEventListener("squeezestart", event => { const targetRaySpace = event.inpu...
Lighting a WebXR setting - Web APIs
The WebGL shader program takes the color, directionality, brightness, and other factors for each light source and computes the final color of each pixel. Types of light source There are four fundamental types of light source. Each one involves a source of virtual light whose distance from the object being drawn and the directionality of the light waves cause the light source to take on specific
characteristics. For the most part, any real-world light source can be simulated using one or more of these light source types. Ambient light sources An ambient light source is a light source describing the level and color of ambient light in a scene. While there may be more than one of these in a scene, you can probably slightly improve performance by combining them into one on your own, since each...
Rendering and the WebXR frame animation callback - Web APIs
s Non-XR input device inputs To learn more about how to handle user inputs while presenting a scene using WebXR, see the article Inputs and input sources. Updating object positions Most (though not all) scenes include some form of animation, in which things move and react to one another in appropriate ways. For example, a virtual reality or augmented reality game might have enemy non-player
characters being controlled by the computer and moving around the scene. Not only are their locations in the world changing over time, but each NPC likely has body parts or components that are moving in relation to one another. Arms and legs swing as a creature walks, heads bob and turn, hair bounces and sways, torsos expand and contract as the
character breathes. In addition, there may be objects an...
Starting up and shutting down a WebXR session - Web APIs
ist if the document wasn't loaded securely. This may also be the case if there simply is no compatible XR hardware available. Either way, you need to be prepared for the lack of an xr property and either gracefully handle the error or provide some form of fallback. Falling back to the WebXR polyfill One fallback option is the WebXR polyfill, provided by the Immersive Web Working Group that's in
charge of the WebXR standardization process. The polyfill brings support for WebXR to browsers that don't have native WebXR support, and smooths out the inconsistencies among implementations in the browsers that do have it, so it can sometimes also be useful even if WebXR is natively available. Here we define a getXR() function, which returns the XRSystem object after optionally installing the polyfi...
Controlling multiple parameters with ConstantSourceNode - Web APIs
them again when the play button is clicked again to toggle them back on. Let's look at the code. function togglePlay(event) { if (playing) { playButton.innerHTML = "?"; stopOscillators(); } else { playButton.innerHTML = "?"; startOscillators(); } } If the playing variable indicates we're already playing the oscillators, we change the playButton's content to be the Unicode
character "right-pointing triangle" (?) and call stopOscillators() to shut down the oscillators. See Stopping the oscillators below for that code. If playing is false, indicating that we're currently paused, we change the play button's content to be the Unicode
character "pause symbol" (?) and call startOscillators() to start the oscillators playing their tones. That code is covered under Starting th...
Example and tutorial: Simple synth keyboard - Web APIs
ew value of the control. Next, we iterate over each octave in the note frequencies table. For each octave, we use Object.entries() to get a list of the notes in that octave. Create a <div> to contain that octave's notes (so we can have a small bit of space drawn between octaves), and set its class name to "octave" For each key in the octave, we check to see if the note's name has more than one
character. We skip these, because we're leaving out the sharp notes in this example. If the note's name is only one
character, then we call createKey(), specifying the note string, octave, and frequency. The returned element is appended to the octave element created in step 4. When each octave element has been built, it's appended to the keyboard. Once the keyboard has been constructed, we scroll t...
Window.localStorage - Web APIs
private" tab is closed.) Data stored in either localStorage is specific to the protocol of the page. In particular, data stored by a script on a site accessed with HTTP (e.g., http://example.com) is put in a different localStorage object from the same site accessed with HTTPS (e.g., https://example.com). The keys and the values are always in the UTF-16 DOMString format, which uses two bytes per
character. As with objects, integer keys are automatically converted to strings. Syntax myStorage = window.localStorage; Value A Storage object which can be used to access the current origin's local storage space. Exceptions SecurityError The request violates a policy decision, or the origin is not a valid scheme/host/port tuple (this can happen if the origin uses the file: or data: scheme, f...
window.location - Web APIs
on sendData (sData) { location.search = sData; } // in html: <button onclick="sendData('Some data');">Send data</button> The current URL with "?Some%20data" appended is sent to the server (if no action is taken by the server, the current document is reloaded with the modified search string). ...
Window.locationbar - Web APIs
Returns the locationbar object, whose visibility can be checked. Syntax objRef = window.locationbar Example The following complete HTML example shows how the visible property of the locationbar object is used. <!DOCTYPE html> <html lang="en"> <head> <meta
charset="UTF-8" /> <title>Various DOM Tests</title> <script> var visible = window.locationbar.visible; </script> </head> <body> <p>Various DOM Tests</p> </body> </html> Specifications Specification Status Comment HTML Living StandardThe definition of 'Window.locationbar' in that specification. Living Standard HTML5The definition of 'Window.locationbar' in that specification. Recommendation ...
Window.sessionStorage - Web APIs
objects in sessionStorage. Data stored in sessionStorage is specific to the protocol of the page. In particular, data stored by a script on a site accessed with HTTP (e.g., http://example.com) is put in a different sessionStorage object from the same site accessed with HTTPS (e.g., https://example.com). The keys and the values are always in the UTF-16 DOMString format, which uses two bytes per
character. As with objects, integer keys are automatically converted to strings. Syntax myStorage = window.sessionStorage; Value A Storage object which can be used to access the current origin's session storage space. Exceptions SecurityError The request violates a policy decision, or the origin is not a valid scheme/host/port tuple (this can happen if the origin uses the file: or data: sche...
Window.statusbar - Web APIs
ns the statusbar object, whose visibility can be toggled in the window. Syntax objRef = window.statusbar Example The following complete HTML example shows a way that the visible property of the various "bar" objects is used, and also the change to the privileges necessary to write to the visible property of any of the bars on an existing window. ...
WindowOrWorkerGlobalScope.atob() - Web APIs
The WindowOrWorkerGlobalScope.atob() function decodes a string of data which has been encoded using Base64 encoding. You can use the btoa() method to encode and transmit data which may otherwise cause communication problems, then transmit it and use the atob() method to decode the data again. For example, you can encode, transmit, and decode control
characters such as ASCII values 0 through 31. For use with Unicode or UTF-8 strings, see the note on "Unicode strings" in the page for btoa(). Syntax var decodedData = scope.atob(encodedData); Parameters encodedData A binary string contains an base64 encoded data. Return value An ASCII string containing decoded data from encodedData. Exceptions DOMException (name: Invalid
CharacterError) Throws if encodedData is not valid base64. ...
HTML in XMLHttpRequest - Web APIs
esponseType = "document"; xhr.send(); } catch (e) { window.setTimeout(function() { if (!done) { done = true; callback(false); } }, 0); } } The argument callback is a function that will be called asynchronously with true as the only argument if HTML parsing is supported and false as the only argument if HTML parsing is not supported. View on JSFiddle
Character encoding If the
character encoding is declared in the HTTP Content-Type header, that
character encoding is used. Failing that, if there is a byte order mark, the encoding indicated by the byte order mark is used. Failing that, if there is a <meta> element that declares the encoding within the first 1024 bytes of the file, that encoding is used. Otherwise, the file is decoded as UTF-8. Hand...
XMLHttpRequest.getAllResponseHeaders() - Web APIs
whose field name is Set-Cookie or Set-Cookie2) separated by CRLF, or null if no response has been received. If a network error happened, an empty string is returned. An example of what a raw header string looks like: date: Fri, 08 Dec 2017 21:04:30 GMT\r\n content-encoding: gzip\r\n x-content-type-options: nosniff\r\n server: meinheld/0.6.1\r\n x-frame-options: DENY\r\n content-type: text/html;
charset=utf-8\r\n connection: keep-alive\r\n strict-transport-security: max-age=63072000\r\n vary: Cookie, Accept-Encoding\r\n content-length: 6502\r\n x-xss-protection: 1; mode=block\r\n Each line is terminated by both carriage return and line feed
characters (\r\n). These are essentially delimiters separating each of the headers. Note: In modern browsers, the header names are returned in all lowe...
XMLSerializer - Web APIs
Examples Serializing XML into a string The first, basic, example just serializes an entire document into a string containing XML. ...
XRInputSource.profiles - Web APIs
le for the input device represented by the XRInputSource object. Each input profile specifies the preferred visual representation and behavior of the input source. Usage notes Input profile names An input profile name is a string describing a visual representation and behavior the input source may be configured to use. ...
msWriteProfilerMark - Web APIs
Explorer 10. This method is also available in the Web Worker global scope. For Windows XP, this method sends an event to an event tracing session with TraceEvent; for systems after Windows XP, this method writes an event with EventWrite. The event includes a pointer to a window object, current markup, and the event name passed as bstrProfilerMarkName. The bstrProfilerMarkName property has a 32-
character limit when called from script. This method is useful to profile real website performance by using the operating system metrics as a baseline. Example if (msWriteProfilerMark) { msWriteProfilerMark("Mark1"); } See also Microsoft API extensions ...
ARIA Screen Reader Implementors Guide - Accessibility
one after the other. Include labels when presenting changes: if the change occurs in something with a semantic label of some kind, speak the label. This is particularly important for changes in data cells, where the column and row headers provide important contextual information. Ideas for Settings and Heuristics Allow for a different voice (in text-to-speech) or other varying presentational
characteristics to set live changes apart. When no WAI-ARIA markup is present, automatically present some changes unless the user configures all live changes to off. For example, automatically speak changes that are caused by the user's own input, as part of the context of that input. Allow global settings to turn off the presentation of live changes, present all live changes, use markup, or be "sma...
Using the aria-invalid attribute - Accessibility
required="true" aria-invalid="false" onblur="checkValidity('email', '@', 'Invalid e-mail address');"/> Note that it is not necessary to validate the fields immediately on blur; the application could wait until the form is submitted (though this is not necessarily recommended). ...
ARIA: listbox role - Accessibility
h focus. Supporting this key is strongly recommended for lists with more than five options. End (Optional): Moves focus to last option. Optionally, in a single-select listbox, selection may also move with focus. Supporting this key is strongly recommended for lists with more than five options. Type-ahead is recommended for all listboxes, especially those with more than seven options: Type a
character: focus moves to the next item with a name that starts with the typed
character. Type multiple
characters in rapid succession: focus moves to the next item with a name that starts with the string of
characters typed. Multiple Selection: Authors may implement either of two interaction models to support multiple selection: a recommended model that does not require the user to hold a modi...
Web applications and ARIA FAQ - Accessibility
port requires Safari 5 with VoiceOver on iOS5 or OS X Lion Opera 9.5+ Requires VoiceOver on OS X. TBD: how well does this currently work? Internet Explorer 8+ Works with JAWS 10+ and NVDA. No live region support in NVDA. IE9 support is much improved. In some cases, earlier versions may support only some features of ARIA. More detailed browser compatibility
charts are available from multiple sources: caniuse.com The Paciello Group Assistive Technologies Assistive technologies are increasingly adopting ARIA. Some of them include: Assistive Technology Minimum Version for basic ARIA Minimum version for live region and alert support NVDA 2010.2 (NVDA is always a free upgrade) 2011.1 for Firefox, no live region suppor...
Alerts - Accessibility
="Reset form"/> </form> Checking for validity and notifying the user Form validations consists of several steps: Checking if the e-mail address or entered name are valid. Each field has a set of criteria which must be met in order to pass validation. In order to simplify this example, we'll check whether the e-mail address contains the "@" symbol, and if the name entry contains at least 1
character. If the above criteria is not met, the field's aria-invalid attribute will be given a value of "true". If the criteria was not met, the user will be notified via an alert. Instead of using the JavaScript 'alert' function, we'll use a simple WAI-ARIA widget for notification. This notifies the user of the error, but allows for them continue modifying the form without losing focus (caused by ...
An overview of accessible web applications and widgets - Accessibility
familiar UI widgets. Many of these were later added in HTML5, and developers should always prefer using the correct semantic HTML element over using ARIA. The ARIA specification is split up into three different types of attributes: roles, states, and properties. Roles describe widgets that aren't otherwise available in HTML 4, such as sliders, menu bars, tabs, and dialogs. Properties describe
characteristics of these widgets, such as if they are draggable, have a required element, or have a popup associated with them. States describe the current interaction state of an element, informing the assistive technology if it is busy, disabled, selected, or hidden. ARIA attributes are interpreted automatically by the browser and translated to the operating system's native accessibility APIs. So a...
HTML To MSAA - Accessibility
ap HTML element Role Name Value States Relations Actions Events Notes a ROLE_SYSTEM_ LINK n/a value of @href attribute STATE_SYSTEM_ SELECTABLE if @name attribute is presented STATE_SYSTEM_ LINKED if @href attribute is presented or click event listener is registered STATE_SYSTEM_ TRAVERSED if link is traversed n/a "jump" if @href is valid n/a br ROLE_SYSTEM_ WHITESPACE '\n' (new line
char) STATE_SYSTEM_ READONLY n/a n/a n/a button ROLE_SYSTEM_ PUSHBUTTON from child nodes n/a STATE_SYSTEM_ FOCUSABLE STATE_SYSTEM_ DEFAULT if @type attribute has value "submit" n/a "press" n/a caption BSTR role n/a n/a n/a description_for (0x100f), points to table element div BSTR role n/a n/a n/a n/a n/a n/a fieldset ROLE_SYSTEM_ GROUPING text equivalent from child legend el...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
TITLEBAR [inserted by system] ROLE_MENUBAR [important if you don't use native menus] ROLE_SCROLLBAR ROLE_GRIP ROLE_SOUND ROLE_CURSOR ROLE_CARET ROLE_ALERT ROLE_WINDOW [inserted by system] ROLE_CLIENT [important] ROLE_MENUPOPUP [important] ROLE_MENUITEM [important] ROLE_TOOLTIP ROLE_APPLICATION ROLE_DOCUMENT ROLE_PANE [important] ROLE_
CHART ROLE_DIALOG [semi-important, not currently used by all AT's] ROLE_BORDER ROLE_GROUPING ROLE_SEPARATOR [important] ROLE_TOOLBAR ROLE_STATUSBAR [important] ROLE_TABLE [important] ROLE_COLUMNHEADER ROLE_ROWHEADER ROLE_COLUMN ROLE_ROW ROLE_CELL [important] ROLE_LINK [important] ROLE_HELPBALLOON ROLE_
CHARACTER ROLE_LIST [important] RO...
Accessibility documentation index - Accessibility
This document provides a list of links to all accessibility articles on the Mozilla Developer Network. Found 105 pages: # Page Tags and summary 1 Accessibility Accessibility, Landing Accessibility (often abbreviated to A11y--as in "a" then 11
characters then "y") in Web development means enabling as many people as possible to use Web sites, even when those people's abilities are limited in some way. 2 ARIA ARIA, Accessibility, HTML Accessible Rich Internet Applications (ARIA) is a set of attributes that define ways to make web content and web applications (especially those developed with JavaScript) more accessible to people with disabilities. It supplements HTML so that interactions and widgets commonly used in applications c...
Web Accessibility: Understanding Colors and Luminance - Accessibility
(Formula taken from [sRGB] and [IEC-4WD]). Colors Perception When it comes to "perceiving" colors, not all colors are created equal. Our eyes are tuned to perceive certain colors, Red, Blue, and Green, but we do not perceive these colors with equal strength. According to the article, Hypersensitive cones, the authors note that "By population, about 64%...
Accessibility
For many people, technology makes things easier. For people with disabilities, technology makes things possible. Accessibility means developing content to be as accessible as possible no matter an individual's physical and cognitive abilities and no matter how they access the web. "The Web is fundamentally designed to work for all people, whatever their hardware, software, language, culture, location, or physical or mental ability. ...
-webkit-text-fill-color - CSS: Cascading Style Sheets
If this property is not set, the value of the color property is used. /* <color> values */ -webkit-text-fill-color: red; -webkit-text-fill-color: #000000; -webkit-text-fill-color: rgb(100, 200, 0); /* Global values */ -webkit-text-fill-color: inherit; -webkit-text-fill-color: initial; -webkit-text-fill-color: unset; Syntax Values <color> The foreground fill color of the element's text content. ...
-webkit-text-security - CSS: Cascading Style Sheets
-webkit-text-security is a non-standard CSS property that obfuscates
characters in a <form> field (such as <input> or <textarea>) by replacing them with a shape. It only affects fields that are not of type=password. Syntax -webkit-text-security: circle; -webkit-text-security: disc; -webkit-text-security: square; -webkit-text-security: none; Formal definition Value not found in DB! Formal syntax Syntax not found in DB! Examples Obscuring a text input Try typing in the field below. If your browser supports this property, the
characters should be visually replaced with squares. HTML <label for="name">Name:</label> <input type="text" name="name" id="name" /> CSS input { -webkit-text-security: square; } Result Specifications Not part of any standard. ...
-webkit-text-stroke-color - CSS: Cascading Style Sheets
If this property is not set, the value of the color property is used. /* <color> values */ -webkit-text-stroke-color: red; -webkit-text-stroke-color: #e08ab4; -webkit-text-stroke-color: rgb(200, 100, 0); /* Global values */ -webkit-text-stroke-color: inherit; -webkit-text-stroke-color: initial; -webkit-text-stroke-color: unset; Syntax Values <color> The color of the stroke. ...
-webkit-text-stroke - CSS: Cascading Style Sheets
This is a shorthand property for the longhand properties -webkit-text-stroke-width and -webkit-text-stroke-color. /* Width and color values */ -webkit-text-stroke: 4px navy; text-stroke: 4px navy; /* Global values */ -webkit-text-stroke: inherit; -webkit-text-stroke: initial; -webkit-text-stroke: unset; text-stroke: inherit; text-stroke: initial; text-stroke: unset; Constituent properties This property is a shorthand for the following CSS properties: -webkit-stroke-color -webkit-stroke-width Syntax Values <length> The width of the stroke. <color> The color of the stroke. ...
:lang() - CSS: Cascading Style Sheets
u want to target. Acceptable values are specified in the HTML spec. Examples In this example, the :lang() pseudo-class is used to match the parents of quote elements (<q>) using child combinators. Note that this doesn't illustrate the only way to do this, and that the best method to use depends on the type of document. Also note that Unicode values are used to specify some of the special quote
characters. HTML <div lang="en"><q>This English quote has a <q>nested</q> quote inside.</q></div> <div lang="fr"><q>This French quote has a <q>nested</q> quote inside.</q></div> <div lang="de"><q>This German quote has a <q>nested</q> quote inside.</q></div> CSS :lang(en) > q { quotes: '\201C' '\201D' '\2018' '\2019'; } :lang(fr) > q { quotes: '<< ' ' >>'; } :lang(de) > q { quotes: '>>' '<<' '\203...
@counter-style - CSS: Cascading Style Sheets
rker representation is up to the algorithm specified in the system descriptor. For example, if the system specified is fixed, then each of the N symbols specified in the descriptor will be used to represent the first N counter symbols. Once the specified set of symbols have exhausted, the fallback style will be used for the rest of the list. The below @counter-style rule uses images instead of
character symbols. Image values for symbols is currently an 'at risk' feature, and is not implemented in any browser. @counter-style winners-list { system: fixed; symbols: url(gold-medal.svg) url(silver-medal.svg) url(bronze-medal.svg); suffix: " "; } additive-symbols While the symbols specified in the symbols descriptor is used for constructing marker representation by most algorithms, ...
@document - CSS: Cascading Style Sheets
ovided. The expression must match the entire URL. The values provided to the url(), url-prefix(), domain(), and media-document() functions can be optionally enclosed by single or double quotes. The values provided to the regexp() function must be enclosed in quotes. Escaped values provided to the regexp() function must additionally be escaped from the CSS. For example, a . (period) matches any
character in regular expressions. To match a literal period, you would first need to escape it using regular expression rules (to \.), then escape that string using CSS rules (to \\.). @document is currently only supported in Firefox; if you wanted to replicate using such functionality in your own non-Firefox browser, you could try using this polyfill by @An-Error94, which uses a combination of a use...
font-stretch - CSS: Cascading Style Sheets
as the most expanded. <percentage> A <percentage> value between 50% and 200% (inclusive). Negative values are not allowed for this property. In earlier versions of the font-stretch specification, the property accepts only the nine keyword values. CSS Fonts Level 4 extends the syntax to accept a <percentage> value as well. This enables variable fonts to offer something more like a continuum of
character widths. For TrueType or OpenType variable fonts, the "wdth" variation is used to implement varying widths. If the font does not provide a face that exactly matches the given value, then values less than 100% map to a narrower face, and values greater than or equal to 100% map to a wider face. Keyword to numeric mapping The table below shows the mapping between keyword values and numeric p...
font-variation-settings - CSS: Cascading Style Sheets
tax /* Use the default settings */ font-variation-settings: normal; /* Set values for OpenType axis names */ font-variation-settings: "xhgt" 0.7; Values normal 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 - CSS: Cascading Style Sheets
For a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-weight descriptor to explicitly specify the font face's weights. The values for the CSS descriptor is same as that of its corresponding font property. ...
@import - CSS: Cascading Style Sheets
e for more information. list-of-media-queries Is a comma-separated list of media queries conditioning the application of the CSS rules defined in the linked URL. If the browser does not support any these queries, it does not load the linked resource. supports-query Is either a <supports-condition> or a <declaration>. Description Imported rules must precede all other types of rules, except @
charset rules; as it is not a nested statement, @import cannot be used inside conditional group at-rules. So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent @import rules. These conditional imports specify comma-separated media queries after the URL. In the absence of any media query, the import is unconditional. Specifying all for the ...
any-pointer - CSS: Cascading Style Sheets
ce, use pointer instead. Syntax The any-pointer feature is specified as a keyword value chosen from the list below. none No pointing device is available. coarse At least one input mechanism includes a pointing device of limited accuracy. fine At least one input mechanism includes an accurate pointing device. Note: More than one value can match if the available devices have different
characteristics, although none only matches when none of them are pointing devices. Examples This example creates a small checkbox for users with at least one fine pointer and a large checkbox for users with at least one coarse pointer. The big checkbox takes precedence because it is declared after the small one. HTML <input id="test" type="checkbox" /> <label for="test">Look at me!</label> CSS ...
@media - CSS: Cascading Style Sheets
primarily for screens. speech Intended for speech synthesizers. Deprecated media types: CSS2.1 and Media Queries 3 defined several additional media types (tty, tv, projection, handheld, braille, embossed, and aural), but they were deprecated in Media Queries 4 and shouldn't be used. The aural type has been replaced by speech, which is similar. Media features Media features describe specific
characteristics of the user agent, output device, or environment. Media feature expressions test for their presence or value, and are entirely optional. Each media feature expression must be surrounded by parentheses. Name Summary Notes any-hover Does any available input mechanism allow the user to hover over elements? Added in Media Queries Level 4. any-poi...
@namespace - CSS: Cascading Style Sheets
"XML-namespace-URL"; Description The defined namespaces can be used to restrict the universal, type, and attribute selectors to only select elements within that namespace. The @namespace rule is generally only useful when dealing with documents containing multiple namespaces--such as HTML5 with inline SVG or MathML, or XML that mixes multiple vocabularies. Any @namespace rules must follow all @
charset and @import rules, and precede all other at-rules and style declarations in a style sheet. @namespace can be used to define the default namespace for the style sheet. When a default namespace is defined, all universal and type selectors (but not attribute selectors, see note below) apply only to elements in that namespace. The @namespace rule can also be used to define a namespace prefix. Wh...
Attribute selectors - CSS: Cascading Style Sheets
preceded) by value. [attr$=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"] { bac...
Handling content breaks in multicol - CSS: Cascading Style Sheets
are trying to control breaks in a number of ways or on several elements, your content needs to break somewhere, so you may not always get the result you intended. To some extent your use of fragmentation is always a suggestion to the browser, to control breaks in this way if it is possible. In addition to the above, browser support for these properties is a little patchy. The compatibility data
charts on the individual property pages here on MDN can help you see which browsers support which features. In most cases, the fallback to breaks not being controlled is something you can live with, with suboptimal breaking being untidy rather than a disaster to your layout. ...
Flow Layout and Overflow - CSS: Cascading Style Sheets
an help improve the way content looks in an overflow situation. Inline-Axis Overflow The text-overflow property deals with text overflowing in the inline direction. It takes one of two values clip, in which case content is clipped when it overflows, this is the initial value and therefore the default behaviour. We also have ellipsis which renders an ellipsis, which may be replaced with a better
character for the language or writing mode in use. Block-Axis Overflow There is also a proposal for a block-overflow property, although at the time of writing the name is still up for discussion. This proposal would enable the adding of an ellipsis when text overflows in the block dimension. This is useful in the situation where you have a listing of articles, for example, and you display the lis...
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
text-decoration: none; } <div class="wrapper"> <div class="content"> <p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss
chard seakale pumpkin onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss
chard wakame kohlrabi beetroot carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p> <p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea prairie turnip leek lentil turn...
Using CSS gradients - CSS: Cascading Style Sheets
, rgba(0,0,255,0) 70.71%), radial-gradient(circle at 93.3% 75%, rgba(0,255,0,.5), rgba(0,255,0,0) 70.71%) beige; border-radius: 50%; } Using conic gradients The conic-gradient() CSS function creates an image consisting of a gradient with color transitions rotated around a center point (rather than radiating from the center). Example conic gradients include pie
charts and color wheels, but they can also be used for creating checker boards and other intersting effects. The conic-gradient syntax is similar to the radial-gradient syntax, but the color-stops are placed around a gradient arc, the circumference of a circle, rather than on the gradient line emerging from the center of the gradient, and the color-stops are percentages or degrees: absolute lengths a...
Introducing the CSS Cascade - CSS: Cascading Style Sheets
ith the same descriptor are defined, only the most appropriate @font-face, as a whole, is considered. While the declarations contained in most at-rules -- such as those in @media, @document, or @supports -- participate in the cascade, declarations contained in @keyframes don't. As with @font-face, only the at-rule as a whole is selected via the cascade algorithm. Finally, note that @import and @
charset obey specific algorithms and aren't affected by the cascade algorithm. Origin of CSS declarations The CSS cascade algorithm's job is to select CSS declarations in order to determine the correct values for CSS properties. CSS declarations originate from different origins: the User-agent stylesheets, the Author stylesheets, and the User stylesheets. Though style sheets come from these differe...
Media queries - CSS: Cascading Style Sheets
They are a key component of responsive design. For example, a media query can shrink the font size on small devices, increase the padding between paragraphs when a page is viewed in portrait mode, or bump up the size of buttons on touchscreens. In CSS, use the @media at-rule to conditionally apply part of a style sheet based on the result of a media query. Use @import to conditionally apply an entire style sheet. ...
CSS reference - CSS: Cascading Style Sheets
adiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-start-end-radiusborder-start-start-radiusborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottom@bottom-centerbox-decoration-breakbox-shadowbox-sizingbreak-afterbreak-beforebreak-insidebrightness()Ccalc()caption-sidecaret-colorch@
character-variant
character-variant()@
charset:checkedcircle()clamp()clearclipclip-pathcm<color>colorcolor-adjustcolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumnsconic-gradient()containcontentcontrast()<counter>counter-incrementcounter-resetcounter-set@counter-stylecounters()cross-fade()cubic-bezier()::cue::cue-regioncursor<cust...
animation-name - CSS: Cascading Style Sheets
none A special keyword denoting no keyframes. It can be used to deactivate an animation without changing the ordering of the other identifiers, or to deactivate animations coming from the cascade. <custom-ident> A name identifying the animation. This identifier is composed of a combination of case-sensitive letters a to z, numbers 0 to 9, underscores (_), and/or dashes (-). The first non-dash
character must be a letter. Also, two dashes are forbidden at the beginning of the identifier. Furthermore, the identifier can't be none, unset, initial, or inherit. Note: When you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. For more information...
attr() - CSS: Cascading Style Sheets
cit units. If the use of <type-or-unit> as a value for the given attribute is invalid, the attr() expression will be invalid too. If omitted, it defaults to string. The list of valid values are: Keyword Associated type Comment Default value string <string> The attribute value is treated as a CSS <string>. It is NOT reparsed, and in particular the
characters are used as-is instead of CSS escapes being turned into different
characters. An empty string. color <color> The attribute value is parsed as a hash (3- or 6-value hash) or a keyword. It must be a valid CSS <string> value. Leading and trailing spaces are stripped. currentcolor url <url> The attribute value is parsed as a string that i...
background - CSS: Cascading Style Sheets
g"); The background property is specified as one or more background layers, separated by commas. The syntax of each layer is as follows: Each layer may include zero or one occurrences of any of the following values: <attachment> <bg-image> <position> <bg-size> <repeat-style> The <bg-size> value may only be included immediately after <position>, separated with the '/'
character, like this: "center/80%". The <box> value may be included zero, one, or two times. If included once, it sets both background-origin and background-clip. If it is included twice, the first occurrence sets background-origin, and the second sets background-clip. The <background-color> value may only be included in the last layer specified. Values <attachment> See background-attachment ...
caret-color - CSS: Cascading Style Sheets
This is sometimes referred to as the text input cursor. The caret appears in elements such as <input> or those with the contenteditable attribute. The caret is typically a thin vertical line that flashes to help make it more noticeable. By default, it is black, but its color can be altered with this property. 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 - CSS: Cascading Style Sheets
or normal and none, several values can be used simultaneously */ content: open-quote chapter_counter; /* Global values */ content: inherit; content: initial; content: unset; Syntax Values none The pseudo-element is not generated. normal Computes to none for the ::before and ::after pseudo-elements. <string> Specifies the "alt text" for the element. This value can be any number of text
characters. Non-Latin
characters must be encoded using their Unicode escape sequences: for example, \000A9 represents the copyright symbol. <image> An <image>, denoted by the <url> or <gradient> data type, or part of the webpage, defined by the element() function, denoting the content to display. <counter>() The value of a CSS counter, generally a number. It can be displayed using either the count...
counters() - CSS: Cascading Style Sheets
wo dashes and can't be none, unset, initial, or inherit. <counter-style> A counter style name or symbols() function, where a counter style name is a numeric, alphabetic, or symbolic simple predefined counter style, a complex longhand east Asian or Ethiopic predefined counter style, or other predefined counter style. If omitted, the counter-style defaults to decimal <string> Any number of text
characters. Non-Latin
characters must be encoded using their Unicode escape sequences: for example, \000A9 represents the copyright symbol. Formal syntax counters( <custom-ident>, <string>, <counter-style>? )where <counter-style> = <counter-style-name> | symbols()where <counter-style-name> = <custom-ident> Examples default value compared to upper Roman HTML <ol> <li> <ol> <li></l...
font-kerning - CSS: Cascading Style Sheets
The font-kerning CSS property sets the use of the kerning information stored in a font. 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. Kerning defines how letters are spaced. In well-kerned fonts, this feature makes
character spacing more uniform and pleasant to read than it would otherwise be. In the image below, for instance, the examples on the left do not use kerning, while the ones on the right do: Syntax The font-kerning property is specified as one of the keyword values listed below. Values auto The browser determines whether font kerning should be used or not. For example, some browsers will disab...
font-language-override - CSS: Cascading Style Sheets
ing> values */ font-language-override: "ENG"; /* Use English glyphs */ font-language-override: "TRK"; /* Use Turkish glyphs */ /* Global values */ font-language-override: initial; font-language-override: inherit; font-language-override: unset; By default, HTML's lang attribute tells browsers to display glyphs designed specifically for that language. ...
font-variant-caps - CSS: Cascading Style Sheets
e-examples and send us a pull request. When a given font includes capital letter glyphs of multiple different sizes, this property selects the most appropriate ones. If petite capital glyphs are not available, they are rendered using small capital glyphs. If these are not present, the browser synthesizes them from the uppercase glyphs. Fonts sometimes include special glyphs for various caseless
characters (such as punctuation marks) to better match the capitalized
characters around them. However, small capital glyphs are never synthesized for caseless
characters. Language-specific rules This property accounts for language-specific case mapping rules. For example: In Turkic languages, such as Turkish (tr), Azerbaijani (az), Crimean Tatar (crh), Volga Tatar (tt), and Bashkir (ba), there a...
font-weight - CSS: Cascading Style Sheets
t, in descending order. If no match is found, look for available weights greater than the target, in ascending order. If a weight greater than 500 is given, look for available weights greater than the target, in ascending order. If no match is found, look for available weights less than the target, in descending order. Meaning of relative weights When lighter or bolder is specified, the below
chart shows how the absolute font weight of the element is determined. Note that when using relative weights, only four font weights are considered -- thin (100), normal (400), bold (700), and heavy (900). If a font-family has more weights available, they are ignored for the purposes of relative weight calculation. Inherited value bolder lighter 100 400 100 ...
hanging-punctuation - CSS: Cascading Style Sheets
values. One-value syntax uses any one of the keyword values in the list below. Two-value syntax uses one of the following: first together with any one of last, allow-end, or force-end last together with any one of first, allow-end, or force-end Three-value syntax uses one of the following: first, allow-end, and last first, force-end, and last Values none No
character hangs. first An opening bracket or quote at the start of the first formatted line of an element hangs. last A closing bracket or quote at the end of the last formatted line of an element hangs. force-end A stop or comma at the end of a line hangs. allow-end A stop or comma at the end of a line hangs if it does not otherwise fit prior to justification. Formal definition Initial val...
ime-mode - CSS: Cascading Style Sheets
value. Formal definition Initial valueautoApplies totext fieldsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | normal | active | inactive | disabled Examples Disabling input method support This example disables input method support for a form field. In the past, this was commonly used on fields that entered data into databases which didn't support extended
character sets. <input type="text" name="name" value="initial value" style="ime-mode: disabled"> Note: You shouldn't rely on disabling IME to prevent extended
characters from passing through your form. Even with IME disabled, users can still paste extended
characters into your form's fields. Specifications Specification Status Comment CSS Basic User Interface Module L...
<integer> - CSS: Cascading Style Sheets
ve integer (with a leading + sign) -456 Negative integer 0 Zero +0 Zero, with a leading + -0 Zero, with a leading - Invalid integers 12.0 This is a <number>, not an <integer>, though it represents an integer. 12. Decimal points are not allowed. +---12 Only one leading +/- is allowed. ten Letters are not allowed. _5 Special
characters are not allowed. \35 Escaped Unicode
characters are not allowed, even if they are an integer (here: 5). \4E94 Non-arabic numerals are not allowed, even when escaped (here: the Japanese 5, ?). 3e4 Scientific notation is not allowed. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<integer>'...
line-break - CSS: Cascading Style Sheets
ne-break: unset; Syntax Values auto Break text using the default line break rule. loose Break text using the least restrictive line break rule. Typically used for short lines, such as in newspapers. normal Break text using the most common line break rule. strict Break text using the most stringent line break rule. anywhere There is a soft wrap opportunity around every typographic
character unit, including around any punctuation
character or preserved white spaces, or in the middle of words, disregarding any prohibition against line breaks, even those introduced by
characters with the GL, WJ, or ZWJ
character class or mandated by the word-break property. The different wrapping opportunities must not be prioritized. Hyphenation is not applied. Formal definition Initial valu...
line-height - CSS: Cascading Style Sheets
Prefer unitless numbers for line-height values This example shows why it is better to use <number> values instead of <length> values. We will use two <div> elements. The first, with the green border, use...
list-style-type - CSS: Cascading Style Sheets
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. The color of the marker will be the same as the computed color of the element it applies to. Only a few elements (<li> and <summary>) have a default value of display: list-item. However, the list-style-type property may be applied to any element whose display value is set to list-item. ...
<percentage> - CSS: Cascading Style Sheets
here is no space between the symbol and the number. Interpolation When animated, values of the <percentage> data type are interpolated as real, floating-point numbers. The speed of the interpolation is determined by the timing function associated with the animation. ...
pointer-events - CSS: Cascading Style Sheets
nd visibility properties do not affect event processing. all SVG only (experimental for HTML). The element can only be the target of a pointer event when the pointer is over the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the fill, stroke, and visibility properties do not affect event processing. Description When this property is unspecified, the same
characteristics of the visiblePainted value apply to SVG content. In addition to indicating that the element is not the target of pointer events, the value none instructs the pointer event to go "through" the element and target whatever is "underneath" that element instead. Note that preventing an element from being the target of pointer events by using pointer-events does not necessarily mean that ...
repeating-conic-gradient() - CSS: Cascading Style Sheets
at that location. While you can mix and match different angle units, don't. It makes CSS hard to read. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. While it is possible to create pie
charts, checkerboards, and other effects with conic gradients, CSS images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Gu...
text-decoration-skip - CSS: Cascading Style Sheets
xt-decoration-skip: inherit; text-decoration-skip: initial; text-decoration-skip: unset; Syntax Values none Nothing is skipped. Thus, text decoration is drawn for all text content and across atomic inline-level boxes. objects The entire margin box of the element is skipped if it is an atomic inline such as an image or inline-block. spaces All spacing is skipped: all Unicode white space
characters and all word separators, plus any adjacent letter-spacing or word-spacing. leading-spaces The same as spaces, except that only leading spaces are skipped. trailing-spaces The same as spaces, except that only trailing spaces are skipped. edges The start and end of the text decoration is inset slightly (e.g., by half of the line thickness) from the content edge of the decorating box. Th...
text-emphasis-style - CSS: Cascading Style Sheets
rks. The filled double-circle is '?' (U+25C9), and the open double-circle is '?' (U+25CE). triangle Display triangles as marks. The filled triangle is '?' (U+25B2), and the open triangle is '?' (U+25B3). sesame Display sesames as marks. The filled sesame is '?' (U+FE45), and the open sesame is '?' (U+FE46). <string> Display the given string as marks. Authors should not specify more than one
character in <string>. The UA may truncate or ignore strings consisting of more than one grapheme cluster. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax none | [ [ filled | open ] | [ dot | circle | double-circle | triangle | sesame ] ] | <string> Examples h2 { text-emphasis-style: sesame; } Specifications ...
text-overflow - CSS: Cascading Style Sheets
right end of the line. Each value is specified as one of: one of the keyword values: clip, ellipsis, fade the function fade(), which is passed a <length> or a <percentage> to control the fade distance a <string>. Values clip The default for this property. This keyword value will truncate the text at the limit of the content area, therefore the truncation can happen in the middle of a
character. To clip at the transition between
characters you can specify text-overflow as an empty string, if that is supported in your target browsers: text-overflow: '';. ellipsis This keyword value will display an ellipsis ('...', U+2026 Horizontal Ellipsis) to represent clipped text. The ellipsis is displayed inside the content area, decreasing the amount of text displayed. If there is not enough...
scale3d() - CSS: Cascading Style Sheets
t of scaling is defined by a vector, it can resize different dimensions at different scales. Its result is a <transform-function> data type. 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 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 nega...
translate3d() - CSS: Cascading Style Sheets
The translate3d() CSS function repositions an element in 3D space. Its result is a <transform-function> data type. 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 transformation is
characterized by a three-dimensional vector. Its coordinates define how much the element moves in each direction. Syntax translate3d(tx, ty, tz) Values tx Is a <length> or <percentage> representing the abscissa of the translating vector. ty Is a <length> or <percentage> representing the ordinate of the translating vector. tz Is a <length> representing the z component of the translating vector. It can't be a <percentage> v...
unicode-bidi - CSS: Cascading Style Sheets
roperty; the implicit part of the bidirectional algorithm is ignored. isolate This keyword indicates that the element's container directionality should be calculated without considering the content of this element. The element is therefore isolated from its siblings. When applying its bidirectional-resolution algorithm, its container element treats it as one or several U+FFFC Object Replacement
Character, i.e. like an image. isolate-override This keyword applies the isolation behavior of the isolate keyword to the surrounding content and the override behavior of the bidi-override keyword to the inner content. plaintext This keyword makes the elements directionality calculated without considering its parent bidirectional state or the value of the direction property. The directionality is ...
url() - CSS: Cascading Style Sheets
URNs. CSS Values and Units Level 3 returned to the narrower, initial definition. Now, url() denotes only true <url>s. Syntax Values <string> <url> A url, which is a relative or absolute address, or pointer, to the web resource to be included, or a data uri, optionally in single or double quotes. Quotes are required if the URL includes parentheses, whitespace, or quotes, unless these
characters are escaped, or if the address includes control
characters above 0x7e. Double quotes cannot occur inside double quotes and single quotes cannot occur inside single quotes unless escaped. The following are all valid and equivalent: <css_property>: url("https://example.com/image.png") <css_property>: url('https://example.com/image.png') <css_property>: url(https://example.com/image.png) ...
<url> - CSS: Cascading Style Sheets
, url() denotes only true <url>s. Syntax The <url> data type is specified using the url() functional notation. It may be written without quotes, or surrounded by single or double quotes. Relative URLs are allowed, and are relative to the URL of the stylesheet (not to the URL of the web page). If you choose to write the URL without quotes, use a backslash (\) before any parentheses, whitespace
characters, single quotes (') and double quotes (") that are part of the URL. <a_css_property>: url("http://mysite.example.com/mycursor.png") <a_css_property>: url('http://mysite.example.com/mycursor.png') <a_css_property>: url(http://mysite.example.com/mycursor.png) Examples .topbanner { background: url("topbanner.png") #00D no-repeat fixed; } ul { list-style: square url(http://www.example.
var() - CSS: Cascading Style Sheets
ues <custom-property-name> A custom property's name represented by an identifier that starts with two dashes. Custom properties are solely for use by authors and users; CSS will never give them a meaning beyond what is presented here. <declaration-value> The custom property's fallback value, which is used in case the custom property is invalid in the used context. This value may contain any
character except some
characters with special meaning like newlines, unmatched closing brackets, i.e. ), ], or }, top-level semicolons, or exclamation marks. Examples :root { --main-bg-color: pink; } body { background-color: var(--main-bg-color); } /* Fallback */ /* In the component's style: */ .component .header { color: var(--header-color, blue); /* header-color isn't set, and so remains...
word-break - CSS: Cascading Style Sheets
l; word-break: break-all; word-break: keep-all; word-break: break-word; /* deprecated */ /* Global values */ word-break: inherit; word-break: initial; word-break: unset; The word-break property is specified as a single keyword chosen from the list of values below. Values normal Use the default line break rule. break-all To prevent overflow, word breaks should be inserted between any two
characters (excluding Chinese/Japanese/Korean text). keep-all Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal. break-word Has the same effect as word-break: normal and overflow-wrap: anywhere, regardless of the actual value of the overflow-wrap property. Note: In contrast to word-break: break-word and overflow-wrap: break-...
regexp:match() - EXSLT
ctions, XPath axes regexp:match() performs regular expression matching on a string, returning the submatches found as a result. Syntax regexp:match(targetString, regExpString[, flagsString]) Parameters targetString The string to perform regular expression matching upon. regExpString The JavaScript style regular expression to evaluate. flagsStringOptional An optional string containing
character flags. The
character flags are: g Global match The submatches from every match in the string are returned. If this flag isn't specified, only the submatches from the first match are returned. i Case insensitive match If this flag is specified, the match is performed in a case insensitive fashion. Returns A node set of match elements, each of which has the string value equal to a...
regexp:replace() - EXSLT
regexp:replace() replaces the portions of a string that match a given regular expression with the contents of another string. Syntax regexp:replace(originalString, regExpString, flagsString, replaceString) Parameters originalString The string perform a search-and-replace operation upon. regExpString The JavaScript style regular expression to evaluate. flagsString The string containing
character flags. replaceString The string with which the matched substrings are to be replaced. The
character flags are: g - Global replace If this flag is specified, all occurrences of the regular expression within the originalString are replaced. Otherwise only the first occurrence is replaced. i - Case insensitive match If this flag is specified, the match is performed in a case insensiti...
regexp:test() - EXSLT
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes regexp:test() tests to see whether a string matches a specified regular expression. Syntax regexp:test(testString, regExpString[, flagsString]) Parameters testString The string to test.. regExpString The JavaScript style regular expression to evaluate. flagsStringOptional An optional string containing
character flags. The
character flags are: g Global match Has no effect for this function; it's allowed for consistency with other regexp functions. i Case insensitive match If this flag is specified, the match is performed in a case insensitive fashion. Returns true if the specified regexp matches the test string. Specifications EXSLT - REGEXP:TEST ...
Strings (str) - EXSLT
The namespace for the Strings package is http://exslt.org/strings. str:concat()str:concat() returns a string containing all the string values in a node-set concatenated together.str:split()str:split() splits a string using a pattern string to determine where the splits should occur, returning a node-set containing the resulting strings.str:tokenize()str:tokenize() splits a string using a set of
characters as delimiters that determine where the splits should occur, returning a node-set containing the resulting strings. ...
Challenge solutions - Developer guides
ing 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 orange, 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 text. Solution In the menu above the right-hand pane, choose CSS Rules. You...
Mutation events - Developer guides
) "mutation name events", i.e. DOMElementNameChanged and DOMAttributeNameChanged are not supported in Firefox (as of version 11), and probably in other browsers as well. ... Dottoro documents browser support for mutation events. ...
XHTML - Developer guides
XHTML is a term that was historically used to describe HTML documents written to conform with XML syntax rules. The following example shows an HTML document and corresponding "XHTML" document, and the accompanying HTTP Content-Type headers they should be served with. ...
Mobile Web Development - Developer guides
This page provides an overview of some of the main techniques needed to design web sites that work well on mobile devices. We've organized it into two sections, designing for mobile devices and cross-browser compatibility. Also see Jason Grlicky's guide to mobile-friendliness for web developers. Designing for mobile devices Mobile devices have quite different hardware
characteristics compared with desktop or laptop computers. Their screens are usually smaller, obviously, but they also usually automatically switch the screen orientation between portrait and landscape mode as the user rotates the device. They usually have touch screens for user input. APIs like geolocation or orientation are either not supported on desktops or are much less useful, and these APIs give mobile users new...
Writing forward-compatible websites - Developer guides
still change in unexpected ways. Most especially, don't use the unprefixed version if no browser actually supports it. You can't assume that the syntax of the final version will be the same as the syntax of any of the prefixed versions. Code hygiene Avoid missing > Passing a validator is one way to ensure this, but even if your website doesn't validate entirely you should make sure all your >
characters are present. Missing those can lead to unexpected situations due to a following tag name being treated as an attribute on a previous tag. This can work for a bit, then break if a specification attaches a meaning to that attribute. Here's an example that works in browsers without HTML5 support but breaks in a browser supporting HTML5: <form action="http://www.example.com"> <input type="su...
HTML attribute: accept - HTML: Hypertext Markup Language
ws you to select multiple iamges. See the multiple attribute for more information. Unique file type specifiers A unique file type specifier is a string that describes a type of file that may be selected by the user in an <input> element of type file. Each unique file type specifier may take one of the following forms: A valid case-insensitive filename extension, starting with a period (".")
character. For example: .jpg, .pdf, or .doc. A valid MIME type string, with no extensions. The string audio/* meaning "any audio file". The string video/* meaning "any video file". The string image/* meaning "any image file". The accept attribute takes as its value a string containing one or more of these unique file type specifiers, separated by commas. For example, a file picker that needs con...
HTML attribute: maxlength - HTML: Hypertext Markup Language
This must be an integer value 0 or higher. If no maxlength is specified, or an invalid value is specified, the input or textarea has no maximum length. Any maxlength value must be greater than or equal to the value of minlength, if present and valid. The input will fail constraint validation if the length of the text value of the field is greater than maxlength UTF-16 code units long. Constraint validation is only applied when the value is changed by the user. ...
HTML attribute: size - HTML: Hypertext Markup Language
This must be an integer value 0 or higher. If no size is specified, or an invalid value 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. The size attribute has no impact on constraint validation. ...
<acronym> - HTML: Hypertext Markup Language
Usage note: This element has been removed in HTML5 and shouldn't be used anymore. Instead web developers should use the <abbr> element. Attributes This element only has global attributes, which are common to all elements. DOM Interface This element implements the HTMLElement interface. Implementation note: Up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element. ...
<bdo>: The Bidirectional Text Override element - HTML: Hypertext Markup Language
The HTML Bidirectional Text Override element (<bdo>) overrides the current directionality of text, so that the text within is rendered in a different direction. 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. The text's
characters are drawn from the starting point in the given direction; the individual
characters' orientation is not affected (so
characters don't get drawn backward, for example). Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitt...
<em>: The Emphasis element - HTML: Hypertext Markup Language
that produce similar results. <em> and <i> are a common example, since they both italicize text. What's the difference? Which should you use? By default, the visual result is the same. However, the semantic meaning is different. The <em> element represents stress emphasis of its contents, while the <i> element represents text that is set off from the normal prose, such a foreign word, fictional
character thoughts, or when the text refers to the definition of a word instead of representing its semantic meaning. (The title of a work, such as the name of a book or movie, should use <cite>.) This means the right one to use depends on the situation. Neither is for purely decorational purposes, that's what CSS styling is for. An example for <em> could be: "Just do it already!", or: "We had to do...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
protocol (like the subject line in HTML email), zero or more elements of metadata content. Otherwise, one or more elements of metadata content where exactly one is a <title> element. Tag omission The start tag may be omitted if the first thing inside the <head> element is an element. The end tag may be omitted if the first thing following the <head> element is not a space
character or a comment. Permitted parents An <html> element, as its first child. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLHeadElement Attributes This element includes the global attributes. profile The URIs of one or more metadata profiles, separated by white space. Example <!docty...
<hgroup> - HTML: Hypertext Markup Language
n the abstract outline. To produce any (non-abstract) rendered view of such an outline, some choice must be made in the design of the rendering tool about how to render <hgroup> headings in such a way as to convey their multi-level nature. ...
<input type="datetime-local"> - HTML: Hypertext Markup Language
rmats differ from the actual value; the displayed date and time are formatted according to the user's locale as reported by their operating system, whereas the date/time value is always formatted yyyy-MM-ddThh:mm. When the above value submitted to the server, for example, it will look like partydate=2017-06-01T08:30. Note: Also bear in mind that if such data is submitted via HTTP GET, the colon
character will need to be escaped for inclusion in the URL parameters, e.g. partydate=2017-06-01T08%3A30. See encodeURI() for one way to do this. You can also get and set the date value in JavaScript using the HTMLInputElement.value property, for example: var dateControl = document.querySelector('input[type="datetime-local"]'); dateControl.value = '2017-06-01T08:30'; There are several methods prov...
<input type="file"> - HTML: Hypertext Markup Language
, it is still not standard and should not be used unless you have no alternative. Unique file type specifiers A unique file type specifier is a string that describes a type of file that may be selected by the user in an <input> element of type file. Each unique file type specifier may take one of the following forms: A valid case-insensitive filename extension, starting with a period (".")
character. For example: .jpg, .pdf, or .doc. A valid MIME type string, with no extensions. The string audio/* meaning "any audio file". The string video/* meaning "any video file". The string image/* meaning "any image file". The accept attribute takes as its value a string containing one or more of these unique file type specifiers, separated by commas. For example, a file picker that needs con...
<input type="time"> - HTML: Hypertext Markup Language
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 strange effects across browsers, so is not completely reliable. It takes an ...
<li> - HTML: Hypertext Markup Language
item as defined by the <ol> element. The only allowed value for this attribute is a number, even if the list is displayed with Roman numerals or letters. List items that follow this one continue numbering from the value set. The value attribute has no meaning for unordered lists (<ul>) or for menus (<menu>). Note: This attribute was deprecated in HTML4, but reintroduced in HTML5. type This
character attribute indicates the numbering type: a: lowercase letters A: uppercase letters i: lowercase Roman numerals I: uppercase Roman numerals 1: numbers This type overrides the one used by its parent <ol> element, if any. Note: This attribute has been deprecated; use the CSS list-style-type property instead. Examples For more detailed examples, see the <ol> and <ul> pages. ...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
ecure context This attribute identifies a resource that might be required by the next navigation and that the user agent should retrieve it. This allows the user agent to respond faster when the resource is requested in the future. target Defines the frame or window name that has the defined linking relationship or that will show the rendering of any linked resource. Obsolete attributes
charset This attribute defines the
character encoding of the linked resource. The value is a space- and/or comma-delimited list of
character sets as defined in RFC 2045. The default value is iso-8859-1. Usage note: To produce the same effect as this obsolete attribute, use the Content-Type HTTP header on the linked resource. rev The value of this attribute shows the relationship of the curre...
<map> - HTML: Hypertext Markup Language
ment that accepts phrasing content. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLMapElement Attributes This element includes the global attributes. name The name attribute gives the map a name so that it can be referenced. The attribute must be present and must have a non-empty value with no space
characters. The value of the name attribute must not be a compatibility-caseless match for the value of the name attribute of another <map> element in the same document. If the id attribute is also specified, both attributes must have the same value. Examples <map name="primary"> <area shape="circle" coords="75,75,75" href="left.html"> <area shape="circle" coords="275,75,75" href="right.html"> ...
<option>: The HTML Option element - HTML: Hypertext Markup Language
epresent menu items in popups and other lists of items in an HTML 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. Content categories None. Permitted content Text, possibly with escaped
characters (like é). Tag omission The start tag is mandatory. The end tag is optional if this element is immediately followed by another <option> element or an <optgroup>, or if the parent element has no more content. Permitted parents A <select>, an <optgroup> or a <datalist> element. Implicit ARIA role option Permitted ARIA roles No role permitt...
<p>: The Paragraph element - HTML: Hypertext Markup Language
eparated by indenting their first lines. This is often used to take up less space, such as to save paper in print.</p> <p>Writing that is intended to be edited, such as school papers and rough drafts, uses both blank lines and indentation for separation. In finished works, combining both is considered redundant and amateurish.</p> <p>In very old writing, paragraphs were separated with a special
character: ?, the <i>pilcrow</i>. Nowadays, this is considered claustrophobic and hard to read.</p> <p>How hard to read? See for yourself: <button data-toggle-text="Oh no! Switch back!">Use pilcrow for paragraphs</button> </p> CSS p { margin: 0; text-indent: 3ch; } p.pilcrow { text-indent: 0; display: inline; } p.pilcrow + p.pilcrow::before { content: " ? "; } JavaScript document.
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
instead treat it as a <pre> element that still interprets HTML within. If <plaintext> is the first element on the page (other than any non-displayed elements, like <head>), do not use HTML at all. Instead serve a text file with the text/plain MIME-type. Instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. Escape any <, > and &
characters, to prevent browsers inadvertently parsing content the element content as HTML. A monospaced font can be applied to any HTML element via a CSS font-family style with the monospace generic value. Attributes This element has no other attributes than the global attributes common to all elements. DOM interface This element implements the HTMLElement interface. Implementation note: In G...
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
element. Permitted parents A <ruby> element. <rp> must be positioned immediately before or after an <rt> element. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Ruby annotations are for showing pronunciation of East Asian
characters, like using Japanese furigana or Taiwanese bopomofo
characters. The <rp> element is used in the case of lack of <ruby> element support; the <rp> content provides what should be displayed in order to indicate the presence of a ruby annotation, usually parentheses. Examples This example uses ruby annotations to display the Romaji equivalents for each
character. <ruby> ? <rp>(</rp><rt>K...
<rt>: The Ruby Text element - HTML: Hypertext Markup Language
an <rt> or <rp> element, or if there is no more content in the parent element Permitted parents A <ruby> element. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. ...
<rtc>: The Ruby Text Container element - HTML: Hypertext Markup Language
<rb> elements can have both pronunciation (<rt>) and semantic (<rtc>) annotations. 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 Phrasing content or <rt> elements. ...
<style>: The Style Information element - HTML: Hypertext Markup Language
o avoid unexpected cascade issues. In the same manner as <link> elements, <style> elements can include media attributes that contain media queries, allowing you to selectively apply internal stylesheets to your document depending on media features such as viewport width. Attributes This element includes the global attributes. type This attribute defines the styling language as a MIME type (
charset should not be specified). This attribute is optional and defaults to text/css if it is not specified; values other than the empty string or text/css are not used. Note: There is very little reason to include this attribute in modern web documents. media This attribute defines which media the style should be applied to. Its value is a media query, which defaults to all if the attribute is mis...
<title>: The Document Title element - HTML: Hypertext Markup Language
r in which to list pages in search results. Also, the title is the initial "hook" by which you grab the attention of readers glancing at the search results page. A few guidelines and tips for composing good titles: Avoid one- or two-word titles. Use a descriptive phrase, or a term-definition pairing for glossary or reference-style pages. Search engines typically display about the first 55-60
characters of a page title. Text beyond that may be lost, so try not to have titles longer than that. If you must use a longer title, make sure the important parts come earlier and that nothing critical is in the part of the title that is likely to be dropped. Don't use "keyword blobs." If your title is just a list of words, algorithms often reduce your page's position in the search results. Try to ...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
al content, usually extra background information. For example the text at the beginning of the Star Wars films, or the date, time, and location of a scene. captions Closed captions provide a transcription and possibly a translation of audio. It may include important non-verbal information such as music cues or sound effects. It may indicate the cue's source (e.g. music, text,
character). Suitable for users who are deaf or when the sound is muted. descriptions Textual description of the video content. Suitable for users who are blind or where the video cannot be seen. chapters Chapter titles are intended to be used when the user is navigating the media resource. metadata Tracks used by scripts. Not visible to the us...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
creates inline text which is presented using the user agent's default monospace font face. This element was created for the purpose of rendering text as it would be displayed on a fixed-width display such as a teletype, text-only screen, or line printer. The terms non-proportional, monotype, and monospace are used interchangeably and have the same general meaning: they describe a typeface whose
characters are all the same number of pixels wide. This element is obsolete, however. You should use the more semantically helpful <code>, <kbd>, <samp>, or <var> elements for inline text that needs to be presented in monospace type, or the <pre> tag for content that should be presented as a separate block. If none of the semantic elements are appropriate for your use case (for example, if you simpl...
<wbr> - HTML: Hypertext Markup Language
+200B ZERO-WIDTH SPACE code point. In particular, it behaves like a Unicode bidi BN code point, meaning it has no effect on bidi-ordering: <div dir=rtl>123,<wbr>456</div> displays, when not broken on two lines, 123,456 and not 456,123. For the same reason, the <wbr> element does not introduce a hyphen at the line break point. To make a hyphen appear only at the end of a line, use the soft hyphen
character entity (­) instead. This element was first implemented in Internet Explorer 5.5 and was officially defined in HTML5. Example The Yahoo Style Guide recommends breaking a URL before punctuation, to avoid leaving a punctuation mark at the end of the line, which the reader might mistake for the end of the URL. <p>http://this<wbr>.is<wbr>.a<wbr>.really<wbr>.long<wbr>.example<wbr>.com/With...
<xmp> - HTML: Hypertext Markup Language
Summary The HTML Example Element (<xmp>) renders text between the start and end tags without interpreting the HTML in between and using a monospaced font. The HTML2 specification recommended that it should be rendered wide enough to allow 80
characters per line. Note: Do not use this element. It has been deprecated since HTML3.2 and was not implemented in a consistent way. It was completely removed from the language in HTML5. Use the <pre> element or, if semantically adequate, the <code> element instead. Note that you will need to escape the '<'
character as '<' to make sure it is not interpreted as markup. A monospaced font can also be obtained on any element, by applying an adequate CSS style using monospace as the generic-font value for the font-family property. Attributes ...
autocapitalize - HTML: Hypertext Markup Language
it is entered/edited by the user. The attribute must take one of the following values: off or none: No autocapitalization is applied (all letters default to lowercase) on or sentences: The first letter of each sentence defaults to a capital letter; all other letters default to lowercase words: The first letter of each word defaults to a capital letter; all other letters default to lowercase
characters: All letters should default to uppercase The autocapitalize attribute doesn't affect behavior when typing on a physical keyboard. Instead, it affects the behavior of other input mechanisms, such as virtual keyboards on mobile devices and voice input. The behavior of such mechanisms is that they often assist users by automatically capitalizing the first letter of sentences. The autocapital...
dir - HTML: Hypertext Markup Language
es and send us a pull request. It can have the following values: ltr, which means left to right and is to be used for languages that are written from the left to the right (like English); rtl, which means right to left and is to be used for languages that are written from the right to the left (like Arabic); auto, which lets the user agent decide. It uses a basic algorithm as it parses the
characters inside the element until it finds a
character with a strong directionality, then applies that directionality to the whole element. Usage notes: This attribute is mandatory for the <bdo> element where it has a different semantic meaning. This attribute is not inherited by the <bdi> element. If not set, its value is auto. This attribute can be overridden by the CSS properties d...
id - HTML: Hypertext Markup Language
at human-readable can be useful for code comprehension, e.g. consider ticket-18659 versus r45tgfe-freds&$@). id's value must not contain whitespace (spaces, tabs etc.). Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. In contrast to the class attribute, which allows space-separated values, elements can only have one single ID value. Note: Using
characters except ASCII letters, digits, '_', '-' and '.' may cause compatibility problems, as they weren't allowed in HTML 4. Though this restriction has been lifted in HTML5, an ID should start with a letter for compatibility. Specifications Specification Status Comment HTML Living StandardThe definition of 'id' in that specification. Living Standard No change from l...
inputmode - HTML: Hypertext Markup Language
lephone number should typically use <input type="tel">instead. search A virtual keyboard optimized for search input. For instance, the return/submit key may be labeled "Search", along with possible other optimizations. Inputs that require a search query should typically use <input type="search"> instead. email A virtual keyboard optimized for entering email addresses. Typically includes the @
character as well as other optimizations. Inputs that require email addresses should typically use <input type="email"> instead. url A keypad optimized for entering URLs. This may have the / key more prominent, for example. Enhanced features could include history access and so on. Inputs that require a URL should typically use <input type="url"> instead. Specifications Specification S...
lang - HTML: Hypertext Markup Language
ge tag is not valid according to BCP47, it is set to invalid. Language tag syntax The full BCP47 syntax is in-depth enough to mark extremely specific language dialects, but most usage is much simpler. A language tag is made of hyphen-separated language subtags, where each subtag indicates a certain property of the language. The 3 most common subtags are: Language subtag Required. A 2-or-3-
character code that defines the basic language, typically written in all lowercase. For example, the language code for English is en, and the code for Badeshi is bdz. Script subtag Optional. This subtag defines the writing system used for the language, and is always 4
characters long, with the first letter capitalized. For example, French-in-Braille is fr-Brai and ja-Kana is Japanese written with th...
title - HTML: Hypertext Markup Language
Labeling <iframe> elements for assistive technology Providing a programmatically associated label for an <input> element as a fallback for a real <label> Labeling controls in data tables Additional semantics are attached to the title attributes of the <link>, <abbr>, <input>, and <menuitem> elements. Multiline titles The title attribute may contain several lines. Each U+000A LINE FEED (LF)
character represents a line break. Some caution must be taken, as this means the following renders across two lines: HTML <p>Newlines in <code>title</code> should be taken into account, like <abbr title="This is a multiline title">example</abbr>.</p> Result Title attribute inheritance If an element has no title attribute, then it inherits it from its parent node, which in turn may inherit it fr...
Inline elements - HTML: Hypertext Markup Language
Inline elements are those which only occupy the space bounded by the tags defining the element, instead of breaking the flow of the content. In this article, we'll examine HTML inline-level elements and how they differ from block-level elements. An inline element does not start on a new line and only takes up as much width as necessary. Inline vs. ...
Quirks Mode and Standards Mode - HTML: Hypertext Markup Language
nly a very small number of quirks implemented. How do browsers determine which mode to use? For HTML documents, browsers use a DOCTYPE in the beginning of the document to decide whether to handle it in quirks mode or standards mode. To ensure that your page uses full standards mode, make sure that your page has a DOCTYPE like in this example: <!DOCTYPE html> <html lang="en"> <head> <meta
charset=UTF-8> <title>Hello World!</title> </head> <body> </body> </html> The DOCTYPE shown in the example, <!DOCTYPE html>, is the simplest possible, and the one recommended by HTML5. Earlier versions of the HTML standard recommended other variants, but all existing browsers today will use full standards mode for this DOCTYPE, even the dated Internet Explorer 6. There are no valid reasons ...
HTML reference - HTML: Hypertext Markup Language
lements; they can be used on all elements, though they may have no effect on some elements. Link types In HTML, the following link types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, or <link> element. Content Categories Every HTML element is a member of one or more content categories -- these categories group elements that share common
characteristics. Date and time formats used in HTML Certain HTML elements allow you to specify dates and/or times as the value or as the value of an attribute. These include the date and time variations of the <input> element as well as the <ins> and <del> elements. ...
HTTP authentication - HTTP
-origin images A potential security hole recently been fixed by browsers is authentication of cross-site images. From Firefox 59 onwards, image resources loaded from different origins to the current document are no longer able to trigger HTTP authentication dialogs (bug 1423146), preventing user credentials being stolen if attackers were able to embed an arbitrary image into a third-party page.
Character encoding of HTTP authentication Browsers use utf-8 encoding for usernames and passwords. Firefox once used ISO-8859-1, but changed to utf-8 for parity with other browsers and to avoid potential problems as described in bug 1419658. WWW-Authenticate and Proxy-Authenticate headers The WWW-Authenticate and Proxy-Authenticate response headers define the authentication method that should be u...
Evolution of HTTP - HTTP
eveloper.mozilla.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br Referer: https://developer.mozilla.org/docs/Glossary/Simple_header 200 OK Connection: Keep-Alive Content-Encoding: gzip Content-Type: text/html;
charset=utf-8 Date: Wed, 20 Jul 2016 10:55:30 GMT Etag: "547fa7e369ef56031dd3bff2ace9fc0832eb251a" Keep-Alive: timeout=5, max=1000 Last-Modified: Tue, 19 Jul 2016 00:59:33 GMT Server: Apache Transfer-Encoding: chunked Vary: Cookie, Accept-Encoding (content) GET /static/img/header-background.png HTTP/1.1 Host: developer.cdn.mozilla.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0...
Cross-Origin Resource Sharing (CORS) - HTTP
Once the preflight request is complete, the real request is sent: POST /doc HTTP/1.1 Host: bar.other User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:71.0) Gecko/20100101 Firefox/71.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Connection: keep-alive X-PINGOTHER: pingpong Content-Type: text/xml;
charset=UTF-8 Referer: https://foo.example/examples/preflightInvocation.html Content-Length: 55 Origin: https://foo.example Pragma: no-cache Cache-Control: no-cache <person><name>Arun</name></person> HTTP/1.1 200 OK Date: Mon, 01 Dec 2008 01:15:40 GMT Server: Apache/2 Access-Control-Allow-Origin: https://foo.example Vary: Accept-Encoding, Origin Content-Encoding: gzip Content-Length: 235 Keep-Alive...
Content Security Policy (CSP) - HTTP
header or the Content-Security-Policy header is used. document-uri The URI of the document in which the violation occurred. effective-directive The directive whose enforcement caused the violation. original-policy The original policy as specified by the Content-Security-Policy HTTP header. referrer The referrer of the document in which the violation occurred. script-sample The first 40
characters of the inline script, event handler, or style that caused the violation. status-code The HTTP status code of the resource on which the global object was instantiated. violated-directive The name of the policy section that was violated. Sample violation report Let's consider a page located at http://example.com/signup.html. It uses the following policy, disallowing everything but styl...
Using HTTP cookies - HTTP
e, specifying Domain is less restrictive than omitting it. However, it can be helpful when subdomains need to share information about a user. For example, if Domain=mozilla.org is set, then cookies are available on subdomains like developer.mozilla.org. Path attribute The Path attribute indicates a URL path that must exist in the requested URL in order to send the Cookie header. The %x2F ("/")
character is considered a directory separator, and subdirectories match as well. For example, if Path=/docs is set, these paths match: /docs /docs/Web/ /docs/Web/HTTP SameSite attribute The SameSite attribute lets servers require that a cookie shouldn't be sent with cross-origin requests (where Site is defined by the registrable domain), which provides some protection against cross-site reque...
Content-Language - HTTP
CORS-safelisted request header yes, with the additional restriction that values can only be 0-9, A-Z, a-z, space or *,-.;=. Syntax Content-Language: de-DE Content-Language: en-US Content-Language: de-DE, en-CA Directives language-tag Multiple 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...
CSP: base-uri - HTTP
es While this directive uses the same arguments as other CSP directives, some of them don't make sense for `<base>`, such as the keywords 'unsafe-inline' and 'strict-dynamic' <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: child-src - HTTP
ntax One or more sources can be allowed for the child-src policy: Content-Security-Policy: child-src <source>; Content-Security-Policy: child-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: connect-src - HTTP
One or more sources can be allowed for the connect-src policy: Content-Security-Policy: connect-src <source>; Content-Security-Policy: connect-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: default-src - HTTP
ne or more sources can be allowed for the default-src policy: Content-Security-Policy: default-src <source>; Content-Security-Policy: default-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: font-src - HTTP
Syntax One or more sources can be allowed for the font-src policy: Content-Security-Policy: font-src <source>; Content-Security-Policy: font-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: form-action - HTTP
x One or more sources can be set for the form-action policy: Content-Security-Policy: form-action <source>; Content-Security-Policy: form-action <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: frame-ancestors - HTTP
er directives (e.g. default-src), but doesn't allow 'unsafe-eval' or 'unsafe-inline' for example. It will also not fall back to a default-src setting. Only the sources listed below are allowed: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number, separated by spaces. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Single quotes surrounding the host are not allowed. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. ht...
CSP: frame-src - HTTP
ntax One or more sources can be allowed for the frame-src policy: Content-Security-Policy: frame-src <source>; Content-Security-Policy: frame-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: img-src - HTTP
Syntax One or more sources can be allowed for the img-src policy: Content-Security-Policy: img-src <source>; Content-Security-Policy: img-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: manifest-src - HTTP
or more sources can be allowed for the manifest-src policy: Content-Security-Policy: manifest-src <source>; Content-Security-Policy: manifest-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: media-src - HTTP
ntax One or more sources can be allowed for the media-src policy: Content-Security-Policy: media-src <source>; Content-Security-Policy: media-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: navigate-to - HTTP
x One or more sources can be set for the navigate-to policy: Content-Security-Policy: navigate-to <source>; Content-Security-Policy: navigate-to <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: object-src - HTTP
x One or more sources can be allowed for the object-src policy: Content-Security-Policy: object-src <source>; Content-Security-Policy: object-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: prefetch-src - HTTP
or more sources can be allowed for the prefetch-src policy: Content-Security-Policy: prefetch-src <source>; Content-Security-Policy: prefetch-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: report-uri - HTTP
$message = "The following Content-Security-Policy violation occurred on " . $current_domain . ":\n\n" . $json_data . "\n\nFurther CPS violations will be logged to the following log file, but no further email notifications will be sent until this log file is deleted:\n\n" . $log_file; mail($email_address, $email_subject, $message, 'Content-Type: text/plain;
charset=utf-8'); } else if (filesize($log_file) > $log_file_size_limit) { exit(0); } file_put_contents($log_file, $json_data, FILE_APPEND | LOCK_EX); } Specifications Specification Status Comment Content Security Policy Level 3The definition of 'report-uri' in that specification. Working Draft No changes. Content Security Policy Level 2The definiti...
CSP: script-src-attr - HTTP
rce>; script-src-attr can be used in conjunction with script-src: Content-Security-Policy: script-src <source>; Content-Security-Policy: script-src-attr <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: script-src-elem - HTTP
rce>; script-src-elem can be used in conjunction with script-src: Content-Security-Policy: script-src <source>; Content-Security-Policy: script-src-elem <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: script-src - HTTP
One or more sources can be allowed for the script-src policy: Content-Security-Policy: script-src <source>; Content-Security-Policy: script-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: style-src-attr - HTTP
> <source>; style-src-attr can be used in conjunction with style-src: Content-Security-Policy: style-src <source>; Content-Security-Policy: style-src-attr <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: style-src-elem - HTTP
ource>; style-src-elem can be used in conjunction with style-src: Content-Security-Policy: style-src <source>; Content-Security-Policy: style-src-elem <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: style-src - HTTP
ntax One or more sources can be allowed for the style-src policy: Content-Security-Policy: style-src <source>; Content-Security-Policy: style-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
CSP: worker-src - HTTP
x One or more sources can be allowed for the worker-src policy: Content-Security-Policy: worker-src <source>; Content-Security-Policy: worker-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk
character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: http://*.example.com: Matches all attempts to load from any subdomain of example.com using the http: URL scheme. mail.example.com:443: Matches all attempts to access port 443 on mail.example.com. https://store.example.com: Matches all attempts to acc...
Content-Security-Policy-Report-Only - HTTP
ecurity-Policy-Report-Only header is used. document-uri The URI of the document in which the violation occurred. effective-directive The directive whose enforcement caused the violation. original-policy The original policy as specified by the Content-Security-Policy-Report-Only HTTP header. referrer The referrer of the document in which the violation occurred. script-sample The first 40
characters of the inline script, event handler, or style that caused the violation. status-code The HTTP status code of the resource on which the global object was instantiated. violated-directive The name of the policy section that was violated. Sample violation report Let's consider a page located at http://example.com/signup.html. It uses the following policy, disallowing everything but styl...
Content-Type - HTTP
CORS-safelisted request header yes, with the additional restriction that values can't contain a CORS-unsafe request header byte: 0x00-0x1F (except 0x08 (tab)), "():<>?@[\]{}, and 0x7F (delete). It also needs to have a MIME type of its parsed value (ignoring parameters) of either application/x-www-form-urlencoded, multipart/form-data, or text/plain. Syntax Content-Type: text/html;
charset=UTF-8 Content-Type: multipart/form-data; boundary=something Directives media-type The MIME type of the resource or the data.
charset The
character encoding standard. boundary For multipart entities the boundary directive is required, which consists of 1 to 70
characters from a set of
characters known to be very robust through email gateways, and not ending with white space. It is use...
ETag - HTTP
ery 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 revision number is used. For example, MDN uses a hexadecimal hash of the wiki article content. Examples ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4" ETag: W/"0815" Avoiding mid-air c...
If-Match - HTTP
ce the original resource was fetched. If the request cannot be fulfilled, the 412 (Precondition Failed) response is returned. Header type Request header Forbidden header name no Syntax If-Match: <etag_value> If-Match: <etag_value>, <etag_value>, ... Directives <etag_value> Entity tags uniquely representing the requested resources. They are a string of ASCII
characters placed between double quotes (like "675af34563dc-tr34"). They may be prefixed by W/ to indicate that they are "weak", i.e. that they represent the resource semantically, but not byte-for-byte. However, in an If-Match header, weak entity tags will never match. * The asterisk is a special value representing any resource. Examples If-Match: "bfc13a64729c4290ef5b2c2730249c88ca92d82d" If-M...
If-None-Match - HTTP
losing the data of the previous put; this problem is a variation of the lost update problem. Header type Request header Forbidden header name no Syntax If-None-Match: "<etag_value>" If-None-Match: "<etag_value>", "<etag_value>", ... If-None-Match: * Directives <etag_value> Entity tags uniquely representing the requested resources. They are 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 (This is useless with If-None-Match as it only uses that algorithm). * The asterisk is a special value representing any resource. They are only useful when uploading a resource, usually with PUT, to check if another resource with the identity has ...
If-Range - HTTP
ownload, 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", "Sat", or "Sun" (case-sensitive). <day> 2 digit day number, e.g. "04" or "23". <month> One of "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" (case sen...
Keep-Alive - HTTP
e maximum number of requests that can be sent on this connection before closing it. Unless 0, this value is ignored for non-pipelined connections as another request will be sent in the next response. An HTTP pipeline can use it to limit the pipelining. ...
User-Agent - HTTP
Please read Browser detection using the user agent for why serving different Web pages or services to different browsers is usually a bad idea. Header type Request header Forbidden header name no Syntax User-Agent: <product> / <product-version> <comment> Common format for web browsers: User-Agent: Mozilla/5.0 (<system-information>) <platform> (<platform-details>) <extensions> Directives <product> A product identifier -- its name or development codename. <product-version> Version number of the product. ...
HTTP Messages - HTTP
b (like GET, PUT or POST) or a noun (like HEAD or OPTIONS), that describes the action to be performed. For example, GET indicates that a resource should be fetched or POST means that data is pushed to the server (creating or modifying a resource, or generating a temporary document to send back). The request target, usually a URL, or the absolute path of the protocol, port, and domain are usually
characterized by the request context. The format of this request target varies between different HTTP methods. It can be An absolute path, ultimately followed by a '?' and query string. This is the most common form, known as the origin form, and is used with GET, POST, HEAD, and OPTIONS methods. POST / HTTP/1.1 GET /background.png HTTP/1.0 HEAD /test.html?query=alibaba HTTP/1.1 O...
POST - HTTP
L form and results in a change on the server. In this case, the content type is selected by putting the adequate string in the enctype attribute of the <form> element or the formenctype attribute of the <input> or <button> elements: application/x-www-form-urlencoded: the keys and values are encoded in key-value tuples separated by '&', with a '=' between the key and the value. Non-alphanumeric
characters in both keys and values are percent encoded: this is the reason why this type is not suitable to use with binary data (use multipart/form-data instead) multipart/form-data: each value is sent as a block of data ("body part"), with a user agent-defined delimiter ("boundary") separating each part. The keys are given in the Content-Disposition header of each part. text/plain When the POST ...
Proxy Auto-Configuration (PAC) file - HTTP
dnsDomainLevels("www.mozilla.org"); // 2 shExpMatch() Syntax shExpMatch(str, shexp) Parameters str is any string to compare (e.g. the URL, or the hostname). shexp is a shell expression to compare against. Returns true if the string matches the specified shell expression. Note that the patterns are shell glob expressions, not regular expressions. * and ? are always supported, while [
characters] and [^
characters] are supported by some implmentations including Firefox. This is mainly because the expression is translated to a RegExp via subsitution of [.*?]. For a reliable way to use these RegExp syntaxes, just use RegExp instead. Examples shExpMatch("http://home.netscape.com/people/ari/index.html" , "*/ari/*"); // returns true shExpMatch("http://home.netscape.com/people/montu...
406 Not Acceptable - HTTP
The HyperText Transfer Protocol (HTTP) 406 Not Acceptable client error response code indicates that the server cannot produce a response matching the list of acceptable values defined in the request's proactive content negotiation headers, and that the server is unwilling to supply a default representation. Proactive content negotiation headers include: Accept Accept-
Charset Accept-Encoding Accept-Language In practice, this error is very rarely used. Instead of responding using this error code, which would be cryptic for the end user and difficult to fix, servers ignore the relevant header and serve an actual page to the user. It is assumed that even if the user won't be completely happy, they will prefer this to an error code. If a server returns such an error status, the body of t...
JavaScript data types and data structures - JavaScript
sponseText, etc.) and it can be tempting to only work with strings. With conventions, it is possible to represent any data structure in a string. This does not make it a good idea. For instance, with a separator, one could emulate a list (while a JavaScript array would be more suitable). Unfortunately, when the separator is used in one of the "list" elements, then, the list is broken. An escape
character can be chosen, etc. All of this requires conventions and creates an unnecessary maintenance burden. Use strings for textual data. When representing complex data, parse strings, and use the appropriate abstraction. Symbol type A Symbol is a unique and immutable primitive value and may be used as the key of an Object property (see below). In some programming languages, Symbols are called "a...
Enumerability and ownership of properties - JavaScript
ble to false). Enumerable properties show up in for...in loops unless the property's key is a Symbol. Ownership of properties is determined by whether the property belongs to the object directly and not to its prototype chain. Properties of an object can also be retrieved in total. There are a number of built-in means of detecting, iterating/enumerating, and retrieving object properties, with the
chart showing below which are available. Some sample code follows which demonstrates how to obtain the missing categories. Property enumerability and ownership - built-in methods of detection, retrieval, and iteration Functionality Own object Own object and its prototype chain Prototype chain only Detection Enumerable Nonenumerable ...
Details of the object model - JavaScript
to clarify the situation. This chapter assumes that you are already somewhat familiar with JavaScript and that you have used JavaScript functions to create simple objects. Class-based vs. prototype-based languages Class-based object-oriented languages, such as Java and C++, are founded on the concept of two distinct entities: classes and instances. A class defines all of the properties that
characterize a certain set of objects (considering methods and fields in Java, or members in C++, to be properties). A class is abstract rather than any particular member in a set of objects it describes. For example, the Employee class could represent the set of all employees. An instance, on the other hand, is the instantiation of a class; that is. For example, Victoria could be an instance of the ...
Expressions and operators - JavaScript
The expression itself evaluates to seven. The code 3 + 4 is an example of the second expression type. This expression uses the + operator to add three and four together without assigning the result, seven, to a variable. JavaScript has the following expression categories: Arithmetic: evaluates to a number, for example 3.14159. (Generally uses arithmetic operators.) String: evaluates to a
character string, for example, "Fred" or "234". (Generally uses string operators.) Logical: evaluates to true or false. (Often involves logical operators.) Primary expressions: Basic keywords and general expressions in JavaScript. Left-hand-side expressions: Left values are the destination of an assignment. Primary expressions Basic keywords and general expressions in JavaScript. this Use the ...
Working with objects - JavaScript
bjects in real life. The concept of objects in JavaScript can be understood with real life, tangible objects. In JavaScript, an object is a standalone entity, with properties and type. Compare it with a cup, for example. A cup is an object, with properties. A cup has a color, a design, weight, a material it is made of, etc. The same way, JavaScript objects can have properties, which define their
characteristics. Objects and properties A JavaScript object has properties associated with it. A property of an object can be explained as a variable that is attached to the object. Object properties are basically the same as ordinary JavaScript variables, except for the attachment to objects. The properties of an object define the
characteristics of the object. You access the properties of an objec...
RangeError: radix must be an integer - JavaScript
.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 represented in hexadecimal (base 16) as A9. Why is this parameter's value limited to 36? A radix that is larger than 10 uses alphabetical
characters as digits; therefore, the radix can't be larger than 36, since the Latin alphabet (used by English and many other languages) only has 26
characters. The most common radixes: 2 for binary numbers, 8 for octal numbers, 10 for decimal numbers, 16 for hexadecimal numbers. Examples Invalid cases (42).toString(0); (42).toString(1); (42).toString(37); (42).toString(150); // You cannot u...
SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated - JavaScript
The JavaScript strict mode-only exception "0-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead" occurs when deprecated octal literals and octal escape sequences are used. Message SyntaxError: Octal numeric literals and escape
characters not allowed in strict mode (Edge) SyntaxError: "0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead Error type SyntaxError in strict mode only. What went wrong? Octal literals and octal escape sequences are deprecated and will throw a SyntaxError in strict mode. With ECMAScript 2015 and later, the standardized syntax uses a leading zero followed by a lowercase or uppercase Latin letter "O" (0o or 0O). Examples "0"-prefixed o...
SyntaxError: identifier starts immediately after numeric literal - JavaScript
ge) SyntaxError: identifier starts immediately after numeric literal (Firefox) SyntaxError: Unexpected number (Chrome) Error type SyntaxError What went wrong? The names of variables, called identifiers, conform to certain rules, which your code must adhere to! A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($). They can't start with a digit! Only subsequent
characters can be digits (0-9). Examples Variable names starting with numeric literals Variable names can't start with numbers in JavaScript. The following fails: var 1life = 'foo'; // SyntaxError: identifier starts immediately after numeric literal var foo = 1life; // SyntaxError: identifier starts immediately after numeric literal alert(1.foo); // SyntaxError: identifier starts immediately aft...
SyntaxError: missing } after function body - JavaScript
) Error type SyntaxError What went wrong? There is a syntax mistake when creating a function somewhere. Also check if any closing curly brackets or parenthesis are in the correct order. Indenting or formatting the code a bit nicer might also help you to see through the jungle. Examples Forgotten closing curly bracket Oftentimes, there is a missing curly bracket in your function code: var
charge = function() { if (sunny) { useSolarCells(); } else { promptBikeRide(); }; Correct would be: var
charge = function() { if (sunny) { useSolarCells(); } else { promptBikeRide(); } }; It can be more obscure when using IIFE, Closures, or other constructs that use a lot of different parenthesis and curly brackets, for example. (function() { if (true) { return false; } ...
SyntaxError: missing formal parameter - JavaScript
id parameters. In the declaration of a function, the parameters must be identifiers, not any value like numbers, strings, or objects. Declaring functions and calling functions are two separate steps. Declarations require identifier as parameters, and only when calling (invoking) the function, you provide the values the function should use. In JavaScript, identifiers can contain only alphanumeric
characters (or "$" or "_"), and may not start with a digit. An identifier differs from a string in that a string is data, while an identifier is part of the code. Examples Provide proper function parameters Function parameters must be identifiers when setting up a function. All these function declarations fail, as they are providing values for their parameters: function square(3) { return number...
SyntaxError: unterminated string literal - JavaScript
otherwise my code is unreadable.'; // SyntaxError: unterminated string literal Instead, use the + operator, a backslash, or template literals. The + operator variant looks like this: var longString = 'This is a very long string which needs ' + 'to wrap across multiple lines because ' + 'otherwise my code is unreadable.'; Or you can use the backslash
character ("\") at the end of each line to indicate that the string will continue on the next line. Make sure there is no space or any other
character after the backslash (except for a line break), or as an indent; otherwise it will not work. That form looks like this: var longString = 'This is a very long string which needs \ to wrap across multiple lines because \ otherwise my code is unreadable.';...
JavaScript error reference - JavaScript
pragmas is deprecated. Use //# insteadSyntaxError: a declaration in the head of a for-of loop can't have an initializerSyntaxError: applying the "delete" operator to an unqualified name is deprecatedSyntaxError: for-in loop head declarations may not have initializersSyntaxError: function statement requires a nameSyntaxError: identifier starts immediately after numeric literalSyntaxError: illegal
characterSyntaxError: invalid regular expression flag "x"SyntaxError: missing ) after argument listSyntaxError: missing ) after conditionSyntaxError: missing : after property idSyntaxError: missing ; before statementSyntaxError: missing = in const declarationSyntaxError: missing ] after element listSyntaxError: missing formal parameterSyntaxError: missing name after . operatorSyntaxError: missing vari...
The arguments object - JavaScript
trict mode. arguments.length The number of arguments that were passed to the function. arguments[@@iterator] Returns a new Array iterator object that contains the values for each index in arguments. Examples Defining a function that concatenates several strings This example defines a function that concatenates 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, orange, blue" myConcat(', ', 'red', 'orange', 'blue'); // returns "elephant; giraffe; lion; ch...
Array.prototype.filter() - JavaScript
ow length 6, but since they've been modified one is returned // ["spray"] // Appending new words words = ['spray', 'limit', 'exuberant', 'destruction','elite', 'present'] const appendedWords = words.filter( (word, index, arr) => { arr.push('new') return word.length < 6 }) console.log(appendedWords) // Only three fits the condition even though the `words` itself now has a lot more words with
character length less than 6 // ["spray" ,"limit" ,"elite"] // Deleting words words = ['spray', 'limit', 'exuberant', 'destruction', 'elite', 'present'] const deleteWords = words.filter( (word, index, arr) => { arr.pop() return word.length < 6 }) console.log(deleteWords) // Notice 'elite' is not even obtained as its been popped off `words` before filter can even get there // ["spray" ,"limit"] ...
Array.from() - JavaScript
s "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.from
CharCode(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.includes() - JavaScript
g true or false as appropriate. 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 arr.includes(valueToFind[, fromIndex]) Parameters valueToFind The value to search for. Note: When comparing strings and
characters, includes() is case-sensitive. fromIndex Optional The position in this array at which to begin searching for valueToFind. The first element to be searched is found at fromIndex for positive values of fromIndex, or at arr.length + fromIndex for negative values of fromIndex (using the absolute value of fromIndex as the number of elements from the end of the array at which to start the ...
Array.prototype.join() - JavaScript
ttps://github.com/mdn/interactive-examples and send us a pull request. Syntax arr.join([separator]) Parameters separator Optional Specifies a string to separate each pair of adjacent elements of the array. The separator is converted to a string if necessary. If omitted, the array elements are separated with a comma (","). If separator is an empty string, all elements are joined without any
characters in between them. Return value A string with all array elements joined. If arr.length is 0, the empty string is returned. Description The string conversions of all array elements are joined into one string. If an element is undefined, null or an empty array [], it is converted to an empty string. Examples Joining an array four different ways The following example creates an array,...
Array.prototype.map() - JavaScript
The argument will automatically be assigned from each element of the array as map loops through the original array. let numbers = [1, 4, 9] let doubles = numbers.map(function(num) { return num * 2 }) // doubles is now [2, 8, 18] // numbers is still [1, 4, 9] Using map generically This example shows how to use map on a String to get an array of bytes in the ASCII encoding representing the
character values: let map = Array.prototype.map let a = map.call('Hello World', function(x) { return x.
charCodeAt(0) }) // a now equals [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100] Using map generically querySelectorAll This example shows how to iterate through a collection of objects collected by querySelectorAll. This is because querySelectorAll returns a NodeList (which is a collectio...
Date.prototype.toISOString() - JavaScript
The timezone is always zero UTC offset, as denoted by the suffix "Z". 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 dateObj.toISOString() Return value A string representing the given date in the ISO 8601 format according to universal time. ...
Date.prototype.toLocaleString() - JavaScript
our12: false })); // -> "12/19/2012, 19:00:00" Avoid comparing formatted date values to static values Most of the time, the formatting returned by toLocaleString() is consistent. However, this might change in the future, and isn't guaranteed for all languages; output variations are by design, and allowed by the specification. Most notably, the IE and Edge browsers insert bidirectional control
characters around dates, so the output text will flow properly when concatenated with other text. For this reason, you cannot expect to be able to compare the results of toLocaleString() to a static value: "1/1/2019, 01:00:00" === new Date("2019-01-01T01:00:00Z").toLocaleString("en-US"); // true in Firefox and others // false in IE and Edge Note: See also this StackOverflow thread for more details...
Error.prototype.stack - JavaScript
later this is less of an issue. Different browsers set this value at different times. For example, Firefox sets it when creating an Error object, while PhantomJS sets it only when throwing the Error, and archived MSDN docs also seem to match the PhantomJS implementation. Examples Using the stack property The following HTML markup demonstrates the use of stack property. ...
Function.prototype.bind() - JavaScript
ith length of 0. A full implementation--depending on the length of the target function and the number of pre-specified arguments--may return a non-zero length. The partial implementation creates bound functions whose name property is not derived from the original function name. According to ECMA-262, name of the returned bound function should be "bound " + name of target function (note the space
character). If you choose to use this partial implementation, you must not rely on those cases where behavior deviates from ECMA-262, 5th edition! Thankfully, these deviations from the specification rarely (if ever) come up in most coding situations. If you do not understand any of the deviations from the specification above, then it is safe in this particular case to not worry about these noncompli...
Intl.DateTimeFormat.prototype.format() - JavaScript
"setembro de 2012; dezembro de 2012; abril de 2012" Avoid comparing formatted date values to static values Most of the time, the formatting returned by format() is consistent. However, this might change in the future and isn't guaranteed for all the languages -- output variations are by design and allowed by the specification. Most notably, the IE and Edge browsers insert bidirectional control
characters around dates, so the output text will flow properly when concatenated with other text. For this reason you cannot expect to be able to compare the results of format() to a static value: let d = new Date("2019-01-01T00:00:00.000000Z"); let formattedDate = Intl.DateTimeFormat(undefined, { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', seco...
Intl.Locale.prototype.numberingSystem - JavaScript
ls -- may be algorithmic fullwide Full width digits geor Georgian numerals -- algorithmic gong Gunjala Gondi digits gonm Masaram Gondi digits grek Greek upper case numerals -- algorithmic greklow Greek lower case numerals -- algorithmic gujr Gujarati digits guru Gurmukhi digits hanidays Han-
character day-of-month numbering for lunar/other traditional calendars hanidec Positional decimal system using Chinese number ideographs as digits hans Simplified Chinese numerals -- algorithmic hansfin Simplified Chinese financial numerals -- algorithmic hant Traditional Chinese numerals -- algorithmic hantfin Traditional Chinese financial n...
Intl.Locale - JavaScript
ccording to the locale's rules. Intl.Locale.prototype.hourCycle Returns the time keeping format convention used by the locale. Intl.Locale.prototype.language Returns the language associated with the locale. Intl.Locale.prototype.numberingSystem Returns the numeral system used by the locale. Intl.Locale.prototype.numeric Returns whether the locale has special collation handling for numeric
characters. Intl.Locale.prototype.region Returns the region of the world (usually a country) associated with the locale. Intl.Locale.prototype.script Returns the script used for writing the particular language used in the locale. Instance methods Intl.Locale.prototype.maximize() Gets the most likely values for the language, script, and region of the locale based on existing values. Intl.Loc...
Number.parseFloat() - JavaScript
/github.com/mdn/interactive-examples and send us a pull request. Syntax Number.parseFloat(string) Parameters string The value to parse. If this argument is not a string, then it is converted to one using the ToString abstract operation. Leading whitespace in this argument is ignored. Return value A floating point number parsed from the given string. Or NaN when the first non-whitespace
character cannot be converted to a number. Polyfill if (Number.parseFloat === undefined) { Number.parseFloat = parseFloat; } Examples Number.parseFloat vs parseFloat This method has the same functionality as the global parseFloat() function: Number.parseFloat === parseFloat; // true This method is also part of ECMAScript 2015. (Its purpose is modularization of globals.) See parseFloat() fo...
Number.parseInt() - JavaScript
one using the ToString abstract operation. Leading whitespace in this argument is ignored. radix Optional An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string. Be careful--this does not default to 10! Return value An integer parsed from the given string. If the radix is smaller than 2 or bigger than 36, and the first non-whitespace
character cannot be converted to a number, NaN is returned. Polyfill if (Number.parseInt === undefined) { Number.parseInt = window.parseInt } Examples Number.parseInt vs parseInt This method has the same functionality as the global parseInt() function: Number.parseInt === parseInt // true and is part of ECMAScript 2015 (its purpose is modularization of globals). Please see parseInt() for m...
Object.is() - JavaScript
value1 The first value to compare. value2 The second value to compare. Return value A Boolean indicating whether or not the two arguments are the same value. Description Object.is() determines whether two values are the same value. Two values are the same if one of the following holds: both undefined both null both true or both false both strings of the same length with the same
characters in the same order both the same object (means both object have same reference) both numbers and both +0 both -0 both NaN or both non-zero and both not NaN and both have the same value This is not the same as being equal according to the == operator. The == operator applies various coercions to both sides (if they are not the same Type) before testing for equality (re...
Reflect.apply() - JavaScript
lly use the Function.prototype.apply() method to call a function with a given this value and arguments provided as an array (or an array-like object). Function.prototype.apply.call(Math.floor, undefined, [1.75]); With Reflect.apply() this becomes less verbose and easier to understand. Examples Using Reflect.apply() Reflect.apply(Math.floor, undefined, [1.75]); // 1; Reflect.apply(String.from
CharCode, undefined, [104, 101, 108, 108, 111]) // "hello" Reflect.apply(RegExp.prototype.exec, /ab/, ['confabulation']).index // 4 Reflect.apply(''.
charAt, 'ponies', [3]) // "i" Specifications Specification ECMAScript (ECMA-262)The definition of 'Reflect.apply' in that specification. ...
RegExp.prototype.compile() - JavaScript
() method is used to (re-)compile a regular expression during execution of a script. It is basically the same as the RegExp constructor. Syntax regexObj.compile(pattern, flags) Parameters pattern The text of the regular expression. flags If specified, flags can have any combination of the following values: g global match i ignore case m multiline; treat beginning and end
characters (^ and $) as working over multiple lines (i.e., match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string) y sticky; matches only from the index indicated by the lastIndex property of this regular expression in the target string (and does not attempt to match from any later indexes). Description The compile meth...
RegExp.lastMatch ($&) - JavaScript
RegExp.$& is an alias for this property. Description The lastMatch property is static, it is not a property of an individual regular expression object. Instead, you always use it as RegExp.lastMatch or RegExp['$&']. The value of the lastMatch property is read-only and modified whenever a successful match is made. You can not use the shorthand alias with the dot property accessor (RegExp.$&), because the parser expects an expression with "&" in that case and a SyntaxError is thrown. ...
String.prototype.endsWith() - JavaScript
The endsWith() method determines whether a string ends with the
characters of a specified string, returning true or false as appropriate. 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 str.endsWith(searchString[, length]) Parameters searchString The
characters to be searched for at the end of str. length Optional If provided, it is used as the length of str. Defaults to str.length. Return value true if the given
characters are found at the end of the string; otherwise, false. Description This method lets you determine whether or not a string ends with another string. This method is case-sensitiv...
String.prototype.indexOf() - JavaScript
tring's length, the returned value is the string's length: 'hello world'.indexOf('', 11) // returns 11 'hello world'.indexOf('', 13) // returns 11 'hello world'.indexOf('', 22) // returns 11 In the former instance, JS seems to find an empty string just after the specified index value. In the latter instance, JS seems to be finding an empty string at the end of the searched 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 of a string called stringName is stringName.length - 1. 'Blue Whale'.indexOf('Blue') // returns 0 'Blue Whale'.indexOf('Blute') // returns -1 'Blue Whale'.indexOf('Whale', 0) // returns 5 'Blue Whale'.indexOf('Whale', 5) // returns 5 'Blue Whale'.indexOf('Wha...
String.prototype.match() - JavaScript
ring matches a regular expression RegExp, use RegExp.test(). If you only want the first match found, you might want to use RegExp.exec() instead. If you want to obtain capture groups and the global flag is set, you need to use RegExp.exec() or String.prototype.matchAll() instead. Examples Using match() In the following example, match() is used to find 'Chapter' followed by 1 or more numeric
characters followed by a decimal point and numeric
character 0 or more times. The regular expression includes the i flag so that upper/lower case differences will be ignored. const str = 'For more information, see Chapter 3.4.5.1'; const re = /see (chapter \d+(\.\d)*)/i; const found = str.match(re); console.log(found); // logs [ 'see Chapter 3.4.5.1', // 'Chapter 3.4.5.1', // '.1', /...
String.raw() - JavaScript
y used, because the JavaScript engine will call this with proper arguments for you, (just like with other tag functions). String.raw() is the only built-in tag function of template strings. It works just like the default template function and performs concatenation. You can even re-implement it with normal JavaScript code. Examples Using String.raw() String.raw`Hi\n${2+3}!`; // 'Hi\n5!', the
character after 'Hi' // is not a newline
character, // '\' and 'n' are two
characters. String.raw`Hi\u000A!`; // 'Hi\u000A!', same here, this time we will get the // \, u, 0, 0, 0, A, 6
characters. // All kinds of escape
characters will be ineffective // and backslashes will be present in the output string. // You can confirm this by checking the .length property // of the string. let name = 'Bob';...
String.prototype.repeat() - JavaScript
eat 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. ...
String.prototype.startsWith() - JavaScript
The startsWith() method determines whether a string begins with the
characters of a specified string, returning true or false as appropriate. 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 str.startsWith(searchString[, position]) Parameters searchString The
characters to be searched for at the start of this string. position Optional The position in this string at which to begin searching for searchString. Defaults to 0. Return value true if the given
characters are found at the beginning of the string; otherwise, false. Description This method lets you determine whether or not a string begins wi...
String.prototype.toLocaleUpperCase() - JavaScript
rted to upper case according to any locale-specific case mappings. toLocaleUpperCase() does not affect the value of the string itself. In most cases, this will produce the same result as toUpperCase(), but for some locales, such as Turkish, whose case mappings do not follow the default case mappings in Unicode, there may be a different result. Also notice that conversion is not necessarily a 1:1
character mapping, as some
characters might result in two (or even more)
characters when transformed to upper-case. Therefore the length of the result string can differ from the input length. This also implies that the conversion is not stable, so i.E. the following can return false: x.toLocaleLowerCase() === x.toLocaleUpperCase().toLocaleLowerCase() Examples Using toLocaleUpperCase() 'alphabet'.t...
String.prototype.trim() - JavaScript
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 str.trim() Return value A new string representing the str stripped of whitespace from both ends. Description The trim() method returns the string stripped of whitespace from both ends. ...
decodeURI() - JavaScript
ttps://github.com/mdn/interactive-examples and send us a pull request. Syntax decodeURI(encodedURI) Parameters encodedURI A complete, encoded Uniform Resource Identifier. Return value A new string representing the unencoded version of the given encoded Uniform Resource Identifier (URI). Exceptions Throws an URIError ("malformed URI sequence") exception when encodedURI contains invalid
character sequences. Description Replaces each escape sequence in the encoded URI with the
character that it represents, but does not decode escape sequences that could not have been introduced by encodeURI. The
character "#" is not decoded from escape sequences. Examples Decoding a Cyrillic URL decodeURI('https://developer.mozilla.org/ru/docs/JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B'); // "http...
decodeURIComponent() - JavaScript
mponent(encodedURI) Parameters encodedURI An encoded component of a Uniform Resource Identifier. Return value A new string representing the decoded version of the given encoded Uniform Resource Identifier (URI) component. Exceptions Throws an URIError ("malformed URI sequence") exception when used wrongly. Description Replaces each escape sequence in the encoded URI component with the
character that it represents. Examples Decoding a Cyrillic URL component decodeURIComponent('JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B'); // "JavaScript_?????" Catching errors try { var a = decodeURIComponent('%E0%A4%A'); } catch(e) { console.error(e); } // URIError: malformed URI sequence Decoding query parameters from a URL decodeURIComponent cannot be used directly to parse query param...
isNaN() - JavaScript
however, the meaning of NaN remains the precise numeric meaning and not simply, "not a number". Alternatively, in the absence of Number.isNaN, the expression (x != x) is a more reliable way to test whether variable x is NaN or not, as the result is not subject to the false positives that make isNaN unreliable. ...
Equality (==) - JavaScript
he operands is Boolean, convert the Boolean operand to 1 if it is true and +0 if it is false. If one of the operands is an object and the other is a number or a string, try to convert the object to a primitive using the object's valueOf() and toString() methods. If the operands have the same type, they are compared as follows: String: return true only if both operands have the same
characters in the same order. Number: return true only if both operands have the same value. +0 and -0 are treated as the same value. If either operand is NaN, return false. Boolean: return true only if operands are both true or both false. The most notable difference between this operator and the strict equality (===) operator is that the strict equality operator does not attempt type co...
Object initializer - JavaScript
accessor syntax, which you may have used to read and set properties already. Now you can use a similar syntax in object literals, too: // Computed property names (ES2015) let i = 0 let a = { ['foo' + ++i]: i, ['foo' + ++i]: i, ['foo' + ++i]: i } console.log(a.foo1) // 1 console.log(a.foo2) // 2 console.log(a.foo3) // 3 let param = 'size' let config = { [param]: 12, ['mobile' + param.
charAt(0).toUpperCase() + param.slice(1)]: 4 } console.log(config) // {size: 12, mobileSize: 4} Spread properties The Rest/Spread Properties for ECMAScript proposal (stage 4) adds spread properties to object literals. It copies own enumerable properties from a provided object onto a new object. Shallow-cloning (excluding prototype) or merging objects is now possible using a shorter syntax than Obj...
Strict equality (===) - JavaScript
f different types, return false. If both operands are objects, return true only if they refer to the same object. If both operands are null or both operands are undefined, return true. If either operand is NaN, return false. Otherwise, compare the two operand's values: Numbers must have the same numeric values. +0 and -0 are considered to be the same value. Strings must have the same
characters in the same order. Booleans must be both true or both false. The most notable difference between this operator and the equality (==) operator is that if the operands are of different types, the == operator attempts to convert them to the same type before comparing. Examples Comparing operands of the same type console.log("hello" === "hello"); // true console.log("hello" === "...
if...else - JavaScript
ve Boolean values true and false with truthiness or falsiness of the Boolean object. Any value that is not false, undefined, null, 0, -0, NaN, or the empty string (""), and any object, including a Boolean object whose value is false, is considered truthy when used as the condition. For example: var b = new Boolean(false); if (b) // this condition is truthy Examples Using if...else if (cipher_
char === from_
char) { result = result + to_
char; x++; } else { result = result + clear_
char; } Using else if Note that there is no elseif syntax in JavaScript. However, you can write it with a space between else and if: if (x > 50) { /* do something */ } else if (x > 5) { /* do something */ } else { /* do something */ } Assignment within the conditional expression It is advisable to ...
Trailing commas - JavaScript
..b,] = [1, 2, 3]; // SyntaxError: rest element may not have a trailing comma Trailing commas in JSON Trailing commas in objects were only introduced in ECMAScript 5. ...
JavaScript typed arrays - JavaScript
By combining a single buffer with multiple views of different types, starting at different offsets into the buffer, you can interact with data objects containing multiple data types. This lets you, for example, interact with complex data structures from WebGL, data files, or C structures you need to use while using js-ctypes. Consider this C structure: struct someStruct { unsigned long id;
char username[16]; float amountDue; }; You can access a buffer containing data in this format like this: let buffer = new ArrayBuffer(24); // ... read the data into the buffer ... let idView = new Uint32Array(buffer, 0, 1); let usernameView = new Uint8Array(buffer, 4, 16); let amountDueView = new Float32Array(buffer, 20, 1); Then you can access, for example, the amount due with amountDueView[0]...
<mfenced> - MathML
is trimmed. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color and also the fraction line color. You can use #rgb, #rrggbb and HTML color names. open A string for the opening delimiter. The default value is "(" and any white space is trimmed. separators A sequence of zero or more
characters to be used for different separators, optionally divided by white space, which is ignored. The default value is ",". By specifying more than one
character, it is possible to set different separators for each argument in the expression. If there are too many separators, all excess is ignored. If there are too few separators in the expression, the last specified separator is repeated. Exampl...
<mglyph> - MathML
It may be used within token elements. Attributes alt This attribute defines the alternative text describing the image. Users will see this displayed if the image URL is wrong, the image is not in one of the supported formats, or until the image is downloaded. class, id, style Provided for use with stylesheets. height The height of the image. href Used to set a hyperlink to a specified URI. mathbackground The background color (if the image has transparency). You can use #rgb, #rrggbb and HTML color names. src The image URL. ...
<ms> - MathML
The MathML <ms> element represents a string literal meant to be interpreted by programming languages and computer algebra systems. By default, string literals are displayed as enclosed by double quotes ("); by using the lquote and rquote attributes, you can set custom
characters to display. Note that quotation marks should not be specified unless they are part of the string literal. The content of an <ms> element is not an ASCII string per se, but rather a sequence of
characters and <mglyph> and <malignmark> elements. Attributes class, id, style Provided for use with stylesheets. dir The text direction. Possible values are either ltr (left to right) or rtl (right to left). lquote The opening quote
character (depends on dir) to enclose the content. The default value is """. ...
<mstyle> - MathML
The MathML <mstyle> element is used change the style of its children. It accepts all attributes of all MathML presentation elements with some exceptions and additional attributes listed below. Attributes dir Overall directionality of formulas. Possible values are either ltr (left to right) or rtl (right to left). decimalpoint This attribute is specifying the
character for the alignment point within <mstack> and <mtable> columns, if the decimalpoint value is used to specify the alignment. displaystyle A Boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. The main effect is that larger versions of operators are displayed, when displaystyle is set to true. See also largeop and movabl...
Autoplay guide for media and Web Audio APIs - Web media technologies
ture policy In addition to the browser-side management and control over autoplay functionality described above, a web server can also express its willingness to allow autoplay to function. The HTTP Feature-Policy header's autoplay directive is used to control which domains, if any, can be used to autoplay media. By default, the autoplay feature policy is set to 'self' (including the single quote
characters), indicating that autoplay is permitted as they're hosted on the same domain as the document. You can also specify 'none' to disable autoplay entirely, '*' to allow autoplay from all domains, or one or more specific origins from which media can be automatically played. These origins are separated by space
characters. Note: The specified feature policy applies to the document and every <i...
OpenSearch description format
ram name="[key name]" value="{searchTerms}"/> <!-- other Params if you need them... --> <Param name="[other key name]" value="[parameter value]"/> </Url> <Url type="application/x-suggestions+json" template="[suggestionURL]"/> <moz:SearchForm>[https://example.com/search]</moz:SearchForm> </OpenSearchDescription> ShortName A short name for the search engine. It must be 16 or fewer
characters of plain text, with no HTML or other markup. Description A brief description of the search engine. It must be 1024 or fewer
characters of plain text, with no HTML or other markup. InputEncoding The
character encoding to use when submitting input to the search engine. Image URI of an icon for the search engine. When possible, include a 16x16 image of type image/x-icon (such as /favic...
Animation performance and frame rate - Web Performance
user interfaces have a frame rate of 60 frames per second (fps). While it is not always possible to maintain 60fps, it is important to maintain a high and steady frame rate for all animations. Let's take a look at how we can use browser tools to inspect the frame rate. We'll also discuss some tips to create and maintain a fast and steady frame rate. The developer tool's frame rate and waterfall
charts provide insight into the work the browser is performing to animate code. Using these tools you can measure an application's animation frame rate, and diagnose performance bottlenecks if any are found. With CSS animations you specify a number of keyframes, each of which uses CSS to define the appearance of the element at a particular stage of the animation. The browser creates the animation as ...
Populating the page: how browsers work - Web Performance
8 round trips, the browser is finally able to make the request. Response Once we have an established connection to a web server, the browser sends an initial HTTP GET request on behalf of the user, which for websites is most often an HTML file. Once the server receives the request, it will reply with relevant response headers and the contents of the HTML. ...
Performance Monitoring: RUM vs synthetic monitoring - Web Performance
reporting back the performance the simulator experiences. The traffic measured is not of your actual users, but rather synthetically generated traffic collecting data on page performance. An example of synthetic monitoring is WebPageTest.org. It is done in a controlled environment where variable like geography, network, device, browser, and cached status are predetermined. It provides waterfall
charts for every asset served by the host and CDN as well as every third party asset and asset requests generated by all third party scripts, such as ads and analytic services. Controlling for environmental variables is helpful in understanding where performance bottlenecks have been occurring and identifying the source of any performance issues. For example, but it isn't reflective of the actual exp...
Understanding latency - Web Performance
or a resource to the moment when the requested resource arrives at the browser. Network throttling To emulate the latency of a low bandwidth network, you can use developer tools and switch to a lower end network connection. In the developer tools, under the network table, you can switch the throttling option to 2G, 3G, etc. Different browser developer tools have different preset options, the
characteristics emulated include download speed, upload speed, and minimum latency, or the minimum amount of type it takes to send a packet of data. The approximate values of some presets include: Selection Download speed Upload speed Minimum latency (ms) GPRS 50 Kbps 20 Kbps 500 Regular 2G 250 Kbps 50 Kbps 300 Good 2G 450 Kbps ...
Media - Progressive web apps (PWAs)
se to specify the way that content displays. Information: Media The purpose of CSS is to specify how content is presented to the user. This presentation can take more than one form. For example, you are probably reading this on a device with a display. But you might also want to project it to a big screen for a large audience, or you might want to print it. These different media have different
characteristics. CSS has the capacity to present content according to the media type. To specify rules that are specific to a type of media, use @media followed by the media type, followed by curly braces that enclose the rules. Example A document on a website has a navigation area that contains the primary site menu. In the markup language, the navigation area's parent element has the id nav-are...
Mobile first - Progressive web apps (PWAs)
following JS block to test whether media queries are supported, and if not, to load in respond.js, Scott Jehl's matchMedia and media query polyfill. if(!Modernizr.mq('only all')) { require('respond'); } EDITORIAL NOTE: This currently doesn't work, and I'm not sure why. Ongoing work required. matchMedia is also very useful in many other ways. Imagine you wanted to include some kind of WebGL
chart in the desktop version of the site requiring a WebGL library like Three but didn't want it included in the mobile version? You could create a block to only load the library in the case of narrow screen devices: if(window.matchMedia("(min-width: 481px)").matches) { require('three'); } We can, therefore, save the bandwidth for browsers that don't need it. Modernizr CSS and JS Back to Moderni...
Structural overview of progressive web apps - Progressive web apps (PWAs)
games.js img/ favicon.ico fonts/ icons/ img/ bg.png js13kgames.png index.html js13kpwa.webmanifest style.css sw.js The HTML The HTML in the file index.html creates the structure of the app. The parts that are directly relevant to the app shell model are found outside the <section> with the ID content within this page. ...
SVG Core Attributes - SVG: Scalable Vector Graphics
a null attribute value (xml:lang="") to indicate an unknown language. Instead, use xml:lang="und". SVG 2 introduce the new lang attributes. If both lang and xml:lang attribute are used, xml:lang has priority over lang. Value: Any valid language ID; Animatable: No xml:space Deprecated since SVG 2 SVG supports the standard XML attribute xml:space to specify the handling of white space
characters within a given <text> element's
character data. Note: Instead of using the xml:space attribute you should use the white-space CSS property. Value: default | preserve; Animatable: No ...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
atable: No image-rendering It provides a hint to the browser about how to make speed vs. quality tradeoffs as it performs image processing. Value: auto|optimizeQuality|optimizeSpeed; Animatable: Yes kerning Deprecated since SVG 2 It indicates whether the browser should adjust inter-glyph spacing. Value: auto|<length>|inherit; Animatable: Yes letter-spacing It controls spacing between text
characters. Value: normal|<length>|inherit; Animatable: Yes lighting-color It defines the color of the light source for filter primitives elements <feDiffuseLighting> and <feSpecularLighting>. Value: <color>; Animatable: Yes marker-end It defines the arrowhead or polymarker that will be drawn at the final vertex of the given <path> element or basic shape. Value: <FuncIRI>|none|inherit; Animatab...
accent-height - SVG: Scalable Vector Graphics
The accent-height attribute defines the distance from the origin to the top of accent
characters, measured by a distance within the font coordinate system. Only one element is using this attribute: <font-face> font-face For <font-face>, accent-height defines the distance from the origin to the top of accent
characters, measured by a distance within the font coordinate system. Value <number> Default value Value of ascent Animatable No Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'accent-height' in that specification. Recommendation Initial definition ...
begin - SVG: Scalable Vector Graphics
the function repeat() with an integer value specifying the number of repetitions as parameter. An optional offset value as defined in <offset-value> can be appended. <accessKey-value> This value defines an access key that should trigger the animation. The element animation will begin when the user presses the specified key. A valid accessKey-value consists of the function accessKey() with the
character to be input as parameter. An optional offset value as defined in <offset-value> can be appended. <wallclock-sync-value> This value defines the animation start time as a real-world clock time. A valid wallclock-sync-value consists of the function wallclock() with a time value as parameter. The time syntax is based upon the syntax defined in ISO 8601. indefinite The begin of the animation...
data-* - SVG: Scalable Vector Graphics
The data-* SVG attributes are called custom data attributes. They let SVG markup and its resulting DOM share information that standard attributes can't, usually for scripting purposes. Their custom data are available via the SVGElement interface of the element the attributes belong to, with the SVGElement.dataset property. The * can be replaced by any
characters allowed in XML's rules for names, with the following restrictions: Can't start with xml. No semicolons (;, U+003A). No capital A to Z letters. The SVGElement.dataset property is a DOMStringMap that provides the attribute data-test-value via SVGElement.dataset.testValue. Hyphen
characters (-, U+002D) are removed and the next letter is capitalized, resulting in the camelCase format. Specifications Specification S...
direction - SVG: Scalable Vector Graphics
The direction attribute specifies the inline-base direction of a <text> or <tspan> element. It defines the start and end points of a line of text as used by the text-anchor and inline-size properties. It also may affect the direction in which
characters are positioned if the unicode-bidi property's value is either embed or bidi-override. It applies only to glyphs oriented perpendicular to the inline-base direction, which includes the usual case of horizontally-oriented Latin or Arabic text and the case of narrow-cell Latin or Arabic
characters rotated 90 degrees clockwise relative to a top-to-bottom inline-base direction. In many cases, the bidirectional Unicode algorithm produces the desired result automatically, so this attribute doesn't need to be specified in those cases. For other case...
dominant-baseline - SVG: Scalable Vector Graphics
tribute on the element on which the dominant-baseline attribute occurs, otherwise the baseline-table font-size remains the same as that of the element. If there is no parent text content element, the scaled-baseline-table value is constructed as above for <text> elements. use-script The dominant-baseline and the baseline-table components are set by determining the predominant script of the
character data content. The writing-mode, whether horizontal or vertical, is used to select the appropriate set of baseline-tables and the dominant baseline is used to select the baseline-table that corresponds to that baseline. The baseline-table font-size component is set to the value of the font-size attribute on the element on which the dominant-baseline attribute occurs. no-change The dominant...
end - SVG: Scalable Vector Graphics
tion repeat() with an integer value specifying the number of repetitions as parameter. An optional offset value as defined in <offset-value> can be appended. <accessKey-value> This value defines an access key that should trigger the end of the animation. The element animation will end when the user presses the specified key. A valid accessKey-value consists of the function accessKey() with the
character to be input as parameter. An optional offset value as defined in <offset-value> can be appended. <wallclock-sync-value> This value defines the animation end time as a real-world clock time. A valid wallclock-sync-value consists of the function wallclock() with a time value as parameter. The time syntax is based upon the syntax defined in ISO 8601. indefinite The end of the animation wil...
font-variant - SVG: Scalable Vector Graphics
svg"> <text y="20" font-variant="normal">Normal text</text> <text x="100" y="20" font-variant="small-caps">Small-caps text</text> </svg> Usage notes Value normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) ||
character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-widt...
letter-spacing - SVG: Scalable Vector Graphics
If the attribute value is a unitless number (like 128), the browser processes it as a <length> in the current user coordinate system. If the attribute value has a unit identifier, such as .25em or 1%, then the browser converts the <length> into its corresponding value in the current user coordinate system. Note: As a presentation attribute, letter-spacing can be used as a CSS property. See the css letter-spacing property for more information. ...
path - SVG: Scalable Vector Graphics
Two elements are using this attribute: <animateMotion> and <textPath> html, body, svg { height: 100%; } <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path id="MyPath" fill="none" stroke="silver" d="M10,90 Q90,90 90,45 Q90,10 50,10 Q10,10 10,40 Q10,70 45,70 Q70,70 75,50" /> <text> <textPath path="M10,90 Q90,90 90,45 Q90,10 50,10 Q10,10 10,40 Q10,70 45,70 Q70,70 75,50"> Quick brown fox jumps over the lazy dog. ...
spacing - SVG: Scalable Vector Graphics
The spacing attribute indicates how the user agent should determine the spacing between typographic
characters that are to be rendered along a path. Only one element is using this attribute: <textPath> Usage notes Value auto | exact Default value exact Animatable Yes auto This value indicates that the user agent should use text-on-a-path layout algorithms to adjust the spacing between typographic
characters in order to achieve visually appealing results. exact This value indicates that the typographic
characters should be rendered exactly according to the spacing rules as specified by the layout rules for text-on-a-path. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition o...
target - SVG: Scalable Vector Graphics
(tab, inline frame, object, etc.) for display of the linked content. If a context with this name already exists, and can be securely accessed from this document, it is re-used, replacing the existing content. If it does not exist, it is created (the same as '_blank', except that it now has a name). The name must be a valid XML Name [XML11], and should not start with an underscore (U+005F LOW LINE
character), to meet the requirements of a valid browsing context name from HTML. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'target' in that specification. Candidate Recommendation Removed the _replace value. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'target' in that specificatio...
textLength - SVG: Scalable Vector Graphics
The textLength attribute, available on SVG <text> and <tspan> elements, lets you specify the width of the space into which the text will draw. The user agent will ensure that the text does not extend farther than that distance, using the method or methods specified by the lengthAdjust attribute. By default, only the spacing between
characters is adjusted, but the glyph size can also be adjusted if you change lengthAdjust. By using textLength, you can ensure that your SVG text displays at the same width regardless of conditions including web fonts failing to load (or not having loaded yet). Four elements are using this attribute: <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 200 60" xmlns="http://www.w3.org/2000/svg"> <text y="20" textLe...
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 <urange># Default value None Animatable No <urange># 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 ...
vector-effect - SVG: Scalable Vector Graphics
rdinate system used by the element and its descendants. The scale of that user coordinate system does not change in spite of any transformation changes from a host coordinate space. However, it does not specify the suppression of rotation and skew. Also, it does not specify the origin of the user coordinate system. Since this value suppresses scaling of the user coordinate system, it also has the
characteristics of non-scaling-stroke. non-rotation This value specifies a special user coordinate system used by the element and its descendants. The rotation and skew of that user coordinate system is suppressed in spite of any transformation changes from a host coordinate space. However, it does not specify the suppression of scaling. Also, it does not specify the origin of user coordinate system...
widths - SVG: Scalable Vector Graphics
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' in that specification. Recommendation Initial definition ...
xml:lang - SVG: Scalable Vector Graphics
w.w3.org/2000/svg"> <text xml:lang="en-US">This is some English text</text> </svg> Usage notes Value <language-tag> Default value None Animatable No <language-tag> This value specifies the language used for the element. The syntax of this value is defined in the BCP 47 specification. The most common syntax is a value formed by a lowercase two-
character part for the language and an uppercase two-
character part for the region or country, separated by a minus sign, e.g. en-US for US English or de-AT for Austrian German. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'xml:lang' in that specification. Candidate Recommendation Made the lang attribute (without n...
Compatibility sources - SVG: Scalable Vector Graphics
evision history for Firefox http://www.webkit.org/projects/svg/status.xml together with its recorded archive for WebKit, Safari and Chrome http://www.opera.com/docs/specs/opera9/svg/ and accompanying pages for Opera >= 9, http://www.opera.com/docs/specs/opera8/ for Opera 8 http://blogs.msdn.com/b/ie/archive/2010/03/18/svg-in-ie9-roadmap.aspx for hints on IE9 support status The SVG support
charts at Codedread.com for basic checks against the W3C test suite Wikipedia for basic hints, not normative ...
<desc> - SVG: Scalable Vector Graphics
Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<desc>' in that specification. Recommendation Initial definition ...
<metadata> - SVG: Scalable Vector Graphics
The <metadata> SVG element adds metadata to SVG content. Metadata is structured information about data. The contents of <metadata> should be elements from other XML namespaces such as RDF, FOAF, etc. Usage context CategoriesDescriptive elementPermitted contentAny elements or
character data Attributes Global attributes Core attributes Global event attributes Specific attributes None DOM Interface This element implements the SVGMetadataElement interface. Example <svg width="400" viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <metadata> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:connect="http://www.w3.org/1999/08/29-svg-connections-in-RDF#"> <rdf:Description about="#CableA"...
<missing-glyph> - SVG: Scalable Vector Graphics
The <missing-glyph> SVG element's content is rendered, if for a given
character the font doesn't define an appropriate <glyph>. Usage context CategoriesNonePermitted contentAny number of the following elements, in any order:Animation elementsDescriptive elementsShape elementsStructural elementsGradient elements<a>, <altGlyphDef>, <clipPath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignObject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> Attributes Global attributes Core attributes Presentation attributes class style Specific attributes d horiz-adv-x vert-origin-x vert-origin-y vert-adv-y DOM Interface This element implements the SVGMissingGlyphElement interface. Specifications Specification Statu...
<script> - SVG: Scalable Vector Graphics
alue: application/ecmascript; Animatable: no xlink:href Deprecated since SVG 2 The URL to the script to load. Value type: <URL> ; Default value: none; Animatable: no Global attributes Core Attributes Most notably: id Styling Attributes class, style Event Attributes Global event attributes, Document element event attributes Usage notes CategoriesNonePermitted contentAny elements or
character data Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of '<script>' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<script>' in that specification. Recommendation Initial definition ...
<style> - SVG: Scalable Vector Graphics
itle This attribute the title of the style sheet which can be used to switch between alternate style sheets. Value type: <string>; Default value: none; Animatable: no Global attributes Core Attributes Most notably: id Styling Attributes class, style Event Attributes Global event attributes, Document element event attributes Usage notes CategoriesNonePermitted contentAny elements or
character data Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of '<style>' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<style>' in that specification. Recommendation Initial definition ...
Paths - SVG: Scalable Vector Graphics
l="green"/> <path d="M 230 80 A 45 45, 0, 1, 0, 275 125 L 275 80 Z" fill="red"/> <path d="M 80 230 A 45 45, 0, 0, 1, 125 275 L 125 230 Z" fill="purple"/> <path d="M 230 230 A 45 45, 0, 1, 1, 275 275 L 275 230 Z" fill="blue"/> </svg> Arcs are an easy way to create pieces of circles or ellipses in drawings. For instance, a pie
chart would require a different arc for each piece. If transitioning to SVG from <canvas>, arcs can be the hardest thing to learn, but are also much more powerful. Complete circles and ellipses are the only shapes that SVG arcs have trouble drawing. Because the start and end points for any path going around a circle are the same point, there are an infinite number of circles that could be chosen, and...
Subresource Integrity - Web security
command invocation such as this: shasum -b -a 384 FILENAME.js | awk '{ print $1 }' | xxd -r -p | base64 Notes: The pipe-through-xxd step takes the hexadecimal output from shasum and converts it to binary. The pipe-through-awk step is necessary because shasum will pass the hashed filename in its output to xxd. That can have disastrous consequences if the filename happens to have valid hex
characters in it -- because xxd will also decode that and pass it to base64. Additionally, the SRI Hash Generator at https://www.srihash.org/ is an online tool you can use to generate SRI hashes. Cross-Origin Resource Sharing and Subresource Integrity For subresource-integrity verification of a resource served from an origin other than the document in which it's embedded, browsers additionally ch...
Using custom elements - Web Components
nstructor() { // Always call super first in constructor super(); // write element functionality in here ... } } We will not explain the element functionality in any detail here, but you can discover how it works by checking out the source code. The only real difference here is that our element is extending the HTMLUListElement interface, and not HTMLElement. So it has all the
characteristics of a <ul> element with the functionality we define built on top, rather than being a standalone element. This is what makes it a customized built-in, rather than an autonomous element. Next, we register the element using the define() method as before, except that this time it also includes an options object that details what element our custom element inherits from: customElements.de...
Using shadow DOM - Web Components
gh-level view This article assumes you are already familiar with the concept of the DOM (Document Object Model) -- a tree-like structure of connected nodes that represents the different elements and strings of text appearing in a markup document (usually an HTML document in the case of web documents). ...
normalize-space - XPath
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The normalize-space function strips leading and trailing white-space from a string, replaces sequences of whitespace
characters by a single space, and returns the resulting string. Syntax normalize-space( [string] ) Arguments string (optional) The string to be normalized. If omitted, string used will be the same as the context node converted to a string. Returns The normalized string. Defined XPath 1.0 4.2 Gecko support Supported. ...